Reputation: 55
In a page I'm designing, I'm storing data via $_session but since I'm calling the pages dynamically with jquery I wanted to add some security and unset($_SESSION['var']) before i set them just in case anything would happen. My question is if unsetting session a bad idea before it is set, or is it completely valid?
Upvotes: 3
Views: 81
Reputation: 449613
It's unnecessary and will have no effect.
If you are calling sensitive data through Ajax calls, you need to properly secure it against attacks, just as you would secure a normal page - for example by having a session-based login, and checking whether the current user is logged in!
Upvotes: 4