Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if (isset($_POST['username'])) {
- // Set variables to represent data from database
- $dbUsname = "Peter";
- $dbPassword = "test5";
- $uid = "1111";
- // Set the posted data from the form into local variables
- $usname = strip_tags($_POST['username']);
- $paswd = strip_tags($_POST['password']);
- // Check if the username and the password they entered was correct
- if ($usname == $dbUsname && $paswd == $dbPassword) {
- // Set session
- $_SESSION['username'] = $usname;
- $_SESSION['id'] = $uid;
- // Now direct to users feed
- header("Location: user.php");
- } else {
- $EchoMe = '<p id="kek">The Username or password was incorrect.<br />Please try again</p>';
- }
- }
- ?>0.
- <!DOCTYPE html>
- <html>
- <head>
- <link rel="stylesheet" type="text/css" href="style.css">
- <title>Ministry of Justice Web Portal</title>
- <meta charset="UTF-8">
- <title>Basic login system</title>
- </head>
- <body>
- <div id="nav">
- </div>
- <img id="logo"src="Images/logo.png" alt="Justice Department Logo" width="320" height="213" opacity:0.4;>
- <div id="news">
- <? echo $EchoMe; ?>
- <h1>Updates on cases</h1>
- <hr>
- <p>Recently Cooldude215 came out as gay, good on yer' lad!</p>
- <hr>
- </div>
- <form id="form" action="index.php" method="post" enctype="multipart/form-data">
- Username: <input type="text" name="username" /> <br />
- Password: <input type="password" name="password" /> <br /><br />
- <input type="submit" value="Login" name="Submit" />
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement