www.gusucode.com > 搜一次CMS电影程序 PHP 1.5源码程序 > admin/admin_update.php
<?php /* '************************************************************************************************** ' 软件名称: 搜一次 Content Management System ' 版本编号: Version 1.X ' 官方网站: http://www.syccms.com ' 官方论坛:http://bbs.syccms.com ' 版权所有: 搜一次开发团队 无痕(QQ:512591) ' 法律顾问: 杭州市元茂律师事务所 严飞律师 ' 郑重声明: ' 1、任何个人或组织不得在未经授权的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息; ' 2、搜一次网络事业部保留此软件的法律追究权利 '************************************************************************************************** */ include "../include/conn.php"; include "../include/function.php"; include "admin_version.php"; include "admin_loginstate.php"; set_time_limit(0); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>后台程序升级</title> <script type="text/javascript" language="javascript">var tentpath='<?php echo S_SitePath?>';</script> <script src="js/jquery.js"></script> <script src="js/alerts.js"></script> <link href="images/alerts.css" rel="stylesheet" type="text/css" media="screen"/> <link href="images/style.css" rel="stylesheet" type="text/css" /> <script language="javascript"> $(document).ready(function(){ $("#ChkAll").click(function(){ if($(this).attr("checked")==true){ $("input[id='S_ID']").each(function(){ $(this).attr("checked",true); }) }else{ $("input[id='S_ID']").each(function(){ $(this).attr("checked",false); }) } }) $("#btn_update").click(function(){ if($("input[@type=checkbox]:checked").size()==0){ alert('请选择要升级的文件!'); return false; } $("#form1").submit(); }) }) </script> </head> <?php if(!remote_file_exists("http://vip.syccms.com/php/update.xml")){ die("对不起,载入远程升级文件出错!"); } for($ii=0;$ii<4;$ii++){ $UpdateContent=@file_get_contents("http://vip.syccms.com/php/update.xml"); if($UpdateContent) break; } if(!IsNul($UpdateContent)){ $UpdateContent=geturl("http://vip.syccms.com/php/update.xml"); } if(!file_exists("backup/log.txt")){ fwrite(fopen("backup/log.txt","wb"),""); } $Local=file_get_contents("backup/log.txt"); $FileInfoArr=explode(chr(13),$UpdateContent); $action=SafeRequest("action","get"); if($action=="update"){ $ID=RequestBox("S_ID"); $S_Path=$_SERVER['PHP_SELF']; $S_PathPos=strrpos($S_Path,'/'); $S_Path=substr($S_Path,0,$S_PathPos+1); $S_Path=substr($S_Path,strlen(S_SitePath)); $S_ID=explode(",",$ID); ?> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tb_style"> <tr> <td class="td_title" colspan="4"> 程序升级中...... </td> </tr> <?php for($k=0;$k<count($S_ID);$k++){ $FileArr2=explode('|',$FileInfoArr[$S_ID[$k]]); $FileArr2[0]=trim($FileArr2[0]); $S_FilePath="http://vip.syccms.com/php/".$FileArr2[0].""; if(!remote_file_exists($S_FilePath)){ echo ReplaceStr($FileArr2[0],".xml",".php")."远程文件不存在"; } else{ for($kk=0;$kk<4;$kk++){ $FileContent=@file_get_contents($S_FilePath); if($FileContent) break; } if(!IsNul($FileContent)){ $FileContent=geturl($S_FilePath); } } $FileArr2[0]=ReplaceStr($FileArr2[0],".xml",".php"); $FileArr2[0]=ReplaceStr($FileArr2[0],"admin/",$S_Path); if(S_Dvname!="video"){ $FileArr2[0]=ReplaceStr($FileArr2[0],"video/",S_Dvname."/"); } if(S_Dtname!="topic"){ $FileArr2[0]=ReplaceStr($FileArr2[0],"topic/",S_Dtname."/"); } if(S_Dnname!="article"){ $FileArr2[0]=ReplaceStr($FileArr2[0],"article/",S_Dnname."/"); } fwrite(fopen("../".$FileArr2[0],"wb"),$FileContent); if($Local==""){ $Local=$Local.$FileArr2[0]."|".$FileArr2[2]; } else{ $Local=$Local."\r\n".$FileArr2[0]."|".$FileArr2[2]; } ?> <tr> <td class="td_border" height="30"> <?php echo ($k+1)?></td> <td class="td_border"> <?php echo $FileArr2[0]?>(<?php echo $FileArr2[2]?>)</td> <td class="td_border"> <?php echo $FileArr2[1]?></td> <td align="center" class="td_border"> <font color="green">更新成功</font></td> </tr> <?php } fwrite(fopen("backup/log.txt","wb"),$Local); ?> <tr> <td class="td_border" colspan="4"> <input type="button" onclick="window.location='admin_update.php'" value="返回升级页面" class="rb1"></td> </tr> </table> <?php die(); } ?> <body> <div class="r_main"> <div class="r_content"> <div class="r_content_1"> <form action="?action=update" method="post" name="from1" id="form1"> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tb_style"> <tr> <td class="td_title" colspan="4"> 程序升级系统 </td> </tr> <tr> <td width="6%" height="30" class="td_border"> 选择</td> <td width="44%" class="td_border"> 文件名</td> <td width="38%" class="td_border"> 升级说明</td> <td width="12%" align="center" class="td_border">更新状态</td> </tr> <?php $S_Path2=$_SERVER['PHP_SELF']; $S_PathPos=strrpos($S_Path2,'/'); $S_Path2=substr($S_Path2,0,$S_PathPos+1); $S_Path2=substr($S_Path2,strlen(S_SitePath)); for($i=0;$i<(count($FileInfoArr));$i++){ $FileArr=explode('|',$FileInfoArr[$i]); $FileArr[0]=trim($FileArr[0]); $FileArr[0]=ReplaceStr($FileArr[0],".xml",".php"); $UpdatedFile=ReplaceStr($FileArr[0],"admin/",$S_Path2); $Local=ReplaceStr($Local,S_Dvname."/","video/"); $Local=ReplaceStr($Local,S_Dnname."/","article/"); $Local=ReplaceStr($Local,S_Dtname."/","topic/"); if(stristr($Local,$UpdatedFile."|".$FileArr[2])){ $IsUpdate="<font color=green>文件已更新</font>"; } else{ $IsUpdate="<font color=red>文件未更新</font>"; } $FileArr[0]="../".$FileArr[0]; ?> <tr> <td class="td_border" height="30"> <input type="checkbox" class="checkbox" name="S_ID[]" id="S_ID" value="<?php echo $i?>"><?php echo ($i+1)?></td> <td class="td_border"> <?php echo $FileArr[0]?>(<?php echo $FileArr[2]?>)</td> <td class="td_border"> <?php echo $FileArr[1]?></td> <td align="center" class="td_border"> <?php echo $IsUpdate?></td> </tr> <?php } ?> <tr> <td colspan="4" class="td_border" height="30"> <input type="checkbox" class="checkbox" id="ChkAll"> 全选 <input type="submit" value="开始更新文件" class="rb1" id="btn_update"></td> </tr> <tr> <td colspan="4" class="td_border" height="30"> <font color='red'>* 注意:为了防止出现意外错误,自动更新前请先做好文件备份!</font></td> </tr> </table> </form> </div> </div> </div> <?php include "admin_bottom.php" ?> </body>