Guest User

Untitled

a guest
Jun 24th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.94 KB | None | 0 0
  1. <?php
  2.  
  3. mysql_connect("localhost","root","")
  4. or DIE('Connection to host is failed, perhaps the service is down!');
  5. mysql_select_db("online_manager") or DIE('Database name is not available!');
  6.  
  7. if(isset ($_POST["username"]) )
  8. {
  9. $user = $_POST["username"];
  10. }
  11.  
  12. if(isset ( $_POST["userpass"] ) )
  13. {
  14. $pass = $_POST["userpass"];
  15. }
  16. //echo "$pass";
  17.  
  18. //you used == instead of = in your query
  19. $usertest = mysql_query("select * from user_information where username = '$user' && password = '$pass' ");
  20.  
  21. $user= mysql_num_rows($usertest);
  22. //echo "$user";
  23. if($user>0)
  24. {
  25. //echo "$usertest";
  26. //$query = mysql_query("select * from user_information where username = '$user' and password ='$pass'");
  27.  
  28. echo "$query";
  29. while($row = mysql_fetch_array($usertest))
  30. {
  31.  
  32. echo $row['name'];
  33. echo $row['email'];
  34. echo $row['address'];
  35.  
  36. }
  37.  
  38. }
  39. else {
  40.  
  41. echo "Invalid Username or Password<br>Try again with correct one!";
  42. include_once("index.html");
  43.  
  44. }
  45. ?>
Add Comment
Please, Sign In to add comment