Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML>
- <?php
- session_start();
- $username = "user";
- $password = "pass";
- if (isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] == true){
- header("Location: success.php");
- }
- if (isset($_POST['username']) && isset($_POST['password'])){
- if($_POST['username'] == $username && $_POST['password'] == $password){
- $_SESSION['loggedIn'] = true;
- header("Location: success.php");
- }
- }
- ?>
- <html>
- <body>
- <form method="post" action="log-in.php">
- Username:<br/>
- <input type="text" name="username"><br/>
- Password<br/>
- <input type="password" name="password"><br/>
- <input type="submit" value="Login!">
- </form>
- </body>
- </html>
- <!DOCTYPE HTML>
- <?php
- session_start();
- if(!isset($_SESSION['loggedIn']) || $_SESSION['loggedIn'] == false){
- header("Location: index.html")
- }
- ?>
- <html>
- <h>You have logged in!</h>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement