Advertisement
Guest User

Untitled

a guest
Jul 29th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4.  
  5. $username = $_POST['username'];
  6. $password = $_POST['password'];
  7.  
  8. if ($username&&$password)
  9. {
  10. $connect = mysql_connect("localhost","erik","eriper56") or die("Error connection db");
  11. mysql_select_db("exann") or die("Error selecting db");
  12.  
  13. $query = mysql_query("SELECT * FROM login WHERE username='$username'");
  14.  
  15. $numrows = mysql_num_rows($query);
  16.  
  17. if ($numrows!=0)
  18. {
  19. while ($row = mysql_fetch_assoc($query))
  20. {
  21. $dbusername = $row['username'];
  22. $dbpassword = $row['password'];
  23. }
  24.  
  25. if ($username==$dbusername&&md5($password)==$dbpassword)
  26. {
  27. $_SESSION['username']=$username;
  28. echo "You'r in! <meta http-equiv='refresh' content='2; url=member.php'>";
  29. }
  30. else
  31. echo "Something gut wrong!<meta http-equiv='refresh' content='2; url=index.html'>";
  32.  
  33. }
  34. else
  35. die("That user dosen't exist!<meta http-equiv='refresh' content='2; url=index.html'>");
  36.  
  37. }
  38. else
  39. die("Please enter a username and a password!<meta http-equiv='refresh' content='2; url=index.html'>");
  40.  
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement