prepare("SELECT id FROM users WHERE username = ?"); $stmt->execute([$username]); if ($stmt->fetch()) { $error = "Username already taken."; } else { // Generate UID starting from 618120 $stmt = $pdo->query("SELECT COUNT(*) FROM users"); $count = $stmt->fetchColumn(); $uid = 618120 + $count + mt_rand(1, 9); // Add a small random offset to make it look "randomly sorted" but starting from 618120 // Register and auto-login // Default trading_password is '123456' as requested $stmt = $pdo->prepare("INSERT INTO users (uid, username, password, trading_password, balance) VALUES (?, ?, ?, '123456', 0)"); if ($stmt->execute([$uid, $username, password_hash($password, PASSWORD_DEFAULT)])) { $user_id = $pdo->lastInsertId(); $_SESSION['user_id'] = $user_id; $_SESSION['username'] = $username; $_SESSION['uid'] = $uid; header("Location: index.php"); exit; } else { $error = "Registration failed."; } } } } ?>

Create Account

Join NovaEx - The Leading Crypto Exchange

I have read and agree to the Privacy Policy and Terms of Service.
Already have an account?