+
+
+
+
+
+
= __('login') ?>
+
Welcome back to Byro Exchange
+
+
+
+
+ = $error ?>
+
+
+
+
+
-
-
-
-
-
diff --git a/auth/register.php b/auth/register.php
index 098d190..437818a 100644
--- a/auth/register.php
+++ b/auth/register.php
@@ -33,19 +33,26 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} else {
try {
$hash = password_hash($password, PASSWORD_DEFAULT);
- $stmt = db()->prepare("INSERT INTO users (username, email, password_hash) VALUES (?, ?, ?)");
+ $uid = '618120' . mt_rand(100000, 999999);
+ $stmt = db()->prepare("INSERT INTO users (username, email, password_hash, uid, credit_score) VALUES (?, ?, ?, ?, ?)");
$username = strpos($account, '@') === false ? $account : explode('@', $account)[0];
$email = strpos($account, '@') !== false ? $account : $account . '@byro.io';
- $stmt->execute([$username, $email, $hash]);
+ $stmt->execute([$username, $email, $hash, $uid, 80]);
$userId = db()->lastInsertId();
+ if (session_status() === PHP_SESSION_NONE) session_start();
+ $_SESSION['user_id'] = $userId;
+ $_SESSION['username'] = $username;
+ $_SESSION['uid'] = $uid;
+ $_SESSION['role'] = 'user';
+ $_SESSION['credit_score'] = 80;
+
// Initialize balance
- $stmt = db()->prepare("INSERT INTO user_balances (user_id, symbol, available) VALUES (?, 'USDT', 0)");
+ $stmt = db()->prepare("INSERT INTO user_balances (user_id, symbol, available) VALUES (?, 'USDT', 1000)"); // Giving some demo USDT
$stmt->execute([$userId]);
- $_SESSION['user_id'] = $userId;
header('Location: /');
exit;
} catch (PDOException $e) {
@@ -61,52 +68,52 @@ include __DIR__ . '/../includes/header.php';
-
-
-
-
-