Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $passwords = array("name1" =>"pass1",
- "name2" =>"pass2");
- if ($_POST['submit']) {
- }
- else {
- $username = $_POST['username'];
- $password = $_POST['password'];
- if ($password == $passwords[$username]) {
- setcookie("username", $username, time()+1200);
- echo "<H2>Accesss granted.</H2>";
- }else{
- setcookie("username", "", time()-3600);
- echo "<H2>Invalid user name or password: access denied.</H2>";
- }
- }
- ?>
- <HTML>
- <BODY>
- <FORM METHOD="POST" ACTION="LoginFormAction.php">
- <H2>Login Page</H2>
- <BR><BR>
- User Name:
- <BR><INPUT TYPE="TEXT" NAME="username" SIZE="16">
- <BR><BR>
- Password:
- <BR><INPUT TYPE="PASSWORD" NAME="password" SIZE="16">
- <BR><BR> <BR><BR>
- <INPUT TYPE="SUBMIT" VALUE="Submit">
- </FORM>
- </BODY>
- </HTML>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement