Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- </head>
- <body>
- <h1>Please Log In</h1>
- <p>This page is secret.</p>
- <form method="post" action="index.php">
- <p>Username: <input type = "text" name="name" </p>
- <p>Password: <input type="password" name="password"</p>
- <p><input type="submit" name="submit" value="Log In"></p>
- </form>
- <?php
- if ((!isset($_POST['name'])) || (!isset($_POST['password']))){
- echo "Both values must be set";
- }
- else{
- $name = $_POST['name'];
- $password = $_POST['password'];
- //Visitor needs to enter a name or password
- if(($name=="user") && ($password=="pass")){
- //visitor's name and password combination are correct
- echo "<h1>Here it is! </h1>"
- }
- else{
- //visitor's name and password are incorrect
- echo "<h1>Go Away</h1>
- <p>You are not austhorized to use this resource.</p>";
- }
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement