%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim oldPost, newSQL, adoCon, objCon, appVers
%>
<%
Set objCon = Server.CreateObject("ADODB.Connection")
' database connection, Access database
' ------------------------------------
' Be sure this is the path to the database, if you have
' just uploaded this guestbook then it will be in the data folder
adoCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("./db/guestbook.mdb")
objCon.Open adoCon
' SQL Fix function
Function SQLFix(str)
If Trim(str) = "" Then
SQLFix = NULL
Else
SQLFix = Trim(str)
End If
End Function
appVers = "1.01 Beta"
%>
<%
' Guestbook from Winn.ws
' Need help? Help is free from Winn.ws
' Just email me at greg@winn.ws let me know what version you have.
' ======================================
Dim strName, strEmail, strComments, strLocation, srtError, addPost, Access
%>
<%
Set objCon = Server.CreateObject("ADODB.Connection")
' database connection, Access database
' ------------------------------------
' Be sure this is the path to the database, if you have
' just uploaded this guestbook then it will be in the data folder
adoCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("./db/guestbook.mdb")
objCon.Open adoCon
' SQL Fix function
Function SQLFix(str)
If Trim(str) = "" Then
SQLFix = NULL
Else
SQLFix = Trim(str)
End If
End Function
appVers = "1.01 Beta"
%>
<%
' add new post to database
If Request.ServerVariables("CONTENT_LENGTH") <> 0 Then
' Trim all the Post's
strName = Trim(Request.Form("name"))
strEmail = Trim(Request.Form("email"))
strComments = Trim(Request.Form("comments"))
strLocation = Trim(Request.Form("location"))
' Do checks
If Len(strName) = 0 Then
srtError = "Missing Name"
End If
If Len(strEmail) = 0 Then
srtError = srtError & "
Missing email address"
End If
If Len(strComments) = 0 Then
srtError = srtError & "
Missing comments"
End If
If Len(strLocation) = 0 Then
srtError = srtError & "
Missing location"
End If
' if all is good post to database else print the errors
If Len(srtError) = 0 Then
Set addPost = Server.CreateObject("ADODB.Recordset")
Access = "SELECT * FROM comments"
addPost.Open Access, objCon, 2, 3
addPost.AddNew
addPost("name") = SQLFix(strName)
addPost("email") = SQLFix(strEmail)
addPost("comment") = SQLFix(strComments)
addPost("location") = SQLFix(strLocation)
addPost("status") = 1
addPost("date_entered") = Date()
' close the insert
addPost.Update
addPost.Close
End If
End If
%>
![]() |
||
|
||
![]() |
|
|
|
|||||||||||
|
|||||||||||||