Created
May 6, 2010 19:07
-
-
Save robhurring/392570 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
// Check for the session[user_id] param to see if the user is logged in | |
if(!isset($_SESSION['user_id'])) | |
header('location:login.php'); | |
echo 'This is my secret page.' | |
// curl http://localhost/insecure.php | |
// => "This is my secret page." | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
// Check for the session[user_id] param to see if the user is logged in | |
if(!isset($_SESSION['user_id'])) | |
{ | |
header('location:login.php'); | |
echo 'Denied.'; | |
exit(); | |
} | |
echo 'This is my secret page.' | |
// curl http://localhost/less_insecure.php.php | |
// => "Denied." | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment