Mooyaa
Mooyaa
php
$host = "localhost";
$username = "root";
$password = "";
$dbname = "my_database";
try {
$email = $_POST['email'];
$password = $_POST['password'];
// Query the database to retrieve the user with the given email
$stmt = $pdo->prepare($sql);
$user = $stmt->fetch();
// Verify the hashed password against the user's stored password
if (password_verify($password, $user['password'])) {
session_start();
$_SESSION['user_id'] = $user['id'];
header("Location: account.php");
exit();