Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <?php
- session_start();
- $username = "admin";
- $password = "collins1";
- if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
- header("Location: home.php");
- }
- if (isset($_POST['username']) && isset($_POST['password'])){
- if ($_POST['username'] == $username && $_POST['password'] == $password)
- {
- $_SESSION['loggedin'] = true;
- header("Location: home.php");
- }
- }
- else {
- echo "Username or Password incorrect please try again";
- }
- ?>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>Login</title>
- <link href="../CSS/boilerplate.css" rel="stylesheet" type="text/css">
- <link href="../CSS/master.css" rel="stylesheet" type="text/css">
- <script src="../JAVASCRIPT/respond.min.js"></script>
- </head>
- <body link="black">
- <div class="gridContainer clearfix">
- <div id="borderDiv">
- <div id="headerDiv">
- <p>Welcome</p>
- </div>
- <div id="subHeaderDiv">
- <p>Please login to continue</p>
- </div>
- <form method="post" action="index.php">
- <div id="userNameLoginDiv">
- <p>Username:</p>
- <input type="text" name="username" size="12">
- </div>
- <div id="userPasswordLoginDiv">
- <p>Password:</p>
- <input type="password" name="password" size="12">
- </div>
- <div id="loginBtnDiv">
- <input id="button" type="submit" value="Login">
- </div>
- </form>
- </div>
- </div>
- </body>
- </html>
- <!DOCTYPE html>
- <?php
- session_start();
- if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] == false) {
- header("Location: index.php");
- }
- if (isset($_GET['logout'])){
- session_destroy();
- }
- ?>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Home</title>
- <link href="../CSS/boilerplate.css" rel="stylesheet" type="text/css">
- <link href="../CSS/master.css" rel="stylesheet" type="text/css">
- <script src="../JAVASCRIPT/respond.min.js"></script>
- </head>
- <body link="black">
- <div class="gridContainer clearfix">
- <div id="headerDiv">
- <p>Home</p>
- </div>
- <a href="index.php?logout">Logout</a>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement