计数器|控制|流量|计数器|流量Relaxlife.net最强计数器-利用操作INI文件来控制流量,也可用做系统设置
最强计数器-利用操作INI文件来控制流量,也可用做系统设置
Function.asp
<%
Rem =================================================================
Rem = 函数文件:Function.asp
Rem = 测试文件:IniProFile.asp
Rem = 说明:setProfile写入INI文件函数,GetProfile读INI文件函数
Rem = Revision:1.01 Beta
Rem = 作者:熊氏英雄(cexo255)
Rem = Date:2005/04/22 02:00:00
Rem = QQ:30133499
Rem = MySite:Http://www.Relaxlife.net
Rem = 测试地址:http://www.relaxlife.net/2005/relaxlife/blogview.asp?logID=157
Rem = 下载地址:http://www.relaxlife.net/2005/relaxlife/blogview.asp?logID=157
Rem = QQ群:4341998
Rem = 适用:和Delphi操作INI文件一样简单,最好是用在统计访问量,读写速度非常的快。
Rem = 下版本预计改进:不能删除数据项和修改数据项,对数据的操作很全。
Rem =================================================================
Function ReadFile(FileName)
Dim fso, f
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(Server.MapPath(FileName), ForReading, True)
On Error Resume Next
ReadFile = f.ReadAll
If Err Then
err.Clear: f.Close: :ReadFile = "" :Exit Function
End if
f.Close
End Function
Sub WriteFile(FileName,Str)
Dim fso, f
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(Server.MapPath(FileName), ForWriting, True)
f.Write Str
f.Close
End Sub
’返回值1 为操作成功
Function setProfile(strFileName, strSection, strName, strSave)
Dim strTemp, strfileback, strreturn,EditFlag,Flag:Flag = True
strfileback = "me.tmp"
strTemp = ReadFile(strFileName)
If InStr(1,strTemp,"["&Trim(strSection)&"]")=0 Then
If strTemp<>"" Then
WriteFile strFileName,strTemp & vbCrlf & "[" & Trim(strSection) & "]" & vbCrlf & Trim(strName) & "=" & strSave & vbCrlf
Else
WriteFile strFileName,strTemp & "[" & Trim(strSection) & "]" & vbCrlf & Trim(strName) & "=" & strSave & vbCrlf
End if
setProfile = 1
Exit
Relaxlife.net最强计数器-利用操作INI文件来控制流量,也可用做
80酷酷网 80kuku.com