Program 1
<html>
<head><title>User Login Application for Session</title>
<body>
<center>
<form method=post action="testSession2.php" >
<table border=1>
<tr>
<th>User Name: </th>
<td><input type=text name=txtuser></td>
</tr>
<tr>
<th>Password: </th>
<td><input type=password name=txtpass></td>
</tr>
<tr>
<td></td>
<td><input type=submit value=Submit name=submitbtn></td>
</tr>
<table>
</form>
</center>
</body>
</html>
Program 2
<html>
<body>
<A href="signout.php">Signout</A>
<center>
<h1> Test Session 2 Page</h2>
<pre>
<?php
$user=$_POST['txtuser'];
$pass=$_POST['txtpass'];
echo "User Name: ".$user;
echo "Password: ".$pass;
session_start();
$_SESSION['username']=$user;
$_SESSION['password']=$pass;
?>
</pre>
<form method=post action="testSession3.php" >
<table border=1>
<tr>
<td></td>
<td><input type=submit value=Submit name=submitbtn></td>
</tr>
<table>
</form>
</center>
</body>
</html>
Program 3
<html>
<body>
<A href="signout.php">Signout</A>
<center>
<h1> Test Session 3 Page</h2>
<pre>
<?php
session_start();
echo "User Name: ".$_SESSION['username']."<br>";
echo "Password: ".$_SESSION['password'];
$_SESSION['email']='anurag@gmail.com';
$_SESSION['course']='BTech';
?>
</pre>
<form method=post action="testSession4.php" >
<table border=1>
<tr>
<td></td>
<td><input type=submit value=Submit name=submitbtn></td>
</tr>
<table>
</form>
</center>
</body>
</html>
Program 4
<html>
<body>
<A href="signout.php">Signout</A>
<center>
<h1> Test Session 4 Page</h2>
<pre>
<?php
session_start();
echo "User Name: ".$_SESSION['username']."<br>";
echo "Password: ".$_SESSION['password']."<br>";
echo "Email: ".$_SESSION['email']."<br>";
echo "Course is: ".$_SESSION['course']."<br>";
?>
</pre>
<form method=post action="testSession5.php" >
<table border=1>
<tr>
<td></td>
<td><input type=submit value=Submit name=submitbtn></td>
</tr>
<table>
</form>
</center>
</body>
</html>
Program 5
<html>
<body>
<center>
<pre>
<?php
session_start();
session_unset();
session_destroy();
echo " <font color=red size=5>Session is finished now</font>";
echo "User Name: ".$_SESSION['username']."<br>";
echo "Password: ".$_SESSION['password']."<br>";
echo "Email: ".$_SESSION['email']."<br>";
echo "Course is: ".$_SESSION['course']."<br>";
?>
</pre>
</center>
</body>
</html>