Checking the password using hashes and salt
From MyWiki
$check = hash('md5', $salt.$_POST['pass']); $stmt = $pdo->prepare('SELECT user_id, name FROM users WHERE email = :em AND password = :pw'); $stmt->execute(array( ':em' => $_POST['email'], ':pw' => $check)); $row = $stmt->fetch(PDO::FETCH_ASSOC); if ( $row !== false ) { $_SESSION['name'] = $row['name']; $_SESSION['user_id'] = $row['user_id']; // Redirect the browser to index.php header("Location: index.php"); return;