I'm having some problems on gettin the Login page to redirect the users back to the login page with error message if they input the incorrect login details...
But instead of the redirect i receive an blank white screen (Nothing in View Source and Nothing on page).. How do i fix these issue.
Codes Below:
<?php
session_start();
require("db.php");
if(isset($_SESSION['SESS_LOGGEDIN']) == TRUE)
{
header("Location: " . $config_basedir);
}
if(isset($_POST['submit']))
{
$loginsql = "SELECT * FROM database_Name.users WHERE username = '" . $_POST['username'] . "' AND password = '" . $_POST['password'] . "'";
$loginres = mysql_query($loginsql) or die (mysql_error());
$numrows = mysql_num_rows($loginres)or die (mysql_error());
if($numrows == 1)
{
$loginrow = mysql_fetch_assoc($loginres);
session_register("SESS_LOGGEDIN");
session_register("SESS_USERNAME");
session_register("SESS_USERID");
$_SESSION['SESS_LOGGEDIN'] = 1;
$_SESSION['SESS_USERNAME'] = $loginrow['username'];
$_SESSION['SESS_USERID'] = $loginrow['id'];
header("Location:http://www.webaddress.com/index.php");
}
else
{
header("Location:http://www.webaddress.com/login.php?error=1");
}
}
?>
Thanks in advance =)