PHP highlighting [message #11867] |
Sat, 19 July 2003 16:00 |
jrobbio
Messages: 32 Registered: June 2003
Karma: 0
|
Member |
|
|
This is producing the error Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/virtual/site36/fst/var/www/html/forum/theme/default/post.php on line 303 on my board. Just testing to see if it is a one off.
<?php // Checking if BBCLONE_DIR is set if (!defined( Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/virtual/site36/fst/var/www/html/forum/theme/default/post.php on line 303 "_BBCLONE_DIR\")) { echo \"\\n<!-- BBclone Error: You have to correctly defined _BBCLONE_DIR -->\\n\"; return; } else { global $BBCLONE_DIR; $BBCLONE_DIR = ereg(\"/$\", _BBCLONE_DIR) ? _BBCLONE_DIR : _BBCLONE_DIR . \"/\"; }
// Prevent to load twice mark_page.php if (defined(\"_BBC_PAGE_MARKED\")) { return; } else { define(\"_BBC_PAGE_MARKED\",1); }
// Loading all the desired libraries require($BBCLONE_DIR . \"constants.php\"); require($GLOBALS[\"BBC_LIB_PATH\"] . \"io.php\"); //require($GLOBALS[\"BBC_CONF_PATH\"] . $GLOBALS[\"BBC_CONFIG_FILE\"]);
// Main Class Counter class marker { var $filename; // Constructor function counter() { mt_srand((double)microtime()*1000000); }
// Choose the counterfile to use function choose_counterfile($fileprefix, $filesuffix) { $salt = mt_rand(0,9); return ($fileprefix.$salt.$filesuffix); }
// Converts quad dotted IPv4 addresses to Hexa function convert_ip($ipaddr) { $dotted = preg_split( \"/[.]+/\", $ipaddr); $ip = (double)0; $y = 0x1000000; for( $i=0; $i<4; $i++) { $ip += ($dotted[$i] * ($y)); $y = ($y >> 8); } return $ip; }
// Open the counter file and locks it function open_counterfile() { $filename = $this->choose_counterfile ( $GLOBALS[\"BBC_CACHE_PATH\"] . $GLOBALS[\"BBC_COUNTER_PREFIX\"], $GLOBALS[\"BBC_COUNTER_SUFFIX\"] ); $counterp = fopenlock($filename,\"a+\");
if (!$counterp) { echo \"<!-- mark_page.php: unable to use \\\"$filename\\\" -->\\n\"; return false; }
return $counterp; }
// Sets the values for the string function set_values() { $localtime = time(); // UNIX timestamp
global $HTTP_X_FORWARDED_FOR, $HTTP_CLIENT_IP, $HTTP_FORWARDED, $HTTP_SP_HOST, $REMOTE_ADDR, $REMOTE_HOST, $HTTP_USER_AGENT, $HTTP_REFERER, $REQUEST_URI;
// Through the looking-glass, quick and efficient $PROXY = array (\"$HTTP_X_FORWARDED_FOR\", \"$HTTP_CLIENT_IP\", \"$HTTP_FORWARDED\", \"$HTTP_SP_HOST\");
for($k = 0, $nbproxy = sizeof($PROXY); $k < $nbproxy; $k++) { if ($PROXY[$k]) { $iptest = gethostbyname($PROXY[$k]);
//Sort everything out that hasn\'t got IPv4 format if (!eregi(\" ^([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})$\ ", $iptest, $regs)) { $ip = $REMOTE_ADDR; $hexip = $this->convert_ip($ip); } else { //Sort out local and private addresses if (((int) $regs[1] == 0) || ((int) $regs[1] == 10) || ((int) $regs[1] == 127) || (((int) $regs[1] == 172) && ((int) $regs[2] > 15) && ((int) $regs[2] < 32)) || (((int) $regs[1] == 192) && ((int) $regs[2] == 168))) { $ip = $REMOTE_ADDR; $hexip = $this->convert_ip($ip); } //Sort out multicast and addresses with values out of range else if (((int) $regs[1] > 223) || ((int) $regs[2] > 255) || ((int) $regs[3] > 255) || ((int) $regs[4] == 0) || ((int) $regs[4] > 254)) { $ip = $REMOTE_ADDR; $hexip = $this->convert_ip($ip); } //Take the addresses remained and assume they\'re the real ones else { $ip = $iptest; $hexip = $this->convert_ip($ip); } } // The following lines were added to avoid invalid hostnames in the logfiles. Now // everything that can\'t be ressolved back will stay an IP address. $temphost = gethostbyaddr($ip); $tempip = gethostbyname($temphost); if ($ip != Warning: Unexpected character in input: '' (ASCII=92) state=1 in /home/virtual/site36/fst/var/www/html/forum/theme/default/post.php on line 303 "$tempip\") { $ev_hostname = $ip; } else { $ev_hostname = $temphost; break; } } } if (!$ip) { if ($REMOTE_ADDR) // Once again we need to avoid invalid hostnames in the logfiles. { $ip = $REMOTE_ADDR; $hexip = $this->convert_ip($ip); $temphost = gethostbyaddr($ip); $tempip = gethostbyname($temphost); if ($ip != \"$tempip\") { $ev_hostname = $ip; } else { $ev_hostname = $temphost; } } else { $ev_hostname = \"unknown\"; $ip = \"unknown\"; $hexip = \"unknown\"; } }
if (!$HTTP_USER_AGENT) $HTTP_USER_AGENT = \"unknown\"; if (!$HTTP_REFERER) $HTTP_REFERER = \"unknown\";
$str = strip_tags( \" $localtime|$hexip|$ip|$ev_hostname|$REMOTE_HOST|$HTTP_USER_A GENT|\ ". Warning: Unexpected character in input: '' (ASCII=92) state=1 in /home/virtual/site36/fst/var/www/html/forum/theme/default/post.php on line 303 "$HTTP_REFERER|$REQUEST_URI|\" . (defined(\"_BBC_PAGE_NAME\") ? _BBC_PAGE_NAME : \"\" )); return $str; }
// Outputs some values to a file function write_values($dest,$string) { return(fputs($dest, $string.\"\\n\")); }
// Close the counterfile function close_counterfile($filep) { flush(); return(flock($filep, 3) && fclose($filep)); }
// err... the main stuff function main() { $mystring = $this->set_values(); $file = $this->open_counterfile();
if ($file) { return (($this->write_values($file,$mystring)) && ($this->close_counterfile($file))); } } }
// Launching this class $mark = new marker;
if(!$mark->main()) { echo (\"\\n<!-- BBClone v \". $GLOBALS[\"BBC_VERSION\"] .\" KO -->\\n\"); } else { echo (\"\\n<!-- BBClone v \". $GLOBALS[\"BBC_VERSION\"] .\" OK -->\\n\"); }
?>
|
|
|
|