Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.33 KB | None | 0 0
  1. <?
  2.  
  3.     get_config();
  4.  
  5.     $user = $_REQUEST['user'];
  6.     $pass = $_REQUEST['pass'];
  7.  
  8.     if ($user!='' && $pass!='') {       // if user+password were sent
  9.         $realpass = get_pass($user);    // fetch password
  10.  
  11.         if ($pass==$realpass) {
  12.             $info = implode('',@file($conf['base'].$conf['userdir'].'/'.$user.'/info.txt'));    // get contents of info.txt in user's directory
  13.             echo $info;
  14.             exit;
  15.         } else { echo "Invalid user/pass!<br>\n"; }
  16.     }
  17.  
  18.     loginform();
  19.  
  20.     exit;
  21.  
  22.     function get_pass($u) {
  23.         global $conf;
  24.  
  25.         $pwfile = $conf['base'].$conf['userdir'].'/'.$u.'/pw.txt';      // password is in basedir+userdir+pw.txt
  26.         if (!file_exists($pwfile)) { return ''; }
  27.         $pw = implode('',@file($pwfile));
  28.         $pw = trim($pw);
  29.  
  30.         return $pw;
  31.     }
  32.  
  33.     function get_config() {
  34.         global $conf;
  35.  
  36.         $conf = Array();
  37.  
  38.         $rawconf = @file(".htconfig");      // some config vars read from .htconfig
  39.         foreach ($rawconf as $l) {
  40.             $l = trim(ereg_replace("[\n\r\t]+",'',$l));
  41.             list($key, $val) = split(" +", $l, 2);
  42.             if ($key=='' || $val=='') { continue; }
  43.             $conf["$key"] = $val;                       // and put into an array
  44.         }
  45.     }
  46.  
  47.     function loginform() {
  48.         ?>
  49.         <form method="GET" name="loginform" action="index.php">
  50.             User: <input name="user"><br>
  51.             Pass: <input name="pass" type="password"><br>
  52.             <input type="submit" value="Log in"><br>
  53.         </form>
  54.         <?
  55.     }
  56.  
  57. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement