RE: Please help: session variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,  

Since it was migrated from old PHP version (5.3 or earlier), I replaced deprecated session_register(); with unconditionally initialization of session variables like following:

session_start();
//session_register('logined');
$_SESSION['logined'] = "";

Then posting the form will execute these codes and cleared the session variables...

Then modified the code to prevent overwriting the session variable if not null:

session_start();
if(!(isset($_SESSION['logined']))) {
  $_SESSION['logined'] = "";
}

Not sure if it's the best way to do that though it works now.
Sorry for the trouble caused to you all.

Thanks and rgds

-----Original Message-----
From: mbox@xxxxxx <mbox@xxxxxx> 
Sent: Tuesday, June 23, 2020 10:12 PM
To: PHP General <php-general@xxxxxxxxxxxxx>
Subject: Re: Please help: session variable

> On Jun 22, 2020, at 11:25 PM, ST Wong (ITSC) <ST@xxxxxxxxxxxxxxxx> wrote:
> 
> After some debugging, found that the session variables are initialized unconditionally and thus got cleared upon any post operation.  

	Would you explain this more fully?  I’m having similar problems with a script losing session variables.

> It’s fixed and works now.

	How did you fix it?

Thanks,
Frank




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux