Files
LudosData/interfaceServices/loginInterface.php
2018-05-01 08:20:56 -04:00

39 lines
745 B
PHP

<?php
require 'dbConfig.php';
$passwordSalt = "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824";
if(isset($_GET['login'])) {
$userName = $_GET['userName'];
$password = $_GET['password'];
$hashedPassword = crypt( $password, $passwordSalt );
$stmt = $connect->prepare('SELECT userId, password FROM users WHERE userName = :userName');
$stmt->execute(array(
':userName' => $userName
));
$data = $stmt->fetch(PDO::FETCH_ASSOC);
if($data == false){
//$errMsg = "User $username not found.";
echo(0);
}else {
if( hash_equals($hashedPassword,$data['password'] ) ) {
echo("valid");
exit;
}else{
echo("d");
echo($hashedPassword . "<br />" . $data['password'] );
}
}
}
?>