save_session not accepting args [message #4428] |
Fri, 26 July 2002 17:47 |
jbutler
Messages: 13 Registered: July 2002
Karma:
|
Junior Member |
|
|
Using this test code, I confirmed that my installation is passing variables to a function within a class using arguments:
begin vartest.php ====
<?
include_once("include/vartest.inc");
$id=255;
$t=new ttest;
$t->pass_test($id);
?>
end vartest.php ====
begin include/vartest.inc ====
<?
class ttest {
var $id=NULL;
var $idb=NULL;
function pass_test($idb) {
$this->idb=$idb;
echo $this->idb;
}
}
?>
end include/vartest.inc ====
The resulting echo is: 255 ... Success!
However the FUD Forum does not reproduce this success:
begin relevant lines from login.php (~line 73)====
if ( @count($HTTP_POST_VARS) && !error_check() ) {
if ( !($id = get_id_by_radius($login, $password)) ) {
set_err('login', 'Invalid login/password combination');
}
else {
$usr = new fud_user_reg;
$usr->get_user_by_id($id);
if ( !isset($ses) ) $ses = new fud_session;
$uck=empty($GLOBALS["HTTP_POST_VARS"]["use_cookie"]) ? 1:NULL;
$ses->save_session($id,$uck);
end login.php ====
(The save_session function is, of course, contained in class "fud_session" in "cookies.inc", which is "include_once" during "users.inc" init which is "include_once" during the "login.php" init...as you well know!)
The value of the variable $id is being correctly assigned before the invocation of the save_session function, however it is not being accepted by the "user_id=''" argument in that function.
For example:
...
header("Location: test.php?tvar=".$id);
$ses->save_session($id,$uck);
...
echos $tvar as the correct user_id for whatever test user, but
...
function save_session($user_id='',$not_use_cookie='') {
header("Location: test.php?tvar=".$user_id);
...
echos $tvar as an an empty value.
I have tried forcing global status on $id, adding $id to the HTTP_SESSION_VARS array, and manually assigning a value to $id before passing it to save_session (i.e. $id=200;$ses->save_session...), all without success.
Any thoughts as to what might be causing a resetting of the $id value to NULL/empty between the invoking of the function and the execution of the function?
Thank you in advance.
FUD Forum 1.16, FreeBSD 4x, PHP 4.12
|
|
|