Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- get_config();
- $user = $_REQUEST['user'];
- $pass = $_REQUEST['pass'];
- if ($user!='' && $pass!='') { // if user+password were sent
- $realpass = get_pass($user); // fetch password
- if ($pass==$realpass) {
- $info = implode('',@file($conf['base'].$conf['userdir'].'/'.$user.'/info.txt')); // get contents of info.txt in user's directory
- echo $info;
- exit;
- } else { echo "Invalid user/pass!<br>\n"; }
- }
- loginform();
- exit;
- function get_pass($u) {
- global $conf;
- $pwfile = $conf['base'].$conf['userdir'].'/'.$u.'/pw.txt'; // password is in basedir+userdir+pw.txt
- if (!file_exists($pwfile)) { return ''; }
- $pw = implode('',@file($pwfile));
- $pw = trim($pw);
- return $pw;
- }
- function get_config() {
- global $conf;
- $conf = Array();
- $rawconf = @file(".htconfig"); // some config vars read from .htconfig
- foreach ($rawconf as $l) {
- $l = trim(ereg_replace("[\n\r\t]+",'',$l));
- list($key, $val) = split(" +", $l, 2);
- if ($key=='' || $val=='') { continue; }
- $conf["$key"] = $val; // and put into an array
- }
- }
- function loginform() {
- ?>
- <form method="GET" name="loginform" action="index.php">
- User: <input name="user"><br>
- Pass: <input name="pass" type="password"><br>
- <input type="submit" value="Log in"><br>
- </form>
- <?
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement