daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest May 30th, 2017 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. ob_start();
  3. ?>
  4. <html>
  5. <body>
  6. <?php
  7. require_once("config.php");
  8. if(!isset($_SESSION['ID'])){
  9.     echo('<form action="logintest.php" method="post">');
  10.     echo('Username:<input type="text" name="user" /><br />');
  11.     echo('Password:<input type="password" name="pass" /><br />');
  12.     echo('<input type="Submit" value="Login" /></form><br />');
  13. }
  14. $user = mysql_real_escape_string($_POST["user"]); // Just the simplest of *many* filters.
  15. $pass = $_POST["pass"]; // Make DataBase correspond, means you don't need any filtering, either.
  16. $result = mysql_query("SELECT Password FROM login WHERE Username = '$user'") or die('No such user');
  17. $row = mysql_fetch_assoc($result);
  18. var_dump($row);
  19. $passtest = $row["Password"];
  20. if($pass==$passtest){
  21.         $query = mysql_query("SELECT * FROM login WHERE Username = '$user'") or die(mysql_error);
  22.         $row = mysql_fetch_assoc($query);
  23.         $status = $row["Status"];
  24.         var_dump($row);
  25.         if(isset($status) && $status==5){
  26.             $_SESSION['ID']=1;
  27.             header("Location:admin.php");
  28.         }else if(isset($status) && $status==0){
  29.             $_SESSION['ID']=0;
  30.             header("Location:shits.php");
  31.         }
  32. }
  33. else
  34. {
  35.     echo("Wrong Password/Username <br />");
  36. }
  37. mysql_close($con); // This should go in a config, too.
  38. ob_flush();
  39. ?>
  40. </body>
  41. </html>
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