} } } return $filesize; } $tmp_file = tempnam("./", "mystep"); if ($fp = fopen($tmp_file, "w")) { fclose($fp); unlink($tmp_file); } else { die("Current directory cannot be writen!"); } set_time_limit(0); ini_set('memory_limit', '512M'); ini_set('magic_quotes_runtime', 0); $pack_file = "mystep.pack"; $unpack_dir = "./"; $mypack = new MyPack($unpack_dir, $pack_file); $mypack->DoIt("unpack"); echo $mypack->GetResult(); unset($mypack); mkdir("./template/cache"); @unlink($pack_file); @unlink(__FILE__); ?> <script language="JavaScript"> location.href = "<?php echo $unpack_dir; ?> "; </script>
echo "Making setup pack, be patient..."; $log_file = "log.txt"; $log = array('time' => date("Y-m-d H:i:s"), 'ip' => getIp(), 'agent' => $_SERVER['HTTP_USER_AGENT']); if (strpos($log['agent'], "spider") !== false || strpos($log['agent'], "bot") !== false) { header("HTTP/1.0 404 Not Found"); exit; } WriteFile($log_file, implode(",", $log) . "\n", "ab"); if (!file_exists("build/" . $result_dir . ".zip")) { $pack_file = $result_dir . "/" . "mystep.pack"; $target_file = $result_dir . "/" . "mystep.php"; @unlink($target_file); MultiDel($result_dir); sleep(1); mkdir($result_dir); $mypack = new MyPack($pack_dir, $pack_file); $mypack->AddIgnore(basename(dirname(__FILE__)), ".svn", "web.config", "aspnet_client", "include/install.lock", "Thumbs.db", "bak", "xcache", "_test", "config_test.php", "config-bak.php", "cfna_mis"); if (!empty($cs)) { $mypack->setCharset("gbk", $cs, $lng_type, ".php,.tpl,.html,.htm,.sql"); } $mypack->DoIt(); //echo $mypack->GetResult(); $result = ""; $result .= GetFile("mypack.class.php"); $result .= "\n"; $result .= GetFile("setup.php"); $result = str_replace("?>\n<?php", "", $result); WriteFile($target_file, $result, "wb"); unset($result); copy("intro.txt", $result_dir . "/readme.txt"); require "../source/class/myzip.class.php";