<script>
var timer;
var seconds=21;
var b="banana";
var c="";
function da_capo(){
clearInterval(timer);
seconds=11;
b="banana";
c="";
document.counter.d1.value=c;
document.counter.d2.value=seconds;
timeoutf();
}
function display(){
if(seconds >0){
seconds--;
document.counter.d2.value=seconds;
if(seconds ==0){
clearInterval(timer);
document.counter.d1.value=b;
location.href="off-max.php";
}}}
function timeoutf(){
timer=setInterval("display()",1000);
}
timeoutf();
function stop(){
clearInterval(timer);
}
</script>
<form name="counter">
<input type="text" size="10" name="d1"><br>
<input type="text" size="10" name="d2"><br>
<input type="reset" size="4" value="reset">
<input type="button" size="4" onClick="stop()" value="stop"><br>
<input type="button" size="10" onClick="timeoutf()" value="riprendi">
<input type="button" size="10" onClick="da_capo()" value="da capo">
</form>
<table width=700><tr><td>
<iframe src="stato-max.php" width=200 height=100></iframe></td></tr></table>
<?php
session_start();
if(isset($_POST['pulsante'])){
session_start();
$ben="Benvenuto ";
$_SESSION['nome'] = htmlspecialchars($_POST['nome']);
$_SESSION['ben'] = htmlspecialchars($ben);
$var1=fopen("stato-max.php","w+");
fwrite($var1,"stato: <font color=blue>on-line</font><meta http-equiv='refresh' content='5; url=stato-max.php'>");
fclose($var1);
}
if(isset($_POST['pulsante2'])){
$messaggio=htmlspecialchars($_POST['messaggio']);
echo "$ben <font color=blue> $nome messaggio inviato!</font>";
$var=fopen("deposito_messaggi.php","a+");
fwrite($var, "<b>Nome: </b> $nome <br> <b>Messaggio:</b> $messaggio<br> ----- <br>");
fclose($var);
}
if(isset($_POST['pulsante3'])){
session_start();
session_destroy();
header("Location: session-tutto-in-una-pagina.php");
}
?>
<table border=1 width=500><tr><td>
<form action="#" method="POST">
Scrivi il tuo nome una volta sola: <input type="text" name="nome"><br>
Nome: <? echo "<font color=blue>$nome</font>"; ?><br>
<input type="submit" name="pulsante" value="invia">
</form>
</td></tr></table>
<br>
<table border=5 width=500><tr><td>
<form action="#" method="POST">
Nome: <? echo "<font color=blue>$nome</font>"; ?><br>
Messaggio: <textarea rows=3 cols=30 name="messaggio"></textarea><br>
<input type="submit" name="pulsante2" value="invia">
</form>
</td></tr></table>
<br>
<table border=5 width=500><tr><td align="center">
<form action="#" method="POST">
<input type="submit" name="pulsante3" value="esci">
</form>
</td></tr></table>
<br>
<div align=center>
<a href="session-tutto-in-una-pagina.php">aggiorna</a><br>
<a href="deposito_messaggi.php">deposito messaggi</a><br>
</div>