How would i go about adding a function that checks the db for the users sha1 password value?
<?php
//processlogin.php
session_start();
require('config.php');
$username = $_POST['username'];
$password = $_POST['password'];
$username = stripslashes($username);
$password = stripslashes($password);
$hashedpassword = sha1($password);
$sql = "select * from users where username = '$username' and password = '$hashedpassword' ";
$result = mysql_query($sql) or die ( mysql_error() );
$count = mysql_num_rows($result);
if ($count == 1) {
$_SESSION['loggedIn'] = "true";
$_SESSION['username'] = $row['username'];
$_SESSION['email'] = $row['email'];
header("Location: welcome.php");
} else {
$_SESSION['loggedIn'] = "false";
header("Location: error.php");
}
?>
I am pretty new to php, so sorry if this is simple answer :)