Here's a *working* section of code... Note the location = "browse.php"; on line 23....
<?
$errmsg = '';
if( isset($username) ) {
require_once('Connections/mySql.php');
mysql_select_db($database_mySql, $mySql);
$rs = mysql_query("select * from employee where initials = '" . strtoupper($username) . "'", $mySql) or die(mysql_error($mySql));
if( !(mysql_num_rows($rs)) ) { // not a valid username
mysql_free_result($rs);
$errmsg = "Invalid Userid";
unset($username);
}
else { // valid user, now validate password and status
$row = mysql_fetch_assoc($rs);
mysql_free_result($rs);
if( $row['pw'] == $password ) { // if correct password
if( $row['status'] == 'a' || $row['status'] == 'm' ) { // if active user
$username = strtoupper($username);
session_register("username");
$authlevel = $row['status']=='a'?1:2;
session_register("authlevel");
mysql_query("update employee set lastlogin = " . (time()-10800) . " where initials = '$username'", $mySql) or die(mysql_error($mySql));
session_write_close();
location = "browse.php";
exit;
}
else { // not active user
$errmsg = "Invalid Userid";
unset($username);
}
}
else { // incorrect password
$errmsg = "Invalid Password";
unset($password);
}
}
}
session_write_close();
?>
Chris Shiflett wrote:
--- Lee Stewart <[EMAIL PROTECTED]> wrote:
It's not $location = xxx, just location = "page.php";
So the dollar sign is missing? Can you show us all of the code in question? (Or did I miss it?)
And it seems to work as a redirect... But not part of the header fuction, and not just setting a variable...
Location is an HTTP header. If that name is being used in any code for some other reason, then the name may be purely coincidental. However, if it is the header you are speaking of, then it is specified using:
header('Location: http://example.org/path/to/script.php');
Of particular note is that the URL is an absolute URL, not a relative one. This is in the snippet of the specification that I quoted earlier.
Hope that helps.
Chris
===== My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php