save_session not accepting args [message #4428] |
Fri, 26 July 2002 17:47 |
jbutler
Messages: 13 Registered: July 2002
Karma: 0
|
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
|
|
|
|
Re: save_session not accepting args [message #4430 is a reply to message #4429] |
Fri, 26 July 2002 18:38 |
jbutler
Messages: 13 Registered: July 2002
Karma: 0
|
Junior Member |
|
|
This seems like a basic PHP function.
Is there, in fact, something between the invoking of the function and the reception of the arg by the function? It doesn't seem likely...
Has this part of the code been changed for v.2.3?
Thank you for the upgrade notice...and further comments.
[Updated on: Fri, 26 July 2002 18:40] Report message to a moderator
|
|
|
|
Re: save_session not accepting args [message #4432 is a reply to message #4431] |
Fri, 26 July 2002 20:08 |
jbutler
Messages: 13 Registered: July 2002
Karma: 0
|
Junior Member |
|
|
Okay, thanks.
I'm doing a new installation of v.2.3.
I am still wondering about why the variable was not passed to the function, though...
I'll reply with the results after the new installation.
Thank you.
|
|
|