PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of eikron morgauin  >  Link Obfuscator  >  test.php  >  Download  
File: test.php
Role: Example script
Content type: text/plain
Description: A simple test file
Class: Link Obfuscator
Obfuscate HTML links to prevent direct page access
Author: By
Last change:
Date: 17 years ago
Size: 1,134 bytes


Class file image Download

 *@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.



$lO=new linkObfuscator($_SESSION['referralSeed']);
"actual referral Seed:". $_SESSION['referralSeed'] ."<br />\n";
if ($lO->referralSeed) {
"checked link: ${_SERVER['REQUEST_URI']}<br />\n";
"link invalid: ${_SERVER['REQUEST_URI']} \n";

$newLink= preg_replace('/(&|\?)go=(\w)+/','',$_SERVER['REQUEST_URI']);

<a href="<?=$newLinkObscured?>">Obscured</a>

For more information send a message to info at phpclasses dot org.