Create New Item
×
Item Type
File
Folder
Item Name
×
Search file in folder and subfolders...
File Manager
/
admin
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php // ads-settings.php $fields = [ 'head-code' => 'Head Code (placed before </head>)', 'ads-code1' => 'Ads Code 1', 'ads-code2' => 'Ads Code 2', 'ads-code3' => 'Ads Code 3', // You can add more fields here easily like: // 'ownerurl' => 'Owner URL' ]; $dataDir = __DIR__ . '/data'; if (!file_exists($dataDir)) { mkdir($dataDir, 0777, true); } $message = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST') { foreach ($fields as $key => $label) { $value = $_POST[$key] ?? ''; $filepath = "$dataDir/{$key}.php"; file_put_contents($filepath, $value); } $message = 'Settings saved successfully.'; } // Load existing data $data = []; foreach ($fields as $key => $label) { $filepath = "$dataDir/{$key}.php"; $data[$key] = file_exists($filepath) ? file_get_contents($filepath) : ''; } ?> <!DOCTYPE html> <html lang="en"> <head> <title>Ads Settings</title> <?php include "data/styles.php"?> </head> <body class="bg-gray-100 min-h-screen p-6 text-gray-800 font-inter"> <div class="max-w-4xl mx-auto bg-white shadow-lg rounded-2xl p-6 animate-fade animate-once animate-ease-in"> <div class="flex items-center mb-6"> <i data-lucide="settings" class="w-7 h-7 text-blue-600 mr-3"></i> <h1 class="text-2xl font-semibold text-gray-900">Ads & Code Settings</h1> </div> <!-- Success Message --> <?php if ($message): ?> <div class="bg-green-50 text-green-800 p-4 rounded-xl border border-green-200 flex items-center gap-2 mb-6"> <i data-lucide="check-circle" class="w-5 h-5"></i> <span><?= htmlspecialchars($message) ?></span> </div> <?php endif; ?> <form method="POST" class="space-y-6"> <?php foreach ($fields as $key => $label): ?> <div> <label class="block text-sm font-medium text-gray-700 mb-2"><?= htmlspecialchars($label) ?></label> <textarea name="<?= $key ?>" rows="5" class="w-full p-3 border border-gray-200 rounded-xl bg-gray-50 text-gray-900 focus:ring-2 focus:ring-blue-500 focus:outline-none text-sm transition-colors hover:border-gray-300"><?= htmlspecialchars($data[$key]) ?></textarea> <p class="text-xs text-gray-500 mt-1"> File: <code class="bg-gray-100 px-1 py-0.5 rounded"><?= "admin/data/{$key}.php" ?></code> </p> </div> <?php endforeach; ?> <div class="flex justify-end"> <button type="submit" class="bg-blue-600 text-white px-6 py-2 shadow rounded-xl hover:bg-blue-700 flex items-center justify-center gap-2 transition-transform w-full sm:w-auto"> <i data-lucide="save" class="w-5 h-5"></i> Save Settings </button> </div> </form> </div> </body> </html>