This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to check if session is active or not?  RSS feed

 
Abhishek Asthana
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am making a shopping site. I want that when customer first presses
"Add to Cart" button, then he is shown login page and for every next click his item is added to the cart.
I want to know how can we find that user has already logged in? Also I want that once user has logged in, he is redirected to same page from where he come.
Please tell me how we do this?
Thanks.
Abhishek
 
Geeta Ramasami
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can store a flag in the session after the user logs in.
When the user logs out the flag can be removed from the session.Based on the presence of the flag you would know if the user has already logged in.
If so you can redirect accordingly.
Is this the one you are lokking for.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!