Advertisement
Guest User

SimpleGate.php

a guest
Aug 3rd, 2016
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.54 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.        
  33.        
  34.         // Feel free to start editing anywhere after the echo'
  35.         // DO NOT REMOVE THE ECHO'
  36.         echo'
  37.         <html>
  38.         <head>
  39.        
  40.  
  41.        
  42.        
  43.        
  44.        
  45.        
  46.        
  47.         </head>
  48.         <body>
  49.        
  50.        
  51.        
  52.        
  53.        
  54.        
  55.        
  56.        
  57.        
  58.        
  59.        
  60.         </body>
  61.         </html>
  62.        
  63.         '; // DO NOT REMOVE THIS LINE
  64.        
  65.     } // close session combo match
  66. } // get session
  67. else { // if session is not set
  68.    
  69.     if(isset($_POST['submit'])){
  70.         $userSub = $_POST['username'];
  71.         $pwSub = $_POST['password'];
  72.         $newSession = md5($you . $userSub . $pwSub);
  73.         if($newSession === $aCombo){ // if our new session qualifies as an admin session
  74.             echo'<meta http-equiv="refresh" content="0; url=index.php?session=' . $newSession . '">';
  75.         } else {
  76.             echo'<h1>That\'s an INVALID LOGIN!</h1>';
  77.         }
  78.     } else {
  79.    
  80.     /*
  81.         IF YOU WANT TO EDIT HOW YOUR LOGIN PAGE LOOKS, EDIT THE FORM BELOW.
  82.         REMOVING USER/PASS WILL CAUSE THIS SCRIPT NOT TO WORK.
  83.     */
  84.    
  85.         echo'<h1>Admin Login</h1>    
  86.         <form action="" method="post">
  87.         <strong>USERNAME</strong><br />
  88.         <input type="text" name="username"/><br /><br />
  89.         <strong>PASSWORD</strong><br />
  90.         <input type="text" name="password"/><br /><br />
  91.         <input type="submit" name="submit" value="Log In"/>
  92.         </form>';
  93.     } // close if POST is set
  94.    
  95. } // close if session is set
  96.  
  97.  
  98. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement