Advertisement
Guest User

Untitled

a guest
May 29th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.44 KB | None | 0 0
  1. <?php
  2. ob_start();
  3. session_start();
  4. ?>
  5.  
  6. <?
  7. // error_reporting(E_ALL);
  8. // ini_set("display_errors", 1);
  9. ?>
  10.  
  11. <html lang = "en">
  12.  
  13. <head>
  14. <title>Login</title>
  15. <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
  16. <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
  17.  
  18. <style>
  19. body {
  20. padding-top: 40px;
  21. padding-bottom: 40px;
  22. background-color: #ADABAB;
  23. }
  24.  
  25. .form-signin {
  26. max-width: 330px;
  27. padding: 15px;
  28. margin: 0 auto;
  29. color: #017572;
  30. }
  31.  
  32. .form-signin .form-signin-heading,
  33. .form-signin .checkbox {
  34. margin-bottom: 10px;
  35. }
  36.  
  37. .form-signin .checkbox {
  38. font-weight: normal;
  39. }
  40.  
  41. .form-signin .form-control {
  42. position: relative;
  43. height: auto;
  44. -webkit-box-sizing: border-box;
  45. -moz-box-sizing: border-box;
  46. box-sizing: border-box;
  47. padding: 10px;
  48. font-size: 16px;
  49. }
  50.  
  51. .form-signin .form-control:focus {
  52. z-index: 2;
  53. }
  54.  
  55. .form-signin input[type="email"] {
  56. margin-bottom: -1px;
  57. border-bottom-right-radius: 0;
  58. border-bottom-left-radius: 0;
  59. border-color:#017572;
  60. }
  61.  
  62. .form-signin input[type="password"] {
  63. margin-bottom: 10px;
  64. border-top-left-radius: 0;
  65. border-top-right-radius: 0;
  66. border-color:#017572;
  67. }
  68.  
  69. h2{
  70. text-align: center;
  71. color: #017572;
  72. }
  73. </style>
  74.  
  75. </head>
  76.  
  77. <body>
  78.  
  79. <h2>Enter Username and Password</h2>
  80. <div class = "container form-signin">
  81.  
  82. <?php
  83. $msg = '';
  84.  
  85. if (isset($_POST['login']) && !empty($_POST['username'])
  86. && !empty($_POST['password'])) {
  87.  
  88. if ($_POST['username'] == 'tom' &&
  89. $_POST['password'] == '1234') {
  90. $_SESSION['valid'] = true;
  91. $_SESSION['timeout'] = time();
  92. $_SESSION['username'] = 'tom';
  93.  
  94. header("location: dvd.php");
  95. }else {
  96. $msg = 'Wrong username or password';
  97. }
  98. }
  99. ?>
  100. </div> <!-- /container -->
  101.  
  102. <div class = "container">
  103.  
  104. <form class = "form-signin" role = "form"
  105. action = "<?php echo htmlspecialchars($_SERVER['PHP_SELF']);
  106. ?>" method = "post">
  107. <h4 class = "form-signin-heading"><?php echo $msg; ?></h4>
  108. <input type = "text" class = "form-control"
  109. name = "username" placeholder = "username = tom"
  110. required autofocus></br>
  111. <input type = "password" class = "form-control"
  112. name = "password" placeholder = "password = 1234" required>
  113. <button class = "btn btn-lg btn-primary btn-block" type = "submit"
  114. name = "login">Login</button>
  115. </form>
  116.  
  117.  
  118. </div>
  119.  
  120. </body>
  121. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement