You are here: Re: Passing session variables across pages « PHP Programming Language « IT news, forums, messages
Re: Passing session variables across pages

Posted by K. A. on 05/02/07 08:03

On May 2, 11:39 am, Mike Roetgers <miker...@informatik.uni-bremen.de>
wrote:
> K. A. schrieb:
>
>
>
> > I have two servers at work, 'A' for testing and development, and
> > server 'B' for production.
> > On server A, I wrote a PHP test code to login users then direct them
> > to a personalized page. This is done in 3 steps:
> > Step 1. Normal http login page.
> > Step 2. A page called login.php that takes the posted username, stores
> > it as $_SESSION["username"], and registers it
> > session_register("username"); user is taken to the personalized page
> > according to his username and things are fine up to here. (this page
> > is not displayed, only for redirecting purposes).
> > Step 3. On the personalized page, I check whether session is started,
> > then display a welcome message with the username. Session variables
> > are passed across pages fine.
>
> > Next, I did exactly the same steps on server B; at step 2 (above) user
> > is directed to the correct page. But when I get to step 3, the session
> > seems to lose or set all its variables to NULL (I checked this using
> > var_dump($_SESSION)).
>
> > The codes on server A and B are identical. I copied the php.ini file
> > from server A to B (just in case there were differences) and restarted
> > Apache on server B. But still, session variables are lost in Step 3
> > although the session is still running.
>
> > Any ideas why?
>
> I guess session_register causes the problem.
> You should read the "Caution"-boxes onhttp://php.net/session_register.- Hide quoted text -
>
> - Show quoted text -

I tried removing session register but this turned out worse as it will
store the session variable in the first place.
I mean, before removing session_register, the value
$_SESSION["userid"] was set to NULL, but without session_register, it
will not even know that there is something called
$_SESSION["userid"] !

Still wondering why it will work on one server but not the other!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация