Advertisement
Guest User

Untitled

a guest
Apr 14th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. <?php
  2. session_start();
  3. if (isset($_POST['username'])) {
  4. // Set variables to represent data from database
  5. $dbUsname = "Peter";
  6. $dbPassword = "test5";
  7. $uid = "1111";
  8.  
  9. // Set the posted data from the form into local variables
  10. $usname = strip_tags($_POST['username']);
  11. $paswd = strip_tags($_POST['password']);
  12.  
  13. // Check if the username and the password they entered was correct
  14. if ($usname == $dbUsname && $paswd == $dbPassword) {
  15. // Set session
  16. $_SESSION['username'] = $usname;
  17. $_SESSION['id'] = $uid;
  18. // Now direct to users feed
  19. header("Location: user.php");
  20. } else {
  21. $EchoMe = '<p id="kek">The Username or password was incorrect.<br />Please try again</p>';
  22. }
  23.  
  24. }
  25. ?>0.
  26.  
  27. <!DOCTYPE html>
  28. <html>
  29. <head>
  30. <link rel="stylesheet" type="text/css" href="style.css">
  31. <title>Ministry of Justice Web Portal</title>
  32. <meta charset="UTF-8">
  33. <title>Basic login system</title>
  34. </head>
  35. <body>
  36. <div id="nav">
  37. </div>
  38. <img id="logo"src="Images/logo.png" alt="Justice Department Logo" width="320" height="213" opacity:0.4;>
  39. <div id="news">
  40. <? echo $EchoMe; ?>
  41. <h1>Updates on cases</h1>
  42. <hr>
  43. <p>Recently Cooldude215 came out as gay, good on yer' lad!</p>
  44. <hr>
  45. </div>
  46. <form id="form" action="index.php" method="post" enctype="multipart/form-data">
  47. Username: <input type="text" name="username" /> <br />
  48. Password: <input type="password" name="password" /> <br /><br />
  49. <input type="submit" value="Login" name="Submit" />
  50.  
  51. </form>
  52. </body>
  53. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement