Click to See Complete Forum and Search --> : PHP sessions on winXP personal server


mikeyzc
04-04-2005, 09:19 AM
Are there any issues with sessions working correctly when running php on a personal XP webserver as opposed to live on the net?

The section of code I have to unregister a session stops an entire page from loading, includes and all. If take out the unregister code the site loads and functions fine except for the logoff feature which is supposed to unregisters the session.

scragar
04-04-2005, 09:24 AM
have you tried just cleaning out the session:

$_SESSION = array();

? it may be that there is some form of problem actualy deleting them, if you just clean them out then I can almost guarente you'll be fine.

mikeyzc
04-04-2005, 09:38 AM
have you tried just cleaning out the session:

$_SESSION = array();

? it may be that there is some form of problem actualy deleting them, if you just clean them out then I can almost guarente you'll be fine.


so do that instead of the unregister?

scragar
04-05-2005, 07:46 AM
for the moment just try commenting out the unregister code, and add the "$_SESSION = array();" code on a line below it, that way if it doesn't fix the problem you can always go back and try something different.

mikeyzc
04-05-2005, 07:50 AM
for the moment just try commenting out the unregister code, and add the "$_SESSION = array();" code on a line below it, that way if it doesn't fix the problem you can always go back and try something different.

Here's the section of code giving me problems...

$glbl_err = rawurldecode($glbl_err);
if ( $show == 99 )
{
global $currentUser, $tab1;

$nextURL = $tab1; // $base_host . '/index.php';

/* ONLT Remove the cookie for the demo user*/
if ( stristr ( $currentUser->username, 'demo' ))
{
setcookie ( "mysite" );
}

/* Send a logout event to the user audit table */
usraudit_log ( $currentUser->username, 2, null, 'T', 'T' );

/* Clear the user information */
session_unregister ( "currentUser" );
}

scragar
04-05-2005, 07:55 AM
are you using cookies or sessions, setcookie is for cookies while session_unregister is for sessions, thus I'm slightly confused.

mikeyzc
04-05-2005, 09:17 AM
are you using cookies or sessions, setcookie is for cookies while session_unregister is for sessions, thus I'm slightly confused.


it looks like both. the original developer is no longer with the company and i was asked to hash through his code.

scragar
04-05-2005, 09:20 AM
does the page still begin with<?
session_start();
?>
//or
<?
session_id();
session_start();
?>
? maybe something similar, it might be he forgot to define the use of session properly and thus has caused a fatal error.

mikeyzc
04-05-2005, 09:21 AM
does the page still begin with<?
session_start();
?>
//or
<?
session_id();
session_start();
?>
? maybe something similar, it might be he forgot to define the use of session properly and thus has caused a fatal error.


no

scragar
04-05-2005, 09:26 AM
try adding it(the first example), right at the top of the page, before anything else.

or you could belive that he forgot he was using cookies not sessions and drop the current cookies.

mikeyzc
04-05-2005, 10:21 AM
try adding it(the first example), right at the top of the page, before anything else.

or you could belive that he forgot he was using cookies not sessions and drop the current cookies.


i found the line of code causing it all....

$glbl_err = rawurldecode($glbl_err);

what is that doing? looking at the php.net notes on rawurlencode, this line of code doesn't make sense.