Advertisement
Guest User

Untitled

a guest
Dec 16th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. <?php
  2.  
  3. echo "<html><body>".
  4. if ($_POST[]) {
  5. require 'mysql.php';
  6.  
  7. $query = "SELECT * FROM `user` WHERE username='$_POST['username']' and password='$_POST['password']'";
  8. $result = mysqli_query($connection, $query) or die(mysqli_error($connection));
  9. $count = mysqli_num_rows($result);
  10.  
  11. if ($count != 0) {
  12. echo "You are logged in as " . $_POST['username'];
  13. <br><br><a href='$_SERVER['PHP_SELF']'>Logout</a>
  14. }
  15. else {
  16. echo 'Invalid username or password.';
  17. }
  18. }
  19. ."</body></html>";
  20.  
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement