Guest User

Untitled

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