ASP被修改自动恢复备份
作者:cmscn 日期:2010-05-10
<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>
评论: 0 | 引用: 0 | 查看次数: 585
发表评论