Reply to Re: question about using "global" on one page then using the variable on another page

Your name:

Reply:


Posted by luiheidsgoeroe on 04/06/07 07:51

On 5 apr, 19:28, "Paul" <l...@invalid.com> wrote:
> And it reference $user on the next page. Register_globals are set on the
> existing server but I am moving to a new server where it is not. The code
> of the next page is lilke:
>
> session_register('user');
> $user=$_SESSION['user'];
>
> I also want to turn it around so it's:
> $_SESSION['user'] = $user;
>
> But that fails - $user is empty. By the way, $user is an object.
>
> Any ideas to how to make sure:
> $_SESSION['user'] = $user;
>
> works on the second page?

Like Jerry said, drop the session_register(). Also, on the original
page you'd have to put the object in the session, not in the second
page. So:

First page:
$_SESSION['user'] = $user;

And then you can use it on the next page (if the object hasn't got
recursive/self-referencing qualities).

--
Rik
"Why break one foot if you've got two of them?"

[Back to original 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

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