Advertisement
Guest User

Untitled

a guest
Sep 14th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1. <?php
  2.  
  3. $username = $_POST['username'];
  4. $password = $_POST['password'];
  5.  
  6. if($username&&$password)
  7. {
  8.     $connect = mysql_connect("localhost","root","tbird60") or die("Couldn't Connect!");
  9.     mysql_select_db("work") or die("Cant find Database."); 
  10.     $username = mysql_real_escape_string($username);
  11.     $password = mysql_real_escape_string($password);
  12.     $query = mysql_query("SELECT * FROM users WHERE username ='$username' AND password = '$password'");
  13.     $numrows = mysql_num_rows($query);
  14.    
  15.     if($numrows!=0)
  16.         echo "Welcome back ".$username." <a href='home.php'>Click</a> here to enter the home page.";
  17.     else
  18.             die("Incorrect username / password.");
  19. }
  20. else
  21.     die("Please enter a username and password ");
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement