35430-vm/login.php
Flatlogic Bot 404752a9bf tes
2025-11-02 20:11:56 +00:00

68 lines
2.3 KiB
PHP

<?php
require_once '_auth.php';
// Handle login submission
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$email = $_POST['email'] ?? null;
$password = $_POST['password'] ?? null;
// --- DEBUGGING START ---
echo '<pre>';
echo 'Form submitted...<br>';
echo 'Email: '; var_dump($email);
echo 'Password: '; var_dump($password);
$login_result = login($email, $password);
echo 'login() result: '; var_dump($login_result);
echo '</pre>';
die(); // Stop execution to see debug output
// --- DEBUGGING END ---
if ($email && $password) {
if (login($email, $password)) {
header("Location: index.php");
exit;
} else {
$error = "Invalid email or password.";
}
} else {
$error = "Please enter both email and password.";
}
}
require_once '_partials/header.php';
?>
<div class="container">
<div class="card auth-card">
<div class="card-body p-5">
<h3 class="card-title text-center mb-4">Sign In</h3>
<form method="POST" action="login.php">
<div class="mb-3">
<label for="email" class="form-label">Email address</label>
<input type="email" class="form-control" id="email" name="email" required>
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<div class="d-flex justify-content-between align-items-center mb-3">
<div class="form-check">
<input type="checkbox" class="form-check-input" id="rememberMe">
<label class="form-check-label" for="rememberMe">Remember me</label>
</div>
<a href="#" class="form-text">Forgot password?</a>
</div>
<div class="d-grid">
<button type="submit" name="login" class="btn btn-primary">Sign In</button>
</div>
</form>
<p class="text-center mt-4 form-text">
Don't have an account? <a href="signup.php">Sign up</a>
</p>
</div>
</div>
</div>
<?php require_once '_partials/footer.php'; ?>