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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.