Hello.
I search to make a login interphase in PHP with PDO.
Can you help me ?
`<?php
include “database/db_connect.php”;
try {
$stmt = $conn->prepare(“SELECT * FROM login WHERE email=:email AND password=:password”);
$stmt->bindParam(‘:email’, $email);
$stmt->bindParam(‘:password’, $password);
$email = $_POST[“email”];
$salt = “asdf”;
$password = $_POST[“password”].$salt;
$password = sha1($password);
$stmt->execute();
if($stmt->rowCount()==1){
$results_login=$stmt->fetch(PDO::FETCH_ASSOC);
$_SESSION[’email’] = $results_login[’email’];
$_SESSION[‘password’] = $results_login[‘password’];
return true;
}else{
return false;
}
echo “Login successfully”;
}
catch(PDOException $e)
{
echo “Error: ” . $e->getMessage();
}
$conn = null;
?>`