Guest User

Untitled

a guest
Nov 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. $n=$_POST['n'];
  2. $password=$_POST['password'];
  3.  
  4. echo "".$n;
  5. echo "".$password;
  6. $servername ="localhost";
  7. $username = "photographer";
  8. $pass = "photopassword";
  9. $dbname = "photographer";
  10.  
  11.  
  12.  
  13. // Create connection
  14. $conn = mysqli_connect($servername, $username, $pass, $dbname);
  15. // Check connection
  16. if (!$conn)
  17. {
  18. die("Connection failed: " . mysqli_connect_error());
  19. }
  20. $sql = "SELECT name,password FROM login where name like '". $n . "' and password like '" . $password."'";
  21. $result = mysqli_query($conn, $sql);
  22. if (mysqli_num_rows($result) > 0)
  23. {
  24. echo "<script type='text/javascript'>alert('Success !')</script>";
  25. header('Location:http://localhost/wordpress/sample-page/');
  26.  
  27. }
  28. else if (mysqli_num_rows($result) == 0)
  29. {
  30. echo "<script type='text/javascript'>alert('Wrong User name and Password!')</script>";
  31. }
  32.  
  33. mysqli_close($conn);
Add Comment
Please, Sign In to add comment