i think i have a problem with my crypt(); php function. No errors show up in my error log.
Im having difficulties when it comes to authenticating a login page.
if( $page_mode == 'Login' )
{
require "globe.php";
//simple post from below
$username = htmlentities(trim($_POST['username']));
$username = mysqli_real_escape_string($mysqli, $username);
$password = trim($_POST['password']);
$query = mysqli_query($mysqli, "SELECT * FROM Persons WHERE Username = '$username'");
$row = mysqli_fetch_assoc($query);
$numrows = mysqli_num_rows($query);
$dbuser = $row['Username'];
$dbpass = $row['Password'];
$hashed_password = crypt($password, $dbpass);
if( ($username == '') || ($password == '') ) {
$error_string .= '<font color=red>You have left either the username or password field blank!</font>';
}
else if ($numrows == 0)
{
$error_string .= '<font color=red>No username can be found!</font>';
}
else if ($numrows == 1)
{
if ($password == $hashed_password)
{
$error_string .= '<font color=red>Details checked out</font>';
}
}
else {
$error_string .= '<font color=red>There was an error. Please contact an Admin</font>';
}
}
None of the error stings display when I test it when i put in a username and password.
Would be grateful if anyone can resolve this
Should mention the error only started coming with the check of dbpass with usepass