PHP Classes

Fatal error: Class 'OTU' not found

Recommend this page to a friend!

      PHP One Time URL  >  All threads  >  Fatal error: Class 'OTU' not found  >  (Un) Subscribe thread alerts  
Subject:Fatal error: Class 'OTU' not found
Summary:raw code and error shown
Messages:3
Author:Terry Woody
Date:2016-03-10 13:02:18
 

  1. Fatal error: Class 'OTU' not found   Reply   Report abuse  
Picture of Terry Woody 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

-----------------------------------

  2. Re: Fatal error: Class 'OTU' not found   Reply   Report abuse  
Picture of Microcad Software Microcad Software - 2016-04-08 10:33:20 - In reply to message 1 from Terry Woody
Same problem here, please help.
Thank you very much!

  3. Re: Fatal error: Class 'OTU' not found   Reply   Report abuse  
Picture of Terry Woody Terry Woody - 2016-04-13 16:33:14 - In reply to message 1 from Terry Woody
The class OTU file is missing required php tag for starters.

This alone prevented me from voting for class this month.

Still have not got it working though, now seems something amiss with the htaccess and links return 404 like:

Not Found

The requested URL /faked/Fkgc)FUKI3to4)Nlbv(kmw1d!T(HTrQkBWmz was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

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