connect_errno > 0){
die ('Unable to connect to database [' . $db->connect_errno . ']');
}
$sqllogin = "SELECT * FROM users WHERE users.username = '$username' and passwd = '$password'";
if ($result = $con->query($sqllogin)){
$row_cnt = mysqli_num_rows($result);
if ($row_cnt > 0){
while ($row = $result->fetch_array()){
$uname = $row['username'];
$uid = $row['userid'];
$_SESSION['username'] = $uname;
$_SESSION['userid'] = $uid;
}
header("refresh:1;url=index.php");
echo 'You have successfully logged in ...
Returning to index in a few seconds';
} else {
echo 'That was not a valid username or password!
';
echo 'Please try again here';
}
}
include_once ('footer.php');
?>