SHARE
TWEET

Untitled

a guest Oct 23rd, 2017 482 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function login(){
  3.  
  4.  
  5. $username = $_REQUEST['username'];
  6. $password = $_REQUEST['password'];
  7.  
  8.  
  9.  
  10. $connect = mysql_connect("host", "username", "password");
  11. if(!$connect){
  12. die(mysql_error());
  13. }
  14.  
  15.  
  16. $select_db = mysql_select_db("database", $connect);
  17. if(!$select_db){
  18. die(mysql_error());
  19. }
  20.  
  21.  
  22.  
  23. $result = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'");
  24. $row = mysql_fetch_array($result);
  25. $id = $row['id'];
  26.  
  27. $select_user = mysql_query("SELECT * FROM users WHERE id='$id'");
  28. $row2 = mysql_fetch_array($select_user);
  29. $user = $row2['username'];
  30.  
  31. if($username != $user){
  32. die("Username is wrong!");
  33. }
  34.  
  35.  
  36. $pass_check = mysql_query("SELECT * FROM users WHERE username='$username' AND id='$id'");
  37. $row3 = mysql_fetch_array($pass_check);
  38. $email = $row3['email'];
  39. $select_pass = mysql_query("SELECT * FROM users WHERE username='$username' AND id='$id' AND email='$email'");
  40. $row4 = mysql_fetch_array($select_pass);
  41. $real_password = $row4['password'];
  42.  
  43. if($password != $real_password){
  44. die("Your password is wrong!");
  45. }
  46.  
  47.  
  48.  
  49.  
  50.  
  51. session_register("username", $username);
  52. session_register("password", $password);
  53.  
  54. echo "Welcome, ".$username." please continue on our <a href=index.php>Index</a>";
  55.  
  56.  
  57.  
  58.  
  59. }
  60.  
  61. switch($act){
  62.  
  63. default;
  64. index();
  65. break;
  66.  
  67. case "login";
  68. login();
  69. break;
  70.  
  71. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top