<% @ LANGUAGE=VBScript%>
<%
'*** Check Browser type for proper buttons formating.
brType = request.servervariables("http_user_agent")
If InStr(LCase(brType), "mozilla/4") <> 0 And InStr(LCase(brType), "msie") = 0 Then NC4x = True
msgStatus = "Note: Your IP Address will be recorded as you submit."
colorStatus = "#FFCC00"
ErrBgrColor = "#000000"
ErrFontColor = "#000000"
ErrHead = ""
hLink = ""
sep = chr(164)
'*** At Submit evaluates the input. If name or comment is not specified error is raised. If Email does not contain "@" or "."
'*** error is raised. If URL is less than 10 characters field is ignored.
'*** If no errors are raised then function Save_Record is called.
Flag = Request.form("submitFlag")
IF Flag = 1 THEN
Name = Trim(Request.form("fName"))
Email = Trim(Request.form("fEmail"))
URL = Trim(Request.form("fURL"))
IP = Request.ServerVariables("REMOTE_ADDR")
IF Len(URL) < 10 then URL = ""
Comment = Trim(Request.form("fComment"))
Comment = server.HTMLencode(Comment)
Comment = REPLACE(Comment,VbCrlf,"
")
IF Name = "" then ShowError: ErrMsg = "
" & "* Name must be specified." _
: ErrTrue = True : msgStatus = "Please Fix Errors and Resubmit." : colorStatus ="#FF0000"
IF Comment = "" then
ErrMsg = ErrMsg & "
" & "* You forgot to state your Comment."
IF Not ErrTrue then ShowError :msgStatus = "Please Fix Errors and Resubmit." : colorStatus ="#FF0000"
ErrTrue = True
End If
IF Not Email = "" then
IF Instr(Email, "@") = 0 Or Instr(Email, ".") = 0 then
ErrMsg = ErrMsg & "
" & "* You typed an invalid Email."
IF Not ErrTrue then ShowError : msgStatus = "Please Fix Errors and Resubmit." : colorStatus ="#FF0000"
ErrTrue = True
End IF
End IF
IF Not ErrTrue then
Call Save_Record(Name, Email, URL, Comment, IP)
msgStatus = "I do appreciate your comment !" : colorStatus ="#66CCFF"
End IF
End If
'*** Function opens record file on the server (creates if not exists). File located in "\db" folder off the root.
'*** Then appends a line at the end of file. Line contains fields data + IP address
'*** of the client, separated by a special character. IP address displayed only at the administration page.
Function Save_Record(Name, Email, URL, Comment, IP)
Set objFile = CreateObject("Scripting.FileSystemObject")
dbFile = server.mappath("db\guestrecord.txt")
If objFile.FileExists(dbFile) Then
Set recordSet=objFile.OpenTextFile(dbFile, 8, False)
Else: Set recordSet=objFile.CreateTextFile(dbFile, 2, False)
End if
recordSet.writeline Now & sep & Name & sep & Email & sep & URL & sep & Comment & sep & IP
recordSet.Close
End Function
Function ShowError()
ErrFontColor = "#FF0000"
hLink = "Go Back"
ErrHead = "Detected Errors:"
End Function
%>
Welcome to Guest Bookمرحبا بكم في دفتر الزوار
جميع الحقوق البرمجية محفوظة ـ مركز سنديان الإعلامي ـ
سورية ـ اللاذقية
©2007www.gccs-lattakia.com.sy.com - All Rights Reserved