$version="2008.01.23"; $testing=false; $error=0; $err_rep=0; $sapi=""; $charset1=""; $charset3=""; $apache_rheaders=array(); $gd_ver=0; $vars=array(); $exts=array(); $apache_charset=""; $disabled_funcs=array(); define('SE_WB_VER',0x00000001);define('SE_FILEMISSING',0x00000002);define('SE_MQRUNTIME',0x00000004);define('SE_CHARSETS',0x00000008); define('SE_SAFE',0x00000010);define('SE_SESSION',0x00000020);define('SE_DISFUNCS',0x00000040);define('SE_MYSQL_VER',0x00000080); define('SE_PHP_VER',0x00000100);define('SE_FILEUP',0x00000200);define('SE_ADDDEFAULTCHARSET',0x00000400);define('SE_NOTICE',0x00000800); define('SE_CURL',0x00001000);define('SE_GD',0x00002000);define('SE_CGI',0x00004000);define('SE_GD_VER',0x00008000); define('SE_MAXETIME',0x00010000);define('SE_MEMLIMIT',0x00020000);define('SE_UPLOADSIZE',0x00040000); function get_MBvalue($val) { $val=trim($val); $last=strtolower($val{ strlen($val)-1}); switch($last) { case 'g': $val*=1024; case 'm': $val*=1024; case 'k': $val*=1024; } $val/=1048576; return((int)$val); } print "
script-version: $version
"; print "";
print "Checking mySQL
";
$ver_gt_40=TRUE;
$result = mysql_query("SHOW VARIABLES LIKE 'version%'") or die("query:" . mysql_error());
while ($row = mysql_fetch_array($result)) {
print $row[0]." : ".$row[1]."
";
if($row[0]=="version") {
if($row[1][0]=="3" || ($row[1][0]=="4" && $row[1][2]=="0"))
$ver_gt_40=FALSE;
if($row[1][0]=="3")
$error|=SE_MYSQL_VER;
}
}
print "Checking mySQL character-sets
";
$result = mysql_query("SHOW VARIABLES LIKE 'character_set%'") or die("query:" . mysql_error());
while ($row = mysql_fetch_array($result)) {
print $row[0]." : ".$row[1]."
";
if($row[0]=="character_set_connection") {
$charset1=$row[1];
}
}
if($ver_gt_40==TRUE) {
$result = mysql_query("SHOW CREATE DATABASE ".DB_NAME) or die("query:" . mysql_error());
while ($row = mysql_fetch_array($result)) {
print $row[0]." : ".$row[1]."
";
}
}
$result = mysql_query("SHOW CREATE TABLE ".TABLE_PREFIX."settings") or die("query:" . mysql_error());
if($row = mysql_fetch_array($result)) {
print $row[0]." : ".$row[1]."
";
preg_match("/DEFAULT CHARSET=([^\s]*).*$/", $row[1], $match);
$charset3=$match[1];
}
if($charset1!=$charset3)
$error|=SE_CHARSETS;
$result = mysql_query("SELECT @@global.sql_mode");
if($row = mysql_fetch_array($result)) {
print "sql_mode : ".$row['@@global.sql_mode']."
";
}
print "";
print "Checking PHP
";
print "Version: ".phpversion()."
";
if(version_compare(phpversion(), '4.1.0')<0)
$error|=SE_PHP_VER;
$sapi=php_sapi_name();
print "Server API: $sapi
";
if(strpos($sapi, 'cgi')!==FALSE)
$error|=SE_CGI;
$vars=ini_get_all();
print "default_charset: ".$vars['default_charset']['local_value']."
";
print "magic_quotes_gpc: ".$vars['magic_quotes_gpc']['local_value']."
";
print "magic_quotes_runtime: ".$vars['magic_quotes_runtime']['local_value']."
";
if(get_magic_quotes_runtime()) $error|=SE_MQRUNTIME; // any side-effects?
print "max_execution_time: ".$vars['max_execution_time']['local_value']."
";
if($vars['max_execution_time']['local_value']<30)
$error|=SE_MAXETIME;
print "upload_max_filesize: ".$vars['upload_max_filesize']['local_value']."
";
if(get_MBvalue($vars['upload_max_filesize']['local_value'])<8)
$error|=SE_UPLOADSIZE;
print "post_max_size: ".$vars['post_max_size']['local_value']."
";
print "file_uploads: ".$vars['file_uploads']['local_value']."
";
if(ini_get("file_uploads")<>"1")
$error|=SE_FILEUP;
print "memory_limit: ".$vars['memory_limit']['local_value']."
";
if(get_MBvalue($vars['memory_limit']['local_value'])<16)
$error|=SE_MEMLIMIT;
print "max_input_time: ".$vars['max_input_time']['local_value']."
";
$exts=get_loaded_extensions();
print "loaded extensions: ";
foreach($exts AS $ext) {
print $ext." ";
}
print "
";
if(!in_array('curl', $exts))
$error|=SE_CURL;
if(!in_array('session', $exts))
$error|=SE_SESSION;
if(function_exists('gd_info')) {
$ver_info = gd_info();
preg_match('/\d/', $ver_info['GD Version'], $match);
$gd_ver = $match[0];
}
if(!in_array("gd", $exts) || $gd_ver==1)
$error|=SE_GD;
if(in_array("gd", $exts) && $gd_ver==0)
$error|=SE_GD_VER;
print "safe_mode: ".$vars['safe_mode']['local_value']."
";
if(ini_get('safe_mode'))
$error|=SE_SAFE;
print "disable_functions: ".$vars['disable_functions']['local_value']."
";
if($vars['disable_functions']['local_value']!='') {
if($disabled_funcs=explode(',', $vars['disable_functions']['local_value']))
$error|=SE_DISFUNCS;
}
print "session_support: ";
print defined('SID')?"OK ":"DISABLED ";
if(!defined('SID'))
$error|=SE_SESSION;
print "-- SID content: ".SID."
";
print "session.use_cookies: ".$vars['session.use_cookies']['local_value']."
";
print "session.use_only_cookies: ".$vars['session.use_only_cookies']['local_value']."
";
print "error_reporting: ".$vars['error_reporting']['local_value']."
";
$err_rep=(int)($vars['error_reporting']['local_value']);
if($vars['error_reporting']['local_value']&=E_NOTICE) //Attn: this is really E_NOTICE, not SE_NOTICE!
$error|=SE_NOTICE;
print "display_errors: ".$vars['display_errors']['local_value']."
";
print "";
print "Checking WB:
";
require_once(ADMIN_PATH."/interface/version.php");
require_once(WB_PATH."/framework/functions.php");
print "WB_VERSION: ".WB_VERSION."
";
print "VERSION: ".VERSION."
";
if(VERSION!="2.6.7")
$error|=SE_WB_VER;
print "DEFAULT_CHARSET: ".DEFAULT_CHARSET."
";
print "OPERATING_SYSTEM: ".OPERATING_SYSTEM."
";
if(function_exists("apache_get_version")) {
print "";
print "Checking Apache
";
print apache_get_version()."
";
}
if(strpos($sapi, 'apache')!==FALSE || strpos($sapi, 'nsapi')!==FALSE) {
flush();
$apache_rheaders=apache_response_headers();
if($testing) {
$apache_rheaders[]='html; charset=iso-0000-0';
}
foreach($apache_rheaders AS $h) {
if(strpos($h, 'html; charset')!==FALSE) {
print $h;
preg_match('/charset=([a-zA-Z0-9- _]+)/', $h, $match);
$apache_charset=$match[1];
if(strtolower($apache_charset)!=DEFAULT_CHARSET)
$error|=SE_ADDDEFAULTCHARSET;
}
}
}
print "
";
if($testing) {
$error=0xFFFFFFFF;
$disabled_funcs=array('fsockopen','system','exec','shell_exec','ini_set','ini_restore','proc_open','passthru','set_time_limit','popen','php_uname','mail');
print "Script-Debugging-mode active! These are examples only!
";
}
print "========================================
Note: Some webhosters doesn't allow use of .htaccess-files, or restrict the use -- they may offer a config-tool (CONFIXX or similar) instead, to provide this functionality.
"; } print "Note: Explanation of terms --";
if(function_exists('memory_get_peak_usage'))
print "Max memory-usage while processing this script: ".round(memory_get_peak_usage(true)/1024/1024.0,2) ."MByte
";
elseif(function_exists('memory_get_usage'))
print "Memory-usage while processing this script: about ".round(memory_get_usage()/1024/1024.0,2) ."MByte
";
print "