Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. <!-- Codexual @ NuLLocK.com -->
  2.  
  3. <html>
  4. <body>
  5. <?php
  6. if(isset($_POST['login']))
  7. {
  8. $username = $_POST['username'];
  9. $password = $_POST['password'];
  10. $con = mysqli_connect('localhost','root','your_mysql_password','sample');
  11. $result = mysqli_query($con, "SELECT * FROM `users` WHERE username='$username' AND password='$password'");
  12. if(mysqli_num_rows($result) == 0)
  13. echo 'Invalid username or password';
  14. else
  15. echo '<h1>Logged in</h1><p>This is text that should only be displayed when logged in with valid credentials.</p>';
  16. }
  17. else
  18. {
  19. ?>
  20. <form action="" method="post">
  21. Username: <input type="text" name="username"/><br />
  22. Password: <input type="password" name="password"/><br />
  23. <input type="submit" name="login" value="Login"/>
  24. </form>
  25. <?php
  26. }
  27. ?>
  28. </body>
  29. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement