Advertisement
Guest User

Untitled

a guest
Jun 27th, 2018
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.20 KB | None | 0 0
  1. <html>
  2. <head>
  3. <style>
  4. #user
  5. {
  6.  
  7.  
  8.  
  9. color:blue;
  10. font-size:16px;
  11. }
  12. #pass
  13. {
  14.  
  15. color:blue;
  16. font-size:16px;
  17. }
  18.  
  19. </style>
  20. </head>
  21. <body>
  22. <table>
  23. <form action="quizpage2.php" method="post">
  24. <tr>
  25. <td><div id="user">Username:</div></td></br>
  26. <td><input type="text" name="user"></td>
  27. </tr>
  28.  
  29. <tr>
  30. <td><div id="pass">Password:</div></td>
  31. <td><input type="text" name="pass"></td>
  32. </tr>
  33.  
  34. <tr>
  35. <td><input type="submit" value="submit"></td>
  36. </tr>
  37.  
  38. </form>
  39. </table>
  40. </body>
  41. </html>
  42.  
  43. page2
  44.  
  45. session_start();
  46.  
  47. $AB=$_POST["user"];
  48.  
  49. $CD=$_POST["pass"];
  50.  
  51.  
  52. $_SESSION["new"]=$AB;
  53.  
  54.  
  55. $EF=array("paul", "andrew", "steven" ,"don");
  56.  
  57. $GH=array(123, 456, 789, 000);
  58.  
  59. if(($AB==$EF[0])&&($CD==$GH[0]))
  60. {
  61.  
  62. $_SESSION["new"]=$EF[0];
  63. $_SESSION["start"]=time();
  64. $_SESSION["expire"]=$_SESSION["start"]+(1*60);
  65.  
  66. echo "<script> alert('login successfull')</script>";
  67. echo "<script>window.location.assign('quizpage3.php')</script>";
  68. }
  69. ?>
  70.  
  71.  
  72.  
  73.  
  74.  
  75. page3-
  76.  
  77. <?php
  78.  
  79.  
  80.  
  81. session_start();
  82.  
  83.  
  84.  
  85. if(!isset($_SESSION["new"]))
  86. {
  87. echo"<p align='center';>Please login Again";
  88. echo"<a href='quizpage1.php'>Click here</a></p>";
  89. //header("location:quizpage1.php");
  90. }
  91.  
  92. else
  93. {
  94. $now=time();
  95.  
  96. if($now>$_SESSION['expire'])
  97. {
  98. session_destroy();
  99. echo"<p align='centre;'>your session is expired!<a href='quizpage1.php'>Login Here</a></p>";
  100. echo"<span style='float:right;'><a href='logoutpage.php'>Logout</a></span>";
  101. }
  102.  
  103.  
  104. else
  105. {
  106.  
  107. echo"<html>";
  108. echo"<head>";
  109. echo"<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js'></script>";
  110. echo"<script>
  111.  
  112. $(document).ready(function() {
  113. window.history.forward(1);
  114. });
  115.  
  116. </script>";
  117.  
  118.  
  119. echo"<style>
  120. #sun
  121. {
  122. background-color:lightblue;
  123. width:60%;
  124. }
  125.  
  126. </style>";
  127.  
  128.  
  129. echo"</head>";
  130. echo"<body>";
  131.  
  132. echo"<form action='quizpage4.php' method='post'>";
  133.  
  134. echo"<div id='sun'>";
  135. echo"<tr>";
  136. echo"<td>Which of the following part of the Sun is visible by human?</td></br>";
  137. echo"<td><input type='radio' name='sun' value='Photosphere'>Photosphere</td>.</br>";
  138. echo"<td><input type='radio' name='sun' value='Corona'>Corona</td>.</br>";
  139. echo"<td><input type='radio' name='sun' value='Chromosphere'>Chromosphere</td>.</br>";
  140. echo"<td><input type='radio' name='sun' value='Core'>Core</td>.</br>";
  141. echo"</tr>";
  142.  
  143. echo"<tr>";
  144.  
  145. echo"<td><input type='submit' value='Nextpage'></td>";
  146.  
  147. echo"</tr>";
  148. echo"</div>";
  149. echo"</form>";
  150.  
  151. echo"</table>";
  152. echo"</body>";
  153. echo"</html>";
  154.  
  155. }
  156.  
  157. }
  158.  
  159.  
  160. ?>
  161.  
  162.  
  163.  
  164.  
  165. enter code here
  166.  
  167. Logoutpage-
  168.  
  169. <?php
  170. session_start();
  171. session_destroy();
  172. header("location:quizpage1.php");
  173. ?>de here
  174.  
  175. $now=time();
  176.  
  177. if($now>$_SESSION['expire'])
  178. {
  179. session_destroy();
  180. echo"<p align='centre;'>your session is expired!<a href='quizpage1.php'>Login Here</a></p>";
  181. echo"<span style='float:right;'><a href='logoutpage.php'>Logout</a></span>";
  182. }
  183.  
  184. echo"<form action='quizpage4.php' method='post'>";
  185.  
  186. echo"<td><input type='submit' value='Nextpage' name='submit'></td>";
  187.  
  188. if(isset($_POST['submit']) && !empty($_POST['submit']))
  189. {
  190. echo "<script>window.location.assign('page4.php')</script>";
  191. }
  192.  
  193. $now=time();
  194.  
  195. if($now>$_SESSION['expire'])
  196. {
  197. //echo 1;exit;
  198. session_destroy();
  199. echo"<p align='centre;'>your session is expired!<a href='quizpage1.php'>Login Here</a></p>";
  200. echo"<span style='float:right;'><a href='logoutpage.php'>Logout</a></span>";
  201. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement