<?php
session_start();
?>
<html><body><h2>Sessioonid</h2>
<form>
<?php
if(!$_SESSION["sees"]){
if($_REQUEST["kasutajanimi"]=="juku" and
$_REQUEST["parool"]=="kala"){
$_SESSION["sees"]=true;
}
}
if($_SESSION["sees"]){
if($_REQUEST["lahku"]){
$_SESSION["sees"]=false;
}
}
if($_SESSION["sees"]){
echo date("h:i:s")."<br />\n";
echo "<input type='submit' name='lahku' value='Lahku'>";
} else {
echo "Kasutajanimi: <input type='text' name='kasutajanimi'><br />
Parool: <input type='text' name='parool' /><br />
<input type='submit' value='sisene'>";
}
?>
</form></body></html>