none
Singleton or Session

    Question

  • Hello all,

    When a user logins in my system I create a session with all his info such as firstname, lastname, photo, age, classroom, etc

    So I heard something about Singleton where I can instance a class and I was wondering if after logged in, I could fill this class out with all his info and dont use sessions anymore.

    So I would go to the database after login, bring its info and keep this only instance class up for all the pages.

    Would it work ?

    Wednesday, August 27, 2014 9:02 PM

All replies

  • Don't use variables in singleton class to store login information, or you'll find all users will be using your website with the credential of latest logged-in user.

    Btw, what's the reason you want to get rid of Session?

    Thursday, August 28, 2014 3:53 AM