Browser Problem? Coding Problem? Session Problem?
| From: | Mike | Date: | Fri, 11 Apr 2003 05:45:43 +0000 |
| Subject: | Browser Problem? Coding Problem? Session Problem? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-143448@lists.php.net to get a copy of this message | ||
Hi all,
I've tried this on Mozilla 1.3, 1.4a and IE 6. It works on IE 6, but not
mozilla. (Or at least it doesn't seem to.) I've tried clearing my
caches, cookies, everything (even unsetting all session variables).
It's a login page:
session_start();
if ($_SESSION['logged_in'] == true && $_SESSION['username']) {
header("location: index2.php");
}
//the loginFunction echoes all the stuff for the login page
function loginFunction() {
//this function builds the form, cut out for simplicity
//it passes two variables: $_POST['username'] and $_POST['password']
}
//process
if (!$_POST['username'] || !$_POST['password']) {
//if there is no username and password in post run the
//loginfunction
loginFunction();
} else {
require ("../variables/global.var.php");
require ("variables/db_connect.var.php");
//an array of login values
$db_check = array("username" => $_POST['username'], "password"
=>
md5($_POST['password']));
//the sql query
$sql = "SELECT * FROM users WHERE username='" . $db_check['username'] .
"' ";
$sql .= "AND password='" . $db_check['password'] . "'";
//execute the query
$query = $db->getRow($sql);
//error handling
if (DB::iserror($query)) {
die($query->getMessage());
}
if ($query) {
$_SESSION['logged_in'] = true;
$_SESSION['username'] = $db_check['username'];
header("location: index.php");
} else {
header("location: index.php?wrong=true");
}
}
On Mozilla I just keep getting the login page, again and again. It works
first time on IE...