Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <style>
- #user
- {
- color:blue;
- font-size:16px;
- }
- #pass
- {
- color:blue;
- font-size:16px;
- }
- </style>
- </head>
- <body>
- <table>
- <form action="quizpage2.php" method="post">
- <tr>
- <td><div id="user">Username:</div></td></br>
- <td><input type="text" name="user"></td>
- </tr>
- <tr>
- <td><div id="pass">Password:</div></td>
- <td><input type="text" name="pass"></td>
- </tr>
- <tr>
- <td><input type="submit" value="submit"></td>
- </tr>
- </form>
- </table>
- </body>
- </html>
- page2
- session_start();
- $AB=$_POST["user"];
- $CD=$_POST["pass"];
- $_SESSION["new"]=$AB;
- $EF=array("paul", "andrew", "steven" ,"don");
- $GH=array(123, 456, 789, 000);
- if(($AB==$EF[0])&&($CD==$GH[0]))
- {
- $_SESSION["new"]=$EF[0];
- $_SESSION["start"]=time();
- $_SESSION["expire"]=$_SESSION["start"]+(1*60);
- echo "<script> alert('login successfull')</script>";
- echo "<script>window.location.assign('quizpage3.php')</script>";
- }
- ?>
- page3-
- <?php
- session_start();
- if(!isset($_SESSION["new"]))
- {
- echo"<p align='center';>Please login Again";
- echo"<a href='quizpage1.php'>Click here</a></p>";
- //header("location:quizpage1.php");
- }
- else
- {
- $now=time();
- if($now>$_SESSION['expire'])
- {
- session_destroy();
- echo"<p align='centre;'>your session is expired!<a href='quizpage1.php'>Login Here</a></p>";
- echo"<span style='float:right;'><a href='logoutpage.php'>Logout</a></span>";
- }
- else
- {
- echo"<html>";
- echo"<head>";
- echo"<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js'></script>";
- echo"<script>
- $(document).ready(function() {
- window.history.forward(1);
- });
- </script>";
- echo"<style>
- #sun
- {
- background-color:lightblue;
- width:60%;
- }
- </style>";
- echo"</head>";
- echo"<body>";
- echo"<form action='quizpage4.php' method='post'>";
- echo"<div id='sun'>";
- echo"<tr>";
- echo"<td>Which of the following part of the Sun is visible by human?</td></br>";
- echo"<td><input type='radio' name='sun' value='Photosphere'>Photosphere</td>.</br>";
- echo"<td><input type='radio' name='sun' value='Corona'>Corona</td>.</br>";
- echo"<td><input type='radio' name='sun' value='Chromosphere'>Chromosphere</td>.</br>";
- echo"<td><input type='radio' name='sun' value='Core'>Core</td>.</br>";
- echo"</tr>";
- echo"<tr>";
- echo"<td><input type='submit' value='Nextpage'></td>";
- echo"</tr>";
- echo"</div>";
- echo"</form>";
- echo"</table>";
- echo"</body>";
- echo"</html>";
- }
- }
- ?>
- enter code here
- Logoutpage-
- <?php
- session_start();
- session_destroy();
- header("location:quizpage1.php");
- ?>de here
- $now=time();
- if($now>$_SESSION['expire'])
- {
- session_destroy();
- echo"<p align='centre;'>your session is expired!<a href='quizpage1.php'>Login Here</a></p>";
- echo"<span style='float:right;'><a href='logoutpage.php'>Logout</a></span>";
- }
- echo"<form action='quizpage4.php' method='post'>";
- echo"<td><input type='submit' value='Nextpage' name='submit'></td>";
- if(isset($_POST['submit']) && !empty($_POST['submit']))
- {
- echo "<script>window.location.assign('page4.php')</script>";
- }
- $now=time();
- if($now>$_SESSION['expire'])
- {
- //echo 1;exit;
- session_destroy();
- echo"<p align='centre;'>your session is expired!<a href='quizpage1.php'>Login Here</a></p>";
- echo"<span style='float:right;'><a href='logoutpage.php'>Logout</a></span>";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement