SHARE
TWEET

Untitled

a guest May 22nd, 2017 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. //login.php
  3.  
  4. require_once 'functions.php';
  5. $error = $user = $pass = "";
  6.  
  7. if (isset($_POST['user'])){
  8.     $user = sanitizeString($_POST['user']);
  9.     $pass = sanitizeString(md5($_POST['pass']));
  10.  
  11.     if ($user == "" || $pass == ""){
  12.         $error = "Not all fields were entered<br />";
  13.     }
  14.     else{
  15.         $query = "SELECT user,pass,admin,allowed FROM members
  16.                 WHERE user='$user' AND pass='$pass' AND allowed='true'";
  17.  
  18.         if (mysql_num_rows($result=queryMysql($query)) == 0){
  19.             $error = "Username / Password invalid<br />";
  20.         }
  21.         else{
  22.             $_SESSION['user'] = $user;
  23.             $row = mysql_fetch_assoc($result);
  24.             $_SESSION['is_admin'] = $row['admin'];
  25.             redirect_to("index.php");
  26.         }
  27.     }
  28. }
  29. require_once 'header.php';
  30. echo <<<_END
  31. <form method='post' action='login.php'>$error
  32. <table id="logintable">
  33. <tr><td>Username</td><td><input type='test' maxlength='16' name='user' value='$user' /></td></tr>
  34. <tr><td>Password</td><td><input type='password' maxlength='16' name='pass' value='' /></td></tr>
  35. <tr><td></td><td><input class="submitbutton" type='submit' value='Login &raquo;' /></td></tr>
  36. </table>
  37. </form>
  38. _END;
  39. ?>
  40. <?php require_once 'footer.php';?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top