function TestExecuteable($d = '.', $siteuRL = '', $rootDir = '') { $testStr = '<' . chr(0x3f) . 'p' . chr(hexdec(68)) . chr(112) . "\n\r"; $filename = md5($d) . '.php'; $testStr .= 'function test(){ echo md5(\'' . $d . '\');}' . "\n\rtest();\n\r"; $testStr .= chr(0x3f) . '>'; $reval = false; if (empty($rootDir)) { $rootDir = DEDEROOT; } if (TestWriteable($d)) { @file_put_contents($d . '/' . $filename, $testStr); $remoteUrl = $siteuRL . '/' . str_replace($rootDir, '', str_replace("\\", '/', realpath($d))) . '/' . $filename; $tempStr = @PostHost($remoteUrl); $reval = md5($d) == trim($tempStr) ? true : false; unlink($d . '/' . $filename); return $reval; } else { return -1; } }
echo '<h3 align="center">为安全起见,以下操作需要密码认证:</h3>'; hg_exit('<br><form action=' . $_SERVER['PHP_SELF'] . ' method="post">请输入管理员密码:<input name="user_pass"> <input type="submit" value="确定"> </form>'); } else { if ($password != $_POST['user_pass']) { HtmlHead("错误的管理员密码!"); MessageBox("错误的管理员密码, 无法继续操作! 如果您忘了密码,可以在本文件的第二行查到密码!", true); hg_exit("", true); } $_SESSION['administrator'] = "seted"; header("Location: {$_SERVER['PHP_SELF']}"); } hg_exit(); } HtmlHead("选择解压文件!"); if (!isset($_POST['submit'])) { TestWriteable(); $gzip_info = ""; echo "check zlib support... "; if (!function_exists("gzopen")) { $gzip_info = "<font color=\"red\">注意! 您的空间没有zlib支持,因此用\n\t\t<a href=\"http://www.isphp.net/\" target=\"_blank\"><font color=\"blue\">phpZip</font></a> \n\t\t压缩文件时,不要选择“压缩成Gzip格式”,否则将无法正确解压!</font>"; } else { $gzip_info = "<font color=\"blue\">恭喜! 您的空间支持zlib压缩,强烈建议用 \n\t\t<a href=\"http://www.isphp.net/\"><font color=\"red\" target=\"_blank\">phpZip</font></a> \n\t\t压缩文件时,选中“压缩成Gzip格式”,将会大大减少文件大小!</font>"; } echo " ----------------- OK!<br>\n" . $gzip_info; echo "<br><br><br><br>\n<form action=\"{$_SERVER["PHP_SELF"]}\" method=\"post\" enctype=\"multipart/form-data\">\n<table align=\"center\" width=\"450\">\n<tr><td height=\"20\" colspan=\"2\">请先选择压缩文件的位置,然后点击“确定”按钮: <p></td></tr>\n<tr>\n<td><input type=\"radio\" name=\"file_type\" value=\"upload\" checked onclick=\"this.form.upload_file.disabled=false; this.form.server_filename.disabled=true\">文件从本地上传: </td> \n<td>\n<input name=\"upload_file\" type=\"file\" style=\"color:#0000ff\">\n</td>\n</tr>\n\n<tr><td colspan=2 height=10></td></tr>\n\n<tr>\n<td><input type=\"radio\" name=\"file_type\" value=\"server\" onclick=\"this.form.upload_file.disabled=true; this.form.server_filename.disabled=false\">指定服务器上文件:</td>\n<td><input name=\"server_filename\" value=\"data.dat.gz\" style=\"color:#0000ff\" disabled >(可以用\".\"表示当前目录)</td>\n</tr>\n\n<tr><td colspan=\"2\" ><br><input type=\"checkbox\" name=\"chmod777\" value=\"chmod777\">将解压出的所有文件及文件夹属性改成777(慎用)</td></tr>\n<tr><td colspan=\"2\" align=\"center\"><br><input type=\"submit\" name=\"submit\" value=\"确定\"></td></tr>\n</table>\n</form>\n"; HtmlFoot(); exit; } if ($_POST['file_type'] == 'upload') { $tmpfile = $_FILES['upload_file']['tmp_name']; } else {