connect_errno > 0){
die ('Unable to connect to database [' . $db->connect_errno . ']');
}
$sqluname = "select * from userinfo where username = '$username'";
$result = mysqli_query($con, $sqluname);
$row = mysqli_fetch_row ($result);
$verifypass = password_verify ($password,$row[2]);
if ($verifypass) {
$_SESSION['userid'] = $row[0];
$_SESSION['username'] = $row[1];
$_SESSION['usermail'] = $row[3];
$_SESSION['admin'] = $row[4];
$_SESSION['prefaccid'] = $row[5];
$_SESSION['prefaccname'] = $row[6];
$_SESSION['prefcharid'] = $row[7];
$_SESSION['prefcharname'] = $row[8];
include_once ('header.php');
header("refresh:1;url=index.php");
echo 'You have successfully logged in!
';
} else {
echo 'The username or password provided don\'t match!
Please try again
';
exit();
}
?>