Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

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


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

Hi!

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!

Greets,

-- JaWi

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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (2)
As of 2024-04-25 19:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found