<?php
session_start();
if( isset( $_GET['showSource'] ) )
{
highlight_file( __FILE__ );
}
else
{
if( isset( $_GET['unset'] ) )
{
unset( $_SESSION['back'] );
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="fr" xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<title>Et vlan ! l'historique de navigation avec $_SERVER['REQUEST_URI']…</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="content-language" content="fr" />
<meta name="author" content="Mathieu ADRIEN; http://www.grainedekeupon.fr" />
<style type="text/css">
html
{
font-family:Geneva, Arial, Helvetica, sans-serif;
margin:0;
padding:0;
font-size:.88em;
}
body
{
width:772px;
margin:0 auto;
padding:0;
}
a
{
text-decoration:none;
}
h1 span
{
font-family:monospace;
}
</style>
<script type="text/javascript">
</script>
</head>
<body>
<h1>Stocker l'historique de navigation avec <span>$_SERVER['REQUEST_URI']</span></h1>
<p>en réponse à <a href="http://www.commentcamarche.net/forum/affich-4609342-connaitre-l-url-de-la-page-precedente">Connaître l' URL de la page précédente</a>.</p>
<p>Testé sous Windows XP (SP2), avec FireFox (2).</p>
<p><a title="Validation XHTML" href="http://validator.w3.org/check?uri=referer">XHTML 1.0 Strict</a></p>
<p><a title="Validation CSS" href="http://jigsaw.w3.org/css-validator/check/referer">CSS 2.0</a></p>
<hr />
<?php
$_SESSION['back'][] = $_SERVER['REQUEST_URI'];
echo( "\t\t<pre>\n" );
print_r( $_SESSION['back'] );
echo( "\t\t</pre>\n" );
echo( "\t\t".'<p><a href="'.$_SERVER['PHP_SELF'].'?page='.count( $_SESSION['back'] ).'">Page suivante</a></p>'."\n" );
echo( "\t\t".'<p><a href="'.$_SERVER['PHP_SELF'].'?showSource=true">Afficher le code source</a></p>'."\n" );
echo( "\t\t".'<p><code><a href="'.$_SERVER['PHP_SELF'].'?unset=true">unset( $_SESSION[\'back\'] )</a></code></p>'."\n" );
?>
</body>
</html>
<?php
}
?>