Advertisement
otnay

login.php

Aug 4th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. <?php
  2. session_start();
  3. $username = 'eotnay';
  4. $password = 'otnay@321';
  5. if (isset($_POST['masuk'])) {
  6. if (!ctype_alnum($_POST['username']) OR !ctype_alnum($_POST['password'])){
  7. display_login_form();
  8. echo "<script>
  9. alert('KONTOL LU');
  10. window.location='menu.php';
  11. </script>";
  12. }
  13. elseif ($_POST['username'] == $username && $_POST['password'] == $password){
  14. //Membuat Session
  15. $_SESSION["username"] = $username;
  16. echo "Anda Berhasil Login $username";
  17. header("Location: menu.php");
  18. } else {
  19. // Tampilkan Pesan Error
  20. display_login_form();
  21. echo "<script>alert('username Atau Password Tidak Benar')</script>";
  22. }
  23. }
  24. else {
  25. display_login_form();
  26. }
  27. function display_login_form(){ ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement