推薦:asp簡單文本計(jì)數(shù)器% Set fs = CreateObject(Scripting.FileSystemObject) Wfile=server.mappath() cgi-binwww.111cn.cn/asp/asp.html.txt on error resume next Set a = fs.OpenTextFile(Wfile) hits = Clng(a.ReadLine) hits = hits + 1 a.close if error then hits = 1 end if Set a =
下面我們就來看看實(shí)例教程吧.
先來看看提交的頁面:
<FORM ACTION="saveinfo.asp" METHOD=post>
<!-- Your fields here -->
<INPUT TYPE=submit value="Submit">
</FORM>
下面看看接收數(shù)據(jù)并保存的頁面.
<%
Set fs = CreateObject("Scripting.FileSystemObject")
Folderpath=server.mappath("") & "/cgi-bin/messages143718"
Wcounter=Folderpath &"/counter.txt"
Set fs = CreateObject("Scripting.FileSystemObject")
if fs.FolderExists(Folderpath) then
Set a = fs.OpenTextFile(Wcounter)
hits = Clng(a.ReadLine)
hits = hits + 1
a.close
else
Set a = fs.CreateFolder(Folderpath)
hits=1
end if
Set a = fs.CreateTextFile(Wcounter,True)
a.WriteLine(hits)
a.Close
Set fs=nothing
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile(Folderpath & "" & hits & ".txt")
For Each x In Request.Form
a.WriteLine(x &": " & Request.Form(x))
Next
a.Close
Set a=nothing
Set fs=nothing
%>
分享:asp 在線人數(shù)統(tǒng)計(jì)代碼只要復(fù)制代碼表中到一個(gè)文本文件并將其保存在主目錄中的網(wǎng)站( / Global.asa中 ) 。 SCRIPT LANGUAGE=VBScript RUNAT=Server Sub Application_OnStart application(activevisitors)=0 End Sub Sub Application_OnEnd End Sub Sub Session_OnStart application.lock ap
新聞熱點(diǎn)
疑難解答
圖片精選