Advertisement
Guest User

SimpleGate.php

a guest
Aug 3rd, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.75 KB | None | 0 0
  1. <?php
  2.  
  3. $username = 'YourUsernameHere'; // change this! ~ if you want, you can set it to "guest" if you plan on giving out access
  4. $password = 'YourPasswordHere'; // change this!
  5.  
  6.  
  7. // Hey, I'm Nerdi from HF
  8. // CONTACT: http://hackforums.net/member.php?action=profile&uid=1356131
  9. // SKYPE: ASK IN PM
  10.  
  11.  
  12.         /*
  13.             PLEASE DO NOT EDIT THE SECTION BELOW. IT IS USED TO CREATE A UNIQUE SESSION ID FOR YOU. IT IS RECOMMENDED
  14.             THAT YOU DO NOT USE THIS SCRIPT IN A PUBLIC PLACE... PRIVATE WIFI IS A MUST FOR THIS SCRIPT TO BE SECURE.
  15.             IF YOU USE THIS SCRIPT ON PUBLIC WIFI, YOUR SESSION ID MAY BE HIJACKED, CAUSING UNAUTHORIZED ACCESS TO
  16.             YOUR CONTENT.
  17.         */
  18.  
  19. $you = str_replace('.', 'x', $_SERVER['REMOTE_ADDR']); // this here is to create an IP-specific session ID for you to use
  20. $aCombo = md5($you . $username . $password);
  21.  
  22. if(isset($_GET['session'])){
  23.     $session = $_GET['session'];
  24.     if($session === $aCombo){ // SUCCESS !
  25.        
  26.         /*                                          NERDI'S SIMPLE PASSWORD PROTECTED PAGE TEMPLATE
  27.        
  28.             THE SECTION BELOW GIVES YOU ROOM TO USE WHATEVER HTML CONTENT YOU'D LIKE. THE <HTML>, <HEAD>, AND <BODY> TAGS ARE PROVIDED.
  29.             PLEASE READ THE COMMENTS FOR FURTHER INSTRUCTION. SOME OF THE CODE IS COMMENTED, TO MAKE IT EASIER FOR YOU TO EDIT IT IF YOU'D LIKE!
  30.         */
  31.        
  32.         echo'<html><head>';
  33.        
  34.         // YOU MAY EDIT THIS SECTION BELOW FOR <HEAD> - META TAGS GO HERE
  35.         // DO NOT REMOVE THE ECHO'
  36.         echo'
  37.        
  38.  
  39.        
  40.        
  41.        
  42.        
  43.        
  44.        
  45.        
  46.         '; // DO NOT REMOVE THIS LINE
  47.         // STOP EDITING
  48.        
  49.         echo'</head><body>';
  50.        
  51.         // YOU MAY EDIT THIS SECTION BELOW, FOR MAIN CONTENT / <BODY>
  52.         // DO NOT REMOVE THE ECHO'
  53.         echo'
  54.        
  55.        
  56.        
  57.        
  58.  
  59.        
  60.        
  61.        
  62.        
  63.        
  64.        
  65.        
  66.        
  67.         '; // DO NOT REMOVE THIS LINE,
  68.         // STOP EDITING
  69.    
  70.         echo'</body></html>';
  71.        
  72.     } // close session combo match
  73. } // get session
  74. else { // if session is not set
  75.    
  76.     if(isset($_POST['submit'])){
  77.         $userSub = $_POST['username'];
  78.         $pwSub = $_POST['password'];
  79.         $newSession = md5($you . $userSub . $pwSub);
  80.         if($newSession === $aCombo){ // if our new session qualifies as an admin session
  81.             echo'<meta http-equiv="refresh" content="0; url=index.php?session=' . $newSession . '">';
  82.         } else {
  83.             echo'<h1>That\'s an INVALID LOGIN!</h1>';
  84.         }
  85.     } else {
  86.    
  87.     /*
  88.         IF YOU WANT TO EDIT HOW YOUR LOGIN PAGE LOOKS, EDIT THE FORM BELOW.
  89.         REMOVING USER/PASS WILL CAUSE THIS SCRIPT NOT TO WORK.
  90.     */
  91.    
  92.         echo'<h1>Admin Login</h1>    
  93.         <form action="" method="post">
  94.         <strong>USERNAME</strong><br />
  95.         <input type="text" name="username"/><br /><br />
  96.         <strong>PASSWORD</strong><br />
  97.         <input type="text" name="password"/><br /><br />
  98.         <input type="submit" name="submit" value="Log In"/>
  99.         </form>';
  100.     } // close if POST is set
  101.    
  102. } // close if session is set
  103.  
  104.  
  105. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement