<?php
error_reporting(E_ALL ^ E_DEPRECATED);
mysqli_report(MYSQLI_REPORT_OFF);
include "../include/variables.php";
include "../include/functions.php";
//custom error handler
function getDebugBacktrace($NL = "\n") {
$dbgTrace = array_reverse(debug_backtrace());
$dbgMsg = "";
foreach($dbgTrace as $dbgInfo) {
$dbgArg="";
if(isset($dbgInfo['args'])) {
foreach ($dbgInfo['args'] as $a) {
if (!empty($dbgArg)) {
$dbgArg .= ', ';
}
$dbgArg .= printVal($a);
}
}
$dbgMsg .= (isset($dbgInfo['file'])?("File ".$dbgInfo['file'].": "):"").
(isset($dbgInfo['line'])?("Line ".$dbgInfo['line'].": "):"")."Called: {$dbgInfo['function']}(".($dbgArg?("".$dbgArg):"").");$NL";
}
//$dbgMsg .= $NL;
return $dbgMsg;
}
function errorHandler($errno, $errmsg, $filename, $linenum, $vars=null) {
global $ip, $host;
$date=date("Y-m-d H:i:s");
switch ($errno) {
case E_WARNING:
$errtype = 'Warning';
break;
case E_NOTICE:
$errtype = 'Notice';
break;
case E_USER_ERROR:
$errtype = 'User Error';
break;
case E_USER_WARNING:
$errtype = 'User Warning';
case E_USER_NOTICE:
$errtype = 'User Notice';
break;
case E_STRICT:
// $errtype = 'Runtime Notice';
break;
case E_RECOVERABLE_ERROR:
$errtype = 'Catchable Fatal Error';
break;
default:
$errtype='Unknown Error';
break;
}
if(isset($errtype)) {
$err="Date: ".date("Y-m-d H:i:s")." IP: $ip".(!empty($host)?" Host: $host":"")."\n$errtype: $errmsg\nFile: ".$filename."\nLine: ".$linenum."\nError Number: $errno\nRequest Uri:".$_SERVER['REQUEST_URI']."\nDebug Backtrace:\n".getDebugBacktrace()."\n\n";
//error_log($err, 3, "logs/errorlog.txt");
echo "<pre>".htmlspecialchars($err)."</pre>";
}
return true;
}
set_error_handler("errorHandler",E_ALL ^ E_DEPRECATED);
//custom error handler end
include "../include/getip.php";
if (!function_exists("getinfo")) {
function getinfo() {
global $ip, $host;
return "[".date("Y-m-d H:i:s")." $ip".(!empty($host)?" $host":"")."]";
}
}
$PHP_SELF=$_SERVER['PHP_SELF'];
if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
if (ob_get_length()) ob_end_clean();
ob_start("ob_gzhandler");
}
else ob_start();
session_start();
include "../include/iplog.php";
//main code
header("Content-Type: text/html; charset=UTF-8");
bah();
function test($code){
if (!isset ($bar)) $bar = "";
global $bar;
$ret = eval ("?".">".$code);
if (!empty($ret)) $bar .= "<br>\n".$ret;
return $bar;
}
function foo(){
$bar="The Quick Brown Fox Jumps Over The Lazy Dog";
global $foo;
echo "[test(1)] ".test("<"."?php global \$bar; \$bar=\"$bar JUNKDATAHERE\"; echo \"\\\$bar = \\\"\".\$bar.\"\\\";<br>\\n\"; ?".">")."<br>\n";
echo "[test(2)] ".test("<"."?php global \$foo, \$bar; \$foo=substr(\$bar,0,strlen(\"$bar\")).\" 1234567890\"; echo \"\\\$foo = \\\"\".\$foo.\"\\\";<br>\\n\"; return \"\$ret<br>\\n\";?".">")."<br>\n";
echo $foo."<br>\n";
return "$bar<br>\n";
}
function bah (){
$bar="THAT IS BAR";
echo foo();
echo $bar;
}
$debug=true;
echo "<hr>Test Antispam & Word Analysis";
include "../include/antispam.php";
if (isset($_POST['msg'])) {
echo " Result: ";
if (isSpam($_POST['msg'])) echo "Spam";
else echo "Not Spam";
echo "<br>Unique Words: ";
$words = str_word_count($_POST['msg'], 1);
$count = array_count_values($words);
//sort($count);
ksort($count, SORT_STRING);
array_multisort($count, SORT_DESC);
foreach ($count as $name=>$value) {
//$totals[]=$value;
echo $name.": ".$value."<br>\n";
}
}
echo "<br><form method=\"post\"><textarea name=\"msg\" rows=\"25\" cols=\"80\">".(isset($_POST['msg'])?htmlspecialchars($_POST['msg']):"")."</textarea><br><input type=\"submit\" value=\"Submit\">";
?>
You can also check other includes below (some files are hidden as they are in exclusion list):
functions.php
getip.php
iplog.php
antispam.php