Advertisement
Guest User

Untitled

a guest
Mar 13th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. <?php
  2. ob_start();
  3.  
  4. session_start();
  5.  
  6. $error = "Could not connect to database";
  7.  
  8. mysql_connect('localhost', 'root', '') or die(mysql_error());
  9. mysql_select_db('forum') or die(mysql_error());
  10.  
  11. require 'forum/includes/functions.php';
  12. if (isset($_POST['login'])) {
  13. $username = addslashes(strip_tags(strtolower($_POST['username'])));
  14. $password = addslashes(strip_tags($_POST['password']));
  15. }
  16.  
  17. if (!$username || !$password) {
  18. echo 'Please enter a username and password';
  19. } else {
  20. $find = mysql_query("SELECT * FROM `phpbb_users` WHERE `username_clean` = '$username'") or die(mysql_error());
  21. if (mysql_num_rows($find) == 0) {
  22. echo 'Username not found';
  23. } else {
  24. while ($find_row = mysql_fetch_assoc($find)) {
  25. $paasword_hash = $find_row['user_password'];
  26. }
  27.  
  28. $check = phpbb_check_hash($password, $password_hash);
  29. }if ($check == FALSE) {
  30. echo 'Incorrect password';
  31. } else
  32. if ($check == TRUE) {
  33. $_SESSION['username'] = $username;
  34. header('Location: main.php');
  35. exit();
  36. }
  37. }
  38. ?>
  39. <form action="login.php" method="">
  40. Username: <br>
  41. <input type="text" name="username"><p/>
  42. Password: <br/>
  43. <input type="password" name="password"/><p/>
  44. <input type="submit" name="login" value="Log in"/>
  45. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement