Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4.  
  5. $username = $_POST['username'];
  6. $username = $_POST['password'];
  7.  
  8. if ($username&&$password)
  9.  
  10. {
  11.  
  12. $connect = mysql_conncet("localhost","root","") or die ("Couldn't connect!");
  13. mysql_select_db ("login") or die ("couldn't find db");
  14.  
  15. $query = mysql_query("SELECT * FROM users WHERE username='$username'");
  16.  
  17.  
  18. $numrows = mysql_num_rows($query);
  19.  
  20. if ($numrows!=0)
  21. {
  22.     while ($row =mysql_fetch_assoc($query))
  23.     {
  24.         $dbusername = $row ['username'];
  25.         $dbpassword = $row ['password'];
  26.     }
  27.    
  28.     //check to see if they match!
  29.     if ($username==$dbusername&&$password==$dbpassword)
  30.     {
  31.         echo "You're in!<a href='member.php'>Click</a> here to enter the memberpage";
  32.         $_SESSION['username']=$username;
  33.          
  34.        
  35.     }
  36.     else
  37.         echo "Incorrect password!";
  38. }
  39. else
  40.     die ("That user doesen't exsist!");
  41.    
  42. }
  43. else
  44.     die("Please enter username and a password!");
  45.    
  46.    
  47.    
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement