Jump to content

Isset or !Isset for security?


des1017

Recommended Posts

I'm working on sessions at the moment and was wondering which way would be more secure.

 

Example 1:

 

if ( isset($_SESSION['variable']) ) {

display website inside php

} else {

die

}

 

or

 

Example 2:

 

if ( !isset($_SESSION['variable']) ) {

die ("You must <a href='loginuser.php'>log in</a> to access this page.");

}

 

display website (outside of php)

Link to comment
https://forums.phpfreaks.com/topic/106449-isset-or-isset-for-security/
Share on other sites

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.