Advertisement
Guest User

Untitled

a guest
May 20th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.82 KB | None | 0 0
  1. <?php
  2. $passwords = array("name1"   =>"pass1",
  3.                    "name2"   =>"pass2");
  4.  
  5. if ($_POST['submit']) {
  6.  
  7. }
  8.  
  9. else {
  10.     $username = $_POST['username'];
  11.     $password = $_POST['password'];
  12.                    
  13.    if ($password == $passwords[$username]) {
  14.        setcookie("username", $username, time()+1200);
  15.        echo "<H2>Accesss granted.</H2>";
  16.  
  17.    }else{
  18.        setcookie("username", "", time()-3600);
  19.        echo "<H2>Invalid user name or password: access denied.</H2>";
  20.    }
  21.  
  22. }
  23. ?>
  24.  
  25. <HTML>
  26. <BODY>
  27. <FORM METHOD="POST" ACTION="LoginFormAction.php">
  28. <H2>Login Page</H2>
  29. <BR><BR>
  30. User Name:
  31. <BR><INPUT TYPE="TEXT" NAME="username" SIZE="16">
  32. <BR><BR>
  33. Password:
  34. <BR><INPUT TYPE="PASSWORD" NAME="password" SIZE="16">
  35. <BR><BR> <BR><BR>
  36. <INPUT TYPE="SUBMIT" VALUE="Submit">
  37. </FORM>
  38. </BODY>
  39. </HTML>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement