prepare("SELECT id, name, email, password, role FROM users WHERE email = ?"); $stmt->execute([$email]); $user = $stmt->fetch(); if ($user && password_verify($password, $user['password'])) { // Password is correct, start session $_SESSION['user_id'] = $user['id']; $_SESSION['user_name'] = $user['name']; $_SESSION['user_role'] = $user['role']; // Redirect to home page header("Location: index.php"); exit(); } else { $errors[] = 'Invalid email or password.'; } } catch (PDOException $e) { $errors[] = "Database error: Could not log in."; // In a real app, you would log this error. // error_log("Login failed: " . $e->getMessage()); } } } ?> Login - Event Platform

Login to Your Account

Don't have an account? Sign up