0) { $user = mysqli_fetch_assoc($result); $_SESSION['username'] = $user['username']; // Initialize balance in session (default 1000 if not set) $_SESSION['balance'] = isset($user['balance']) ? (int)$user['balance'] : 1000; header("Location: html.php"); exit; } else { $error = 'Invalid username or password.'; } } ?>
Welcome back — sign in to continue