Jackk

Untitled

May 17th, 2013
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. <?php
  2. include('connect.php');
  3.  
  4. session_start();
  5.  
  6. $username = strip_tags($_POST['username']);
  7. $password = strip_tags($_POST['password']);
  8.  
  9. if ($username&&$password)
  10. {
  11. $query = mysql_query("SELECT * FROM users WHERE username='$username'");
  12.  
  13. $numrows = mysql_num_rows($query);
  14.  
  15. if ($numrows!=0)
  16. {
  17. while ($row = mysql_fetch_assoc($query))
  18. {
  19. $dbusername = $row['username'];
  20. $dbpassword = $row['password'];
  21. }
  22. if ($username==$dbusername&&md5($password)==$dbpassword)
  23. {
  24. $_SESSION['username']=$dbusername;
  25. echo("You have been logged in! Click <a href='index.php'>here</a> too continue..");
  26. }
  27. else
  28. echo "Incorrect password!";
  29. }
  30. else
  31. die("Incorrect username");
  32. }
  33. else
  34. die("Make sure you have entered a username and password! Press Back!");
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment