DEMOCRACY & LEGAL SYSTEM

政治  法律  伦理  社会  综合性新闻半月刊
中 国 法 律 类 核 心 期 刊
地址:北京市西城区兵马司胡同63号 邮编:100034
 

杂志选登

  机构设置
  光辉历史
  广告工作
  发行工作
  欢迎投稿


选 择刊

请选择年份:

请选择期号:

首届国家期刊奖
第二届百种全国重点社科期刊
中国期刊方阵双奖期刊
第二届国家期刊奖百种重点期刊
指点江山

    

北京
欢迎你

 
本刊总邮箱:mzyfz@mzyfz.com.cn
<% '结合IP地址验证和时间控制,防止通过刷新和短时间登录增加访问量 '自动建立文件夹 'Total 总访问人数变量(可与月访问量累加数对照) 'CountFile 需要打开的文件设置 'M_Count 月访问量(累加每日记录) ' 'Day_FileName_X 日记录文件名 'Day_File_Path_X日记录文件路径 'Mon_FileName_X 月记录文件名 'Mon_FilePath_X月记录文件路径 'Tot_FileName_T 总记录文件名 'Tot_File_Path 总记录文件路径 'File_Day 日记录文件对象 'File_Mon 月记录文件对象 'File_Tot 总记录文件对象 ' ' ' '************************************************************************ '日记录,月记录,总访问量记录的路径及存盘文件名 * '************************************************************************ set CountFile = Server.CreateObject("Scripting.FileSystemObject") Folder_Path = Server.MapPath("index_1.asp") Folder_Path = Replace (Folder_Path,"index_1.asp","") & "Count_File" '建立保存记录文件夹 if not CountFile.FolderExists (Folder_Path) then Set Count_folder = CountFile.CreateFolder(Folder_Path) CreateFolderDemo = Count_folder.Path End if '取前天、昨天、今天、上上月、上月、本月做为保存记录的文件名 Day_FileName_3 = "D_" & day(now-3) & ".txt" Day_FileName_2 = "D_" & day(now-2) & ".txt" Day_FileName_1 = "D_" & day(now-1) & ".txt" Day_FileName_0 = "D_" & day(now-0) & ".txt" select case month(now) case 2 Mon_FileName_2 = "M_" & 12 & ".txt" Mon_FileName_1 = "M_" & 1 & ".txt" Mon_FileName_0 = "M_" & 2 & ".txt" case 1 Mon_FileName_2 = "M_" & 11 & ".txt" Mon_FileName_1 = "M_" & 12 & ".txt" Mon_FileName_0 = "M_" & 1 & ".txt" case else Mon_FileName_2 = "M_" & month(now)-2 & ".txt" Mon_FileName_1 = "M_" & month(now)-1 & ".txt" Mon_FileName_0 = "M_" & month(now)-0 & ".txt" end select Tot_FileName_T = "Total.txt" '设置文件存取路径 Day_File_Path_3 = Server.MapPath("count_file\" & Day_FileName_3) Day_File_Path_2 = Server.MapPath("count_file\" & Day_FileName_2) Day_File_Path_1 = Server.MapPath("count_file\" & Day_FileName_1) Day_File_Path_0 = Server.MapPath("count_file\" & Day_FileName_0) Mon_File_Path_2 = Server.MapPath("count_file\" & Mon_FileName_2) Mon_File_Path_1 = Server.MapPath("count_file\" & Mon_FileName_1) Mon_File_Path_0 = Server.MapPath("count_file\" & Mon_FileName_0) Tot_File_Path = Server.MapPath("count_file\" & Tot_FileName_T) ' ' '************************************************************************ '初始化设置 建立昨天记录文件 * '************************************************************************ '如果不存在昨天记录文件则建立,存入初始值 if not CountFile.FileExists (Day_File_Path_1) then set File_Day = CountFile.CreateTextFile(Day_File_Path_1,true) File_Day.close set File_Day = nothing end if '如果不存在前天记录文件则建立 if not CountFile.FileExists (Day_File_Path_2) then set File_Day = CountFile.CreateTextFile (Day_File_Path_2,true) File_Day.close set File_Day = nothing end if '如果不存在总访问量记录文件则建立,存入初始值 *** if not CountFile.FileExists (Tot_File_Path) then set File_Tot = CountFile.CreateTextFile (Tot_File_Path,true) File_Tot.close set File_Tot = nothing set File_Tot = CountFile.OpenTextFile(Tot_File_Path,2) File_Tot.WriteLine 333 File_Tot.close set File_Tot = nothing end if '如果不存在本月记录文件则建立,存入初始值 *** if not CountFile.FileExists (Mon_File_Path_0) then set File_Mon = CountFile.CreateTextFile(Mon_File_Path_0,true) File_Mon.close set File_Mon = nothing set File_Mon = CountFile.OpenTextFile(Mon_File_Path_0,2) File_Mon.WriteLine 0 File_Mon.close set File_Mon = nothing end if '如果不存在上月记录文件则建立 if not CountFile.FileExists (Mon_File_Path_1) then set File_Mon = CountFile.CreateTextFile(Mon_File_Path_1,true) File_Mon.close set File_Mon = nothing end if ' ' ' '************************************************************************ '处理月记录文件 * '************************************************************************ '如果是新的月而且不存在本月记录文件,新建本月记录文件,**不**删除上上月记录文件 if Day(now) = 1 and not CountFile.FileExists (Mon_File_Path_0) then '新建本月记录文件 set File_Mon = CountFile.CreateTextFile (Mon_File_Path_0,true) File_Mon.close set File_Mon = nothing '为累加本月访问量设初始值 set File_Mon = CountFile.OpenTextFile(Mon_File_Path_0,2) File_Mon.WriteLine 0 File_Mon.close set File_Mon = nothing '删除上上月记录文件 'if CountFile.FileExists (Mon_File_Path_2) then 'CountFile.DeleteFile (Mon_File_Path_2) 'end if end if '如果不存在本日记录文件,新建本日记录文件,删除前日记录 if not CountFile.FileExists (Day_File_Path_0) then '新建今日记录文件 set File_Day = CountFile.CreateTextFile (Day_File_Path_0,true) File_Day.close set File_Day = nothing '删除前天记录文件 if CountFile.FileExists (Day_File_Path_3) then CountFile.DeleteFile (Day_File_Path_3) end if 'Application清零,重新计数 Application.Lock Application("n") = 0 Application.unLock end if ' ' ' '************************************************************************ '日常工作,每次刷新都必须做的事情 * '************************************************************************ '访问量加1 Application.Lock Application("n") = Application("n") + 1 Application.UnLock '累加到月记录文件中 '读本月记录文件数据 set File_Mon = CountFile.OpenTextFile (Mon_File_Path_0,1) Month_Count = File_Mon.ReadLine File_Mon.close set File_Mon = nothing '累加后存入本月记录文件 set File_Mon = CountFile.OpenTextFile (Mon_File_Path_0,2) Month_Count = Month_Count + 1 File_Mon.WriteLine Month_Count File_Mon.close set File_Mon = nothing '累加到总记录文件中 '读总记录文件数据 set File_Tot = CountFile.OpenTextFile (Tot_File_Path,1) Total = File_Tot.ReadLine File_Tot.close set File_Tot = nothing '累加后存入总记录文件 set File_Tot = CountFile.OpenTextFile (Tot_File_Path,2) Total = Total + 1 File_Tot.WriteLine Total File_Tot.close set File_Tot = nothing '读月计数 set File_Mon = CountFile.OpenTextFile (Mon_File_Path_0,1) Month_Count = File_Mon.Readline File_Mon.close set File_Mon = nothing '读总计数 set File_Tot = CountFile.OpenTextFile (Tot_File_Path,1) ToTal = File_Tot.Readline File_Tot.close set File_Tot = nothing %>