Guest User

Untitled

a guest
May 13th, 2018
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.35 KB | None | 0 0
  1. <?
  2. //Get information from URL
  3. $u = $_GET['username'];
  4. $pass = $_GET['password'];
  5. $u = mysql_real_escape_string($username);
  6. $u = stripslashes($username);
  7. //Database info
  8. $host="localhost";
  9. $username="username_here"; //Change this to your username for db
  10. $password="password_here"; //Change this to your password for db
  11. $db_name="db_name"; //Change this to your db name
  12. //Connect
  13. $duh = mysql_connect("$host", "$username", "$password")or die("Error 1");
  14. //Select
  15. mysql_select_db("$db_name")or die("Error2");
  16.  
  17. $find = mysql_query("SELECT * FROM users WHERE username='$u'");
  18. while($row = mysql_fetch_array($find))
  19. {
  20.         $username=$row['username'];
  21.         $passcheck = $row['password'];
  22.         $ban = $row['ban'];
  23.  
  24. }
  25. if(mysql_num_rows($find) < 1 || $pass != $passcheck)
  26. {
  27.         echo('<div style="text-align:center; color:red">Login Failed</div>');
  28. }
  29. if($pass == '')
  30. {
  31.         echo('<div style="text-align:center; color:red">You must enter a password.</div>');
  32. }
  33. if($username == '')
  34. {
  35.         echo('<div style="text-align:center; color:red">You must enter all details.</div>');
  36. }
  37. if($pass == $passcheck)
  38. {
  39.     if($ban == 0 || $ban == '0'){
  40.         echo('<div style="text-align:center; color:green">Thank you for logging in!</div>');
  41.     }
  42.     if($ban == 1 || $ban == '1'){
  43.         echo('<div style="text-align:center; color:red">Your account is banned.</div>');
  44.     }  
  45. }
  46. mysql_close($duh)
  47. ?>
Add Comment
Please, Sign In to add comment