You are here: Re: session handling using classes n objects « PHP Programming Language « IT news, forums, messages
Re: session handling using classes n objects

Posted by no on 12/05/06 11:28

On 5 Dec 2006 02:53:42 -0800, "viz" <vijayjoshi4u@gmail.com> wrote:

>well i am not using database;
>
>and i am also not using session handling functions like
>session_register and session_start Directly.
>i have implemented them using a session class and i am setting and
>retrieving session variables by using object of the session class.
>the problem i am facing is that as long as i use the session class
>object in a single page it is fine but what should i do in order to
>make that object accessible in other pages so that i may check the
>authenticity of user, using functions on the same object.
>hop i m clear this time.

This sounds like circular logic and I'm tempted to ask why you want to
complicate the use of sessions by making a class that you then have to
hold in a normal $_SESSION[] variable?

To make data 'persist' between pages choose one of the following:
1. hold it is a database (but you're not doing that)
2. hold it in cookies (but this can be switched off by the user)
3. hold it in sessions.

For something as simple as holding a userid I'd just create a
$_SESSION['userid'] variable on successful login and refer to it later
in the code by name.

I can understand creating classes for managing complex data structures
(eg. database records etc) but from what you have said so far I don't
think it warrants it in your case. :o)

Chris R.

 

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

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