Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: How to remember who is logged in...

by JaWi (Hermit)
on Sep 03, 2002 at 15:28 UTC ( #194794=note: print w/replies, xml ) Need Help??

in reply to How to remember who is logged in...


Indeed there are many ways you can solve this problem. One of the approaches I used for a site was the following.

  • Let the user login through a nice form.
  • Check in the database wheter the given username/password combo is correct.
  • If correct, I created a session which holds the flag denoting the user is logged in
  • Send a cookie with the username.

Each time the user returns to your site, you check wheter he still has the cookie. If so, you're (fairly) certain the user has come back and continues browsing your site.

Logging out can be done by resetting/deleting the cookie (after the user has pressed a `logout' link or automatically after a preset time).

Of course this is a very simple approach of remembering users (and might not be sufficient in some cases), but I hope it gives you an idea!


-- JaWi

  • Comment on Re: How to remember who is logged in...

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://194794]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2022-10-04 16:18 GMT
Find Nodes?
    Voting Booth?
    My preferred way to holiday/vacation is:

    Results (18 votes). Check out past polls.