ASP被修改自动恢复备份


<html>
<head><title>bak</title>
<script language="JavaScript">
function myrefresh(){
   window.location.reload();
}
setTimeout('myrefresh()',1000); //指定1秒刷新一次
</script>
</head>
<body>

<%
response.write"<span style='color:red;'>现在是:"
response.write(year(now())&"年"&month(now())&"月"&day(now())&"日"&hour(now())&"时"&minute(now())&"分"&Second(now())&"秒<br></span>")
Set objFileObj = CreateObject("Scripting.FileSystemObject")
sFile ="C:\inetpub\wwwroot\index.asp"
Set objFile = objFileObj.GetFile(sFile)
response.write"<br>"
response.write"<br>"
response.write"管理员设定的时间:2008-5-21 12:28:59<span style='color:red;font-size:12px;'>   如果和最后一次修改时间不一样,程序将启动安全行为,时时还原!</span><br>"
response.write"<br>"
response.write"<br>"
Response.Write("首页最后一次修改时间:"&objFile.DateLastModified )
dt=cdate("2010-3-27 22:31:22")
response.write"<br>"
response.write"<br>"
response.write"<br>"
if DateDiff( "s", dt,objFile.DateLastModified )>3 then
response.Write"时间不一样了,相差"
response.write("<span style='color:red;'>"&DateDiff( "s", dt,objFile.DateLastModified )&"</span>")
response.write"秒"
response.write"<br>"
response.write"<br>"
response.write"<br>程序将自动把还原备份文件"
objFileObj.CopyFile "C:\inetpub\wwwroot\1.gif","C:\inetpub\wwwroot\index.asp"
txtname=replace(now(),"-","")
cc=cstr(txtname)&".txt"
Set   MyFile=objFileObj.CreateTextFile("c:\zs.txt")
MyFile.WriteLine("首页被修改记录")
MyFile.close
else
response.write"页面正常"
end if
%>
</body>
</html>

文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: 自动 备份
相关日志:
评论: 0 | 引用: 0 | 查看次数: 585
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 20 字 | UBB代码 关闭 | [img]标签 关闭