Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1. <?php
  2. session_start();
  3. $username = $_POST['username'];
  4. $password = $_POST['password'];$myusername = stripslashes($username);$mypassword = stripslashes($password);
  5. if ($myusername&&$mypassword)
  6. {
  7. $connect = mysql_connect("","","") or die("Could not connect...");
  8. mysql_select_db("") or die("Could not connect to the DB"); 
  9. $query = mysql_query("SELECT * FROM names WHERE Username='$myusername'");
  10. $nunrows = mysql_num_rows($query);
  11. if (!$numrows=0)
  12. {
  13.     while ($row = mysql_fetch_assoc($query))
  14.     {
  15.         $dbusername = $row['Username'];
  16.         $dbpassword = $row['Password'];
  17.     }
  18.     if ($myusername==$dbusername&&$mypassword==$dbpassword)
  19.     {
  20.         echo "You have logged in! <a href='member.php'>Click</a> here to view the members page!";
  21.         $_SESSION['username']=$dbusername;
  22.     }
  23.     else
  24.         echo "Incorrect password!";
  25. }
  26. else
  27.     die("Username doesn't exist! Please register on the server!");
  28. }
  29. else
  30.     die("Please enter a Username and a Password");
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement