%@ Language=VBScript %>
<%
Sample_File = "https://www.angelfire.com/alt2/freestyle/123.htm"
%>
<%
' GuestBook / Adam Liwski - 14/01/01
'------------------------------------
' script like this and many more are available at : www.ASP.org.il
'
'
'
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
ACTION = Request.Form("action")
If ACTION = "add_msg" Then
UserName = HebrewEncode(Request.Form("user"))
EMail = HebrewEncode(Request.Form("email"))
MsgText = Replace(HebrewEncode(Request.Form("msgtxt")),vbCrlf,"
")
Set TextFile = FSO.OpenTextFile(Sample_File,1,False)
if NOT TextFile.AtEndOfStream Then OldText = TextFile.ReadAll
TextFile.Close
Set TextFile = FSO.OpenTextFile(Sample_File,2,True)
TextFile.Write OldText
TextFile.Write UserName & ";" & EMail & vbCrlf
TextFile.Write MsgText & vbCrlf
TextFile.Write "~" & vbCrlf
TextFile.Close
Set TextFile = Nothing
Set FSO = Nothing
Response.Redirect Request.ServerVariables("Script_Name")
End if
Function HebrewEncode(txt)
Dim i, ch, AsciiCode
HebrewEncode = ""
For i = 1 to len(txt)
ch = mid(txt,i,1)
AsciiCode = asc(ch)
if AsciiCode < 224 or AsciiCode > 250 then ch = server.htmlEncode(ch)
HebrewEncode = Replace(HebrewEncode,"~","")
HebrewEncode = Replace(HebrewEncode,";","")
HebrewEncode = HebrewEncode & ch
Next
End Function
%>
Text-Based GuestBook
ספר אורחים
<%
i = 1
Set TextFile = FSO.OpenTextFile(Sample_File,1,True)
While Not TextFile.AtEndOfStream
Name = TextFile.ReadLine
Email = Right(Name,Len(Name)-InStr(1,Name,";"))
Name = Left(Name,InStr(1,Name,";")-1)
MessageText = TextFile.ReadLine
While Right(MessageText,1) <> "~"
MessageText = MessageText & TextFile.ReadLine
Wend
Response.Write ""
Response.Write " | "
if i mod 3 = 0 Then Response.Write "
"
i = i + 1
Wend
TextFile.Close
Set FSO = Nothing
%>
הוספת הודעה