<?php
require_once('common.php');
	/*$query=file_get_contents("../version.php");
	$query=file_get_contents("http://www.24hmz.cn/auth/gx.php?ver=".$query);
	if($query=json_decode($query,true)) {
		$upcode = $query['code'];
		if($query['code']==1){
			$upmsg = $query['msg'];
		}
		else{
			 $upmsg = $query['msg'];
		}
	}
	
//************************执行代码开始*************************
if($_POST['type']=='update'){
	if($_POST['submit']=="返回首页") header("Location: /"); 
	$url = $query['file'];
	$RemoteFile = $url;
	$ZipFile = "update.zip";
	copy($RemoteFile,$ZipFile) or showmsg("无法下载更新包文件{$url}",false,"",true);
	if (zipExtract($ZipFile,$_SERVER['DOCUMENT_ROOT'])) {
		
		$handle = fopen ('http://'.$_SERVER['HTTP_HOST'].'/update/bb.php', "rb"); 
                $contents = ""; 
                while (!feof($handle)) { 
                $contents = fread($handle, 8192); 
                } 
                fclose($handle); 
				if($contents=='1'){
				unlink("../update/tgyd.lock");
				$contents1=file_get_contents("http://".$_SERVER['HTTP_HOST']."/update/index.php");
				}
				else{
				
				}
				$upmsg = $contents1;
		$upcode = 0;
		unlink($ZipFile);
	}
	else {
		$upmsg = "无法解压文件";
		$upcode = 0;
	if (file_exists($ZipFile))
	unlink($ZipFile);
	}
	
}
function zipExtract ($src, $dest)
{
$zip = new ZipArchive();
if ($zip->open($src)===true)
{
$zip->extractTo($dest);
$zip->close();
return true;
}
return false;
}*/
//************************执行代码结束**************************

C('webtitle','网站升级');
include_once 'common.head.php';
?>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
			<h3 class="page-header">网站升级</h3>
			<div id="collapseset" class="panel-body collapse-xs">
							<form action="?" class="form-horizontal" method="post">
                            <input type="hidden" value="update" name="type" >
                            更新请留意全网各大破解交流论坛
									<label class="control-label"></label>
									<div class="form-group text-right"><input type="submit" name="submit" value="<?php if($upcode){echo '确定升级';}else{echo '返回首页';}?>" class="btn btn-danger"></div>
							</form>
						</div>
			
		</div>
<?php
include_once 'common.foot.php';
?>