🇺🇸 English
🇫🇷 Français
🇹🇿 Swahili

JOIN VIPORA

Start your journey towards financial freedom today. Join thousands of investors worldwide.

Create Account

Fill in the details below to get started.

$fullname = trim($_POST['fullname'] ?? ''); $username = trim($_POST['username'] ?? ''); $email = trim($_POST['email'] ?? ''); $country_id = $_POST['country_id'] ?? ''; $phone = trim($_POST['phone'] ?? ''); $referral_code_input = trim($_POST['referral'] ?? ''); $password = $_POST['password'] ?? ''; $confirm_password = $_POST['confirm_password'] ?? ''; // Simple Validation if (empty($fullname) || empty($username) || empty($email) || empty($country_id) || empty($phone) || empty($password)) { $error = "All fields except referral code are required."; } elseif ($password !== $confirm_password) { $error = "Passwords do not match."; } elseif (strlen($password) < 6) { $error = "Password must be at least 6 characters."; } else { try { // Check if username or email already exists $stmt = $pdo->prepare("SELECT id FROM users WHERE username = ? OR email = ?"); $stmt->execute([$username, $email]); if ($stmt->fetch()) { $error = "Username or Email already exists."; } else { // Generate a unique referral code for the new user $new_referral_code = strtoupper(substr(md5(uniqid($username, true)), 0, 8)); // Check if referred by someone $referred_by = null; if (!empty($referral_code_input)) { $stmt = $pdo->prepare("SELECT id FROM users WHERE referral_code = ?"); $stmt->execute([$referral_code_input]); $referrer = $stmt->fetch(); if ($referrer) { $referred_by = $referrer['id']; } } $password_hash = password_hash($password, PASSWORD_DEFAULT); $stmt = $pdo->prepare("INSERT INTO users (country_id, username, phone, email, password_hash, referral_code, referred_by, language) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); $stmt->execute([$country_id, $username, $phone, $email, $password_hash, $new_referral_code, $referred_by, $lang]); $user_id = $pdo->lastInsertId(); // Log the user in $_SESSION['user_id'] = $user_id; $_SESSION['username'] = $username; $_SESSION['role'] = 'user'; $_SESSION['lang'] = $lang; header('Location: ' . BASE_URL . 'client'); exit(); } } catch (PDOException $e) { $error = "Registration failed: " . $e->getMessage(); } } } ?>

JOIN VIPORA

Start your journey towards financial freedom today. Join thousands of investors worldwide.

Create Account

Fill in the details below to get started.