Jump to content

Cookies or sessions for authentication monitoring?


Dan06

Recommended Posts

I have a multi-part question:

 

1. Once the user has entered his/her user name and password, and those have been verified, is it better to use cookies or sessions?

 

2. What type of information for authentication monitoring should be stored in the cookie or session, i.e. id, password, etc.?

 

3. How would I go about creating the proper cookie/session via javascript to use in AJAX? - code examples, would be great.

 

Thanks.

 

Insight appreciated. Thanks.

I decided to use sessions. Once the user name and password are verified, I chose to create two session variables: user name and session id. Anytime an event occurs, i.e. clicking a button, refresh, etc. I set my javascript code to call a php function to verify if the two session variables are set. If they are set then the process can continue otherwise, the process ends and returns to the login page.

 

Is this the best way to go or is there a better way? Thoughts, suggestions appreciated. Thanks.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.