<?php

if ( isset($_SERVER['HTTP_IF_NONE_MATCH']) ) {
    
$etag $_SERVER['HTTP_IF_NONE_MATCH'];
} else {
    
$etag rand(0,9) . rand(0,9) . rand(0,9) . rand(0,9);
}

if ( isset(
$_SERVER['HTTP_IF_MODIFIED_SINCE']) ) {
    
$first_visit $_SERVER['HTTP_IF_MODIFIED_SINCE'];
} else {
    
$first_visit gmdate("D, d M Y H:i:s"time()) . " GMT";
}

$last_visit gmdate("D, d M Y H:i:s"time()) . " GMT";

header ("ETag: " $etag );

header("Expires: Tue, 19 Jan 2038 03:14:00 GMT");
header("Cache-Control: max-age=" . (2147483640 time()) . ", must-revalidate");
header("last-modified: " $last_visit);

echo 
"Your sessiond id is: " $etag " (<a href=\"index.phps\">source code</a>).<br>Last visit: " $first_visit "<br><p>This script uses the ETag and the HTTP Cache-Control to keep trace of your sessione, without using any cookies. To clean your session, just \"shift reload\" this page.</p>";

?>