prepare("SELECT setting_value FROM system_settings WHERE setting_key = ?"); $stmt->execute([$key]); $row = $stmt->fetch(); return $row ? $row['setting_value'] : $default; } if ($_SERVER['REQUEST_METHOD'] === 'POST') { $account = $_POST['account'] ?? ''; $password = $_POST['password'] ?? ''; $confirm_password = $_POST['confirm_password'] ?? ''; $verify_code = $_POST['verify_code'] ?? ''; $agree = isset($_POST['agree']); if (empty($account) || empty($password)) { $error = 'Please fill in all fields'; } elseif ($password !== $confirm_password) { $error = 'Passwords do not match'; } elseif ($email_verify_enabled && empty($verify_code)) { $error = 'Email verification code is required'; } elseif (!$agree) { $error = 'You must agree to the Terms and Privacy Policy'; } else { if ($email_verify_enabled && $verify_code !== '123456') { $error = 'Invalid verification code (use 123456 for demo)'; } else { try { $hash = password_hash($password, PASSWORD_DEFAULT); $stmt = db()->prepare("INSERT INTO users (username, email, password_hash) VALUES (?, ?, ?)"); $username = strpos($account, '@') === false ? $account : explode('@', $account)[0]; $email = strpos($account, '@') !== false ? $account : $account . '@byro.io'; $stmt->execute([$username, $email, $hash]); $userId = db()->lastInsertId(); // Initialize balance $stmt = db()->prepare("INSERT INTO user_balances (user_id, symbol, available) VALUES (?, 'USDT', 0)"); $stmt->execute([$userId]); $_SESSION['user_id'] = $userId; header('Location: /'); exit; } catch (PDOException $e) { $error = 'Account already exists or database error'; } } } } include __DIR__ . '/../includes/header.php'; ?>
Byro

Create your account to start trading

Already have an account?