http://www.odu.edu/test/php/hideurl.php
Code: Select all
<?php
session_start();
if (count($_GET) > 0) {
$_SESSION["GET"] = serialize($_GET);
header("Location: hideurl.php");
exit();
}
if (count($_POST) > 0) {
$_SESSION["POST"] = serialize($_POST);
header("Location: hideurl.php");
exit();
}
echo "GET: " . count($_GET) . "<br>";
echo "POST: " . count($_POST) . "<br>";
if (isset($_SESSION["GET"])) {
$_GET = unserialize($_SESSION["GET"]);
}
if (isset($_SESSION["POST"])) {
$_POST = unserialize($_SESSION["POST"]);
}
session_destroy();
?>
<html>
<body>
<h1><pre>GET: <?php print_r($_GET); ?></pre></h1>
<h1><pre>POST: <?php print_r($_POST); ?></pre></h1>
<a href="hideurl.php?link=link1">Link 1</a> | <a href="hideurl.php?link=link2">Link 2</a> | <a href="hideurl.php?link=link3">Link 3</a><br>
<form method="post"><input type="submit" name="link" value="link1"><form method="post"><input type="submit" name="link" value="link2"><form method="post"><input type="submit" name="link" value="link3">
</body>
</html>