note 53720 rejected from ref.session by didou
| From: | didou@php.net | Date: | Fri, 10 Jun 2005 13:22:53 +0000 |
| Subject: | note 53720 rejected from ref.session by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-90227@lists.php.net to get a copy of this message | ||
Note Submitter: jgrantham at gmail dot com
----
Can anyone explain to me why these variables are not getting set?
I run another website that uses the same code and it works for that one but not this one.
BTW, they are running on the same server so the PHP verison is the same.
--- code ---
<?php
include("begin.php");
$textpart = "login";
include("getlang.php");
include("genlib.php");
include("log.php" );
ham_db_connect($database_host,$database_name,
$database_username,$database_password) or exit;
$login_url = getURL( "login", 1 );
$query = "SELECT * FROM users WHERE username = \"$username\" and password =
\"$password\"";
$result = mysql_query($query) or die ("Cannot execute query: $query");
$found = mysql_num_rows( $result );
if( $found == 1 ) {
$row = mysql_fetch_assoc( $result );
$check = strcmp( $password, $row[password] );
}
mysql_free_result($result);
if( $found == 1 && !$check) {
session_start();
$newdate = date ("Y-m-d", time() + ( 3600 * $time_offset ) );
$query = "UPDATE users SET lastlogin=\"$newdate\" WHERE
username=\"$row[username]\"";
$uresult = mysql_query($query) or die ("$admtext[cannotexecutequery]: $query");
if( $remember ) {
$newroot = ereg_replace( "/", "-", $rootpath );
setcookie("hamuser_$newroot", $username, time()+3153600, "/");
setcookie("hampass_$newroot", $password, time()+3153600, "/");
}
if ($row[admin] == "Yes"){
session_register('admin');
$is_admin = $HTTP_SESSION_VARS['admin'] = $row[admin];
}
session_register('logged_in');
session_register('currentuser');
session_register('currentuserdesc');
$logged_in = $HTTP_SESSION_VARS[logged_in] = 1;
$currentuser = $HTTP_SESSION_VARS[currentuser] = $row[real_name];
$currentuserdesc = $HTTP_SESSION_VARS[currentuserdesc] = $row[description];
if( $HTTP_SESSION_VARS[destinationpage] )
header( "Location: " . $HTTP_SESSION_VARS[destinationpage] );
else
header( "Location: " . $homepage );
exit;
}
else {
header( "Location: " . "$login_url" . "message=loginfailed" );
}
?>
--- end code ---
Thanks for any help.
Jeff
http://genealogy.kb5wck.com
http://kb5wck.com