Space for google add

Create a login form with a username and password using session.

 


 Create a login form with a username and password. Once the user

logs in, the second form should be displayed to accept user details

(name, city, phoneno). If the user doesn’t enter information within a

specified time limit, expire his session and give a warning.



ex6seta2.html

<html>

<form name="fm1" method="post" action="ex6seta2.php">

<h3> Login </h3>

Username<input type="text" name="uname" value="" required><br>

Password<input type="password" name="upassword" value="" required><br>

<input type="submit" value="Submit"><br>

</form>

</html>



ex6seta2.php

<?php

session_start();

if(isset($_SESSION['last_activity']))

{

if($noactivity>=$timeout)

session_destroy();

echo "destroyed";

}

else

{

$_SESSION['last_activity']=time();

$timeout= 30*60;

echo "starts";

$noactivity=time()- $_SESSION['last_activity'];

echo "<BR> $noactivity";

}

?>



Post a Comment

0 Comments