Created
December 25, 2013 08:42
-
-
Save anonymous/8121436 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(); | |
$password = "booga"; | |
//sessions | |
if(isset($_SESSION['loggedIn'])) { | |
$loggedIn = true; | |
} else { | |
$loggedIn = false; | |
} | |
//password shit | |
if (isset($_POST['PFormSubmit'])) { | |
if ($_POST['PFormPass'] == $password) { | |
$_SESSION['loggedIn'] = true; | |
$loggedIn = true; | |
} | |
} | |
//if user logged out | |
if (isset($_POST['logoutSubmit'])) { | |
session_unset(); | |
session_destroy(); | |
session_write_close(); | |
$loggedIn = false; | |
} | |
?> | |
<!--This preliminary HTML is always shown:--> | |
<html> | |
<head> | |
<title>TITLE</title> | |
</head> | |
<body> | |
<!--//The above preliminary HTML is always shown | |
The below HTML shows the logout button, if the user is logged in.--> | |
<?php if($loggedIn) { ?> | |
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> | |
<input type="submit" name="logoutSubmit" value="logout" /> | |
</form> | |
<?php } //if logged in ?> | |
<?php if(!$loggedIn) { ?> | |
<!-- This shows the login form if the user is not logged in --> | |
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> | |
<h3>Password</h3> | |
<input type="password" name="PFormPass" /> | |
<input type="submit" name="PFormSubmit" /> | |
</form> | |
<?php } | |
if ($loggedIn) { ?> | |
<!-- THIS IS WHERE YOUR SECRET SHIT GOES --> | |
<!-- THIS IS WHERE YOU SECSRET SHIT ENDS --> | |
<?php } //if logged in ?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment