HI I have a very simple login script that I've used quite a few times before, which checks username and password against database fields.
For some reason this has stopped working - php ini hasn't changed, and the tmp folder is writable to. I don't get the Login failed message, so the mysql query must have returned 1 row.
When I use
print_r($_SESSION);
just:
Array (
)
is printed.
Has anyone else ever got something similar suddenly happen?!
Code:
session_start();
require_once("../includes/inc.database.php");
$strErrors = "";
if (isset($_POST["submit"]))
{
$user = addslashes($_POST["username"]);
$pword = addslashes($_POST["password"]);
// Create query
$q = "SELECT * FROM `tblusers` "
."WHERE `username`='".$user."' "
."AND `password`='".$pword."' "
."LIMIT 1";
// Run query
$r = mysql_query($q);
if ( $obj = @mysql_fetch_object($r) )
{
// Login O.K., create session variables
$_SESSION['user'] = $obj->userID;
// Redirect to main page
Header("Location: list.php");
}
else
{
//show the login form again, with a failed message
$strErrors .= "<br />* Login failed";
}
}
?>
//html code for form here
When I use
print_r($_SESSION);
just:
Array (
)
is printed.
Has anyone else ever got something similar suddenly happen?!