Terry Woody - 2016-03-10 13:02:18
Trying out and getting the raw code and error returned below. No readme or any other info so not really sure how to even setup?
--------------------------------
class OTU { private static $fakeUrlPart = '/faked/'; // So that we have a way of knowing that it is in fact a fake url we are working with private static $instance = null; // The instance /** * Sets up the session variables, if they have not yet been */ private function __construct() { if (!isset($_SESSION['OTU_urls'])) { $_SESSION['OTU_urls'] = array(); $_SESSION['OTU_keys'] = array(); $_SESSION['OTU_values'] = array(); } } /** * Builds the obfuscated url, checking if it alreay exists * * @return String */ private static function buildUrl () { if (self::$instance === null) { self::$instance = new this(); } $validChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-_()!'; // The list of valid characters, the obs url might use $len = 35; // The length of the obs url $i = 0; $url = ''; // The ending url for ($i; $i <= $len; $i++) { $rand = rand(0, strlen($validChars)-1); $url .= $validChars[$rand]; } if (in_array($url, $_SESSION['OTU_values'])) { $url = self::buildUrl(); // Rebuild if it alreay exists } return $url; } /** * Stores the real and fake url in sessions. * * @param String $in * @return String */ public static function getObfuscatedUrl ($in) { if (self::$instance === null) { self::$instance = new self(); } if (self::hasObsUrl($in)) { $index = array_search($in, $_SESSION['OTU_values']); $obs = $_SESSION['OTU_keys'][$index]; } else { $obs = self::buildUrl(); $_SESSION['OTU_urls'][$obs] = $in; $_SESSION['OTU_keys'][] = $obs; $_SESSION['OTU_values'][] = $in; } return self::$fakeUrlPart . $obs; } /** * Returns true if the url already have a valid obs url * * @param String $in * @return String */ public static function hasObsUrl ($in) { if (self::$instance === null) { self::$instance = new self(); } $index = array_search($in, $_SESSION['OTU_values']); return ($index > -1); } /** * Returns the real url, if there is any, else null. * * @param String $in * @return String */ public static function getRealUrl ($in) { if (self::$instance === null) { self::$instance = new self(); } $in = str_replace(self::$fakeUrlPart, '', $in); $index = array_search($in, $_SESSION['OTU_keys']); $real = null; if ($index > -1) { $real = $_SESSION['OTU_values'][$index]; unset($_SESSION['OTU_keys'][$index]); unset($_SESSION['OTU_values'][$index]); } return $real; } /** * Returns the real fake url the user are on, by splitting by question marks. * * @return String */ public static function getOnUrl () { $url = $_SERVER['REQUEST_URI']; $urls = explode('?', $url); $_SERVER['REQUEST_URI'] = $urls[0]; return $urls[0]; } }
Fatal error: Class 'OTU' not found in /home/xxxxx/public_html/testbed/onetimeurl/index.php on line 5
-----------------------------------