Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
This is a somewhat different scenario than merlin's technique as referenced by mikeB above. I have slightly different needs than his column solves.

What I have done is to send a cookie on initial login that is an MD5 encoding of some information. This gives a random-looking number. I enter that cookie with any related information such as username and browser type into a database. You could use mySQL or whatever. I had to use a commercial Win2K database because it already was part of the project.

When I retrieve the cookie I can then look up the cookie value in the database to see if the user is allowed to access the site or some portion thereof (I can also retrieve any other user information from the db such as browser type). My db allows multiple cookies per user so a user can log in from different locations and have a "profile" associated with each. In addition I store an expiry time in the db because user accounts on the system expire after a while. I set the cookie expiry time to just exceed the account expiry time in the database. That way the cookie is not saved longer than the account is good.
--traveler


In reply to Re: User authentication by traveler
in thread User authentication by Siddartha

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2024-04-18 08:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found