<?php
/**
*
*@author Cerion Morgauin
* @version $Id$
* @copyright Enrico Marongiu (cerion _@_ tiscali _._ it) - 2004
* linkObfuscator manages a simple way of validating links: starting from a session, an user can browse exclusively those links that are performed by this page. to do this, a random seed is generated and a special code (named go) is attached to each link.
* each page that has to be obfuscated needs this class and a $linkObfuscator::check() to validate the user.
**/
require_once('linkObfuscator.class.php');
session_start();
$lO=new linkObfuscator($_SESSION['referralSeed']);
print "actual referral Seed:". $_SESSION['referralSeed'] ."<br />\n";
?>
<html><body>
<?
if ($lO->referralSeed) {
if($lO->check($_SERVER['REQUEST_URI'])){
print "checked link: ${_SERVER['REQUEST_URI']}<br />\n";
}else{
print "link invalid: ${_SERVER['REQUEST_URI']} \n";
}
}
$_SESSION['referralSeed']=$lO->seed;
$newLink= preg_replace('/(&|\?)go=(\w)+/','',$_SERVER['REQUEST_URI']);
$newLinkObscured=$lO->obfuscate($newLink);
?>
<a href="<?=$newLinkObscured?>">Obscured</a>
</body>
|