Advertisement
Guest User

Untitled

a guest
May 26th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. <?php
  2.  
  3. [Censored mysql data]
  4.  
  5.  
  6. mysql_connect($mysql_host, $mysql_user, $mysql_password) or die ("Could not connect to mysql because ".mysql_error());
  7.  
  8.  
  9. mysql_select_db($mysql_database) or die ("Could not select database because ".mysql_error());
  10.  
  11. $match = "select * from Users where username = '".$_POST['username']."' and password = '".$_POST['password']."';";
  12.  
  13. $qry = mysql_query($match) or die ("Could not match data because ".mysql_error());
  14. $num_rows = mysql_num_rows($qry);
  15.  
  16. if ($num_rows == 1) {
  17.  
  18. $username = $_POST['username']
  19. setcookie("loggedin", "TRUE", time()+(3600 * 24));
  20. setcookie("mysite_username", "$username");
  21. Header("Location: User.php");
  22.  
  23. }
  24.  
  25. else
  26. {
  27.  
  28. Header("Location: loginform.php");
  29. }
  30.  
  31.  
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement