
affiliate.php ( PHP script, UTF-8 Unicode text )
<?php $dataFile = 'data.txt'; // Handle form submission if ($_SERVER['REQUEST_METHOD'] === 'POST') { $name = trim($_POST['name'] ?? ''); $email = trim($_POST['email'] ?? ''); $referralCode = trim($_POST['referral'] ?? ''); if ($name && $email) { $entry = "$name | $email | $referralCode | " . date('Y-m-d H:i:s') . "n"; file_put_contents($dataFile, $entry, FILE_APPEND | LOCK_EX); $message = "✅ Thanks for signing up, $name!"; } else { $message = "⚠️ Please fill in all required fields."; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Affiliate Signup</title> <style> body { font-family: sans-serif; background: #f4f4f4; padding: 40px; } .form-box { background: #fff; padding: 20px; max-width: 400px; margin: auto; border-radius: 8px; box-shadow: 0 0 10px rgba(0,0,0,0.1); } input, button { width: 100%; padding: 10px; margin-top: 10px; font-size: 1rem; } .message { margin-top: 20px; font-weight: bold; color: green; } </style> </head> <body> <div class="form-box"> <h2>Affiliate Signup</h2> <form method="POST"> <input type="text" name="name" placeholder="Your Name" required /> <input type="email" name="email" placeholder="Your Email" required /> <input type="text" name="referral" placeholder="Referral Code (optional)" /> <button type="submit">Sign Up</button> </form> <?php if (!empty($message)): ?> <div class="message"><?= htmlspecialchars($message) ?></div> <?php endif; ?> </div> </body> </html>