简体   繁体   中英

Is unsetting $_SESSION variable a bad idea before setting session var?

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?

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM