%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
' 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.
' ======================================
Option Explicit
Dim adoCon, objCon, appVers
' need this ---^
Dim admLogin, admPass, strError, getAdmin, strSQL, strID, strIDSQL
%>
<%
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"
%>
<%
If Request.ServerVariables("CONTENT_LENGTH") <> 0 Then
admLogin = Trim(Request.Form("login"))
admPass = Trim(Request.Form("pass"))
If Len(admLogin) = 0 Then
strError = "Missing login."
End If
If Len(admPass) = 0 Then
strError = strError & "
Missing Password"
End If
If Len(strError) = 0 Then
' Check if user and password are correct
Set getAdmin = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM admin WHERE admin_login='" & admLogin & "' AND admin_pass='" & admPass & "'"
getAdmin.Open strSQL, objCon
While Not getAdmin.EOF
If admLogin = getAdmin("admin_login") Then
If admPass = getAdmin("admin_pass") Then
Session("admin") = getAdmin("admin_login")
Session("pass") = getAdmin("admin_pass")
strIDSQL = "UPDATE admin SET sid=" & Session.SessionID & ""
objCon.Execute strIDSQL
Response.Redirect("admin_area.asp?id=" & getAdmin("ID") & "")
Else
strError = "Password does not match"
End If
Else
strError = strError & "
Login does not match"
End If
Wend
getAdmin.Close
End If
End If
%>
Guestbook Login <%= appVers %>