Guest User

Untitled

a guest
May 1st, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. if(isset($_POST["user"]) && isset($_POST["pass"]))
  2. {
  3. $message = "Login incorrect.";
  4.  
  5. $connection = mysql_connect("localhost","root","");
  6.  
  7. $user = $_POST["user"];
  8. $pass = $_POST["pass"];
  9.  
  10. mysql_select_db("mystnews", $connection);
  11.  
  12. $result = mysql_query("SELECT * FROM members WHERE user='$user'");
  13.  
  14. if($row = mysql_fetch_array($result))
  15. {
  16. if($row["pass"] == $pass)
  17. {
  18. header("Set-Cookie: username=$user; httpOnly");
  19. $message = "Successfully logged in as $user, you will be redirected automatically.";
  20. }
  21. }
  22. }
Add Comment
Please, Sign In to add comment