webForumDet fria alternativet

Count + FSO

ASPur ASP

0 svar · 192 visningar · startad av Asa

Medlem sedan dec. 20011 860 inlägg
Frågan#1

Har denna kod.Men vill att bara 500 rader skall sparas till en xtxfil. Sen ska de gamlaste raderna skrivas över.

<!--#Include file="top.asp"-->

<meta http-equiv="refresh" content="10">
<body>

<%If Not fso.FileExists(Server.MapPath("chat.txt")) Then
Set fil = fso.CreateTextFile(Server.Mappath("chat.txt"), true)
fil.WriteLine(Day(Now) & "/" & Month(Now) & "-" & FormatDateTime(Now,4) & " | <i><b>" & Session("user") & "</b> har loggat in</i>")
End If
set fil = fso.OpenTextFile(Server.Mappath("chat.txt"), 1 )
arrFsoLines = Split(fil.ReadAll, vbcrlf)

For i = ubound(arrFsoLines) To 0 step -1%>
<%=arrFsoLines(i)%><br>
<%Next

fil.Close

If Request.QueryString("do") = "skapa" Then

Info = Day(Now) & "/" & Month(Now) & "-" & FormatDateTime(Now,4) & " | <b>" & Session("user") & "</b> - " & Replace(Request.Form("info"), vbcrlf, "")

Set fso = CreateObject("Scripting.FileSystemObject")
Set fil = fso.OpenTextFile(Server.Mappath("chat.txt"), 8 )

fil.WriteLine(Info)

fil.close
Response.Redirect "mess.asp"
End If%>

</body>
</html>

130 ms totalt · 3 externa anrop · v20260731065814-full.25f56b17
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
127 ms — hämta tråd, inlägg och bilagor (db)