Sure. The client did not provide the line number of the error. I am afraid I
will have to show you the entire code page - I apologize in advance if my
coding is too verbose and cluttered. I realise better programmers whould
have have used less more elegant code..
I am using the 'browserhawk' component for browser and cookie sniffing.
<%
Const adCmdTable = &H0002
Const adCmdStoredProc = &H0004
'---- ParameterDirectionEnum Values ----
Const adParamUnknown = &H0000
Const adParamInput = &H0001
Const adParamOutput = &H0002
Const adParamInputOutput = &H0003
Const adParamReturnValue = &H0004
'---- DataTypeEnum Values ----
Const adEmpty = 0
Const adTinyInt = 16
Const adSmallInt = 2
Const adInteger = 3
Const adBigInt = 20
Const adUnsignedTinyInt = 17
Const adUnsignedSmallInt = 18
Const adUnsignedInt = 19
Const adUnsignedBigInt = 21
Const adSingle = 4
Const adDouble = 5
Const adCurrency = 6
Const adDecimal = 14
Const adNumeric = 131
Const adBoolean = 11
Const adError = 10
Const adUserDefined = 132
Const adVariant = 12
Const adIDispatch = 9
Const adIUnknown = 13
Const adGUID = 72
Const adDate = 7
Const adDBDate = 133
Const adDBTime = 134
Const adDBTimeStamp = 135
Const adBSTR = 8
Const adChar = 129
Const adVarChar = 200
Const adLongVarChar = 201
Const adWChar = 130
Const adVarWChar = 202
Const adLongVarWChar = 203
Const adBinary = 128
Const adVarBinary = 204
Const adLongVarBinary = 205
const SITENAME = "
www.catamarans.com"
const HOMEPAGE = "<H3><font color=blue>CATAMARANS</font>.COM MEMBERSHIP
PAGE</H3>"
function OutputHeader()
OutputHeader="<H2>" & HOMEPAGE & "</H2>"
end function
function GetConnection()
const DSN = "V032U10DUW"
const UID = "V032U10DUW"
const PASSWORD = "cU3QmtgDyzWX"
Dim p_oConn, sDSN
Set p_oConn = server.createObject("ADODB.Connection")
'//sDSN = "DSN=" & DSN & ";uid=" & UID & ";password=" & PASSWORD
'//sDSN.open = "driver={SQL
Server};server=MAXSQL00?.maximumasp.com;DB=yourSQLDBName;UID=yourSQLLogin;PW
D=YourSQLPassword"
p_oConn.open "driver={SQL
Server};server=MAXSQL008.maximumasp.com;DB=V032U10DUW;UID=V032U10DUW;PWD=cU3
QmtgDyzWX"
Set GetConnection = p_oConn
end function
function GetStoredProcedure(oConnection, sName)
Dim oCmd
Set oCmd = Server.createobject("ADODB.Command")
Set oCmd.ActiveConnection = oConn
oCmd.CommandText = sName
oCmd.CommandType = adCmdStoredProc
Set GetStoredProcedure = oCmd
end function
Dim strs, strLen, ParDirLen, SubPathLen, Mystring
function stripParentDirectory(u_CurrentURL)
stripParentDirectory = u_CurrentURL
if instr(u_CurrentURL, "/") <> instrRev(u_CurrentURL, "/") then
strs = split(u_CurrentURL, "/")
stripParentDirectory = strs(1)
end if
end function
'STRIP SUB PATH AFTER PARENT DIRECTORY AND CREATE CORRECT URL
Function stripSubPath(ParentDir, u_CurrentURL)
strLen = len(u_CurrentURL)
'//response.write "<br><br>Total String Length:" & strLen & "<br><br>"
ParDirLen=len(ParentDir) + 2 '//add slash x 2
'//response.write "<br><br>Parent Dir Length:" & ParDirLen & "<br><br>"
SubPathLen= strLen - ParDirLen
'//response.write "<br><br>SubPath Length:" & SubPathLen & "<br><br>"
'//Response.write SubPathLen
MyString= Right(u_CurrentURL,SubPathLen)
MyString = "
http://www." & ParentDir & ".com/" & MyString
stripSubPath =MyString
End Function
<!--#INCLUDE VIRTUAL= "/catamaranco/join/utility.asp"-->
<% set bh = Server.CreateObject("cyScape.browserObj")
checkType = 3
if checkType = 3 then
bh.SetExtProperties "cookie_both,referrer"
elseif checkType = 2 then
bh.SetExtProperties "cookie_sess"
elseif checkType = 1 then
bh.SetExtProperties "cookie_perm"
else
response.write "<html>bad checkType specified</html>"
response.end
end if
bh.GetExtPropertiesEx
'------------------------------
'COOKIES= DISABLED/TURNED OFF
'-----------------------------
u_CurrentURL = Request.ServerVariables("URL")
If u_CurrentURL ="" then
u_CurrentURL ="unknown"
End If
u_VisitorIP = request.ServerVariables("remote_addr")
If u_VisitorIP ="" then
u_VisitorIP ="unknown"
End If
u_Referer = request.ServerVariables("HTTP_REFERER")
If u_Referer ="" then
u_Referer ="unknown"
End If
u_Browser = request.ServerVariables("HTTP_USER_AGENT")
If u_Browser ="" then
u_Browser ="unknown"
End If
u_FromURL=bh.Referrer
If u_FromURL="" then
u_FromURL=Request.servervariables("Remote_Host")
End If
If u_FromURL="" then
u_FromURL="Unknown"
End If
if not bh.cookies then %>
<p><ul><b>Your browser does not support cookies.</b></ul>
<%
'//FromURL = Bh.Referrer
response.redirect "/catamaranco/join/?CookieChk=Unsupported"
'//&FromURL=" & FromURL
else
'---------------------------------------------
'COOKIES= TRUE or Logged in WITHOUT cookies = TRUE
'---------------------------------------------
if bh.cookiesEnabled THEN 'or Request("vID") then '//cookies enabled
'---------------------------------------------
'Check if Cookie there....
'---------------------------------------------
If request.Cookies("Prospect")("u_id") or Request("vID") Then
vID=request("vID")
u_id=request.cookies("Prospect")("u_id")
u_CurrentURL=request.servervariables("URL")
set oConn = GetConnection()
If vID <> "" then '// no cookie, but ID is present
CookieBln=0
'//retrieve user database details as cookies not present
u_id=Request("vID")
u_FromURL=Request("u_FromURL")
u_CurrentURL=Request.servervariables("URL")
Set oCmd = GetStoredProcedure(oConn,"sp_GetUser")
oCmd.Parameters.append oCmd.CreateParameter("u_id", adInteger,
adParamInput,10,u_id)
set oRS = oCmd.execute()
if oRS.eof then
Response.Write("You do not appear to be in our database")
else
u_name=escapeString(oRS.fields("u_name"))
end if
Else '//Cookie present, but no VID
CookieBln=1
u_name = request.Cookies("Prospect")("u_name")
End If
Set oCmd = GetStoredProcedure(oConn,"spr_logonuser")
oCmd.Parameters.append oCmd.CreateParameter("u_name", adVarChar,
adParamInput,50,u_name)
'oCmd.Parameters.append oCmd.CreateParameter("u_password",
adVarChar, adParamInput,12,spassword)
set oRS = oCmd.execute()
if oRS.eof then
sError = "<BR>We have a cookie ID but no record in the
database. You may have been deleted from database<br><br>"
else '//SUCCESSFUL
Dim u_id, document, CookieBln, u_createDate, u_ExpiryDate,
DateToday, OverdueDays
u_id = oRS.fields("u_id")
'//u_createDate =oRS.fields("u_createDate")
u_ExpiryDate= oRS.fields("u_ExpiryDate")
If DATEDIFF("d",u_ExpiryDate,NOW()) >= 0 then
'//*** REGISTRATION HAS EXPIRED
response.write "<p><strong>[TODAY'S DATE]:</strong> " &
DateToday
response.write "<br><br><strong>Datebase Expiration
Date</strong>:" & u_ExpiryDate & "<br><br>"
response.write "Your registration has <font size=3 color=red
face=verdana>expired</font>. You will need to update "
'//response.write "Your expiration is overdue by" &
OverdueDays & " days<br><br>"
document = "/catamaranco/join/Update2.asp?u_CurrentURL=" &
u_CurrentURL & "&u_FromURL=" & u_FromURL
'//response.write "<br><br>" & document & "<br><br>"
response.redirect document
End If
End If
Sub WriteVariables
Response.write "<p>CookieBln= " & CookieBln & "<p>"
Response.write "u_FromURL: " & u_FromURL & "<br>"
Response.write "u_CurrentURL: " & u_CurrentURL & "<BR>"
Response.write "Prospect expiry date: " & ExpDate & "<br>"
Response.write "Prospect ID: " & u_id & "<br>"
Response.write "Prospect USERNAME: " & u_name & "<br>"
Response.write "Prospect VisitorIP: " & u_VisitorIP & "<br>"
End Sub
'//response.end
'//INSERT INTO USERPATH
Set oCmd = GetStoredProcedure(oConn,"spr_addUserPath")
oCmd.Parameters.append oCmd.CreateParameter("u_id", adInteger,
adParamInput,4,u_id)
oCmd.Parameters.append oCmd.CreateParameter(" u_name", adVarChar,
adParamInput,70, u_name)
oCmd.Parameters.append oCmd.CreateParameter("UserIP", adVarChar,
adParamInput,20, u_VisitorIP)
oCmd.Parameters.append oCmd.CreateParameter("URLFrom", adVarChar,
adParamInput,100,u_FromURL)
oCmd.Parameters.append oCmd.CreateParameter("URLCurrent", adVarChar,
adParamInput,100,u_CurrentURL)
oCmd.Parameters.append oCmd.CreateParameter("u_browser", adVarChar,
adParamInput,100,u_browser)
oCmd.Parameters.append oCmd.CreateParameter("u_Cookies", adInteger,
adParamInput,4,CookieBln)
'//oCmd.Parameters.append oCmd.CreateParameter("u_OS", adVarChar,
adParamInput,100,u_OS)
'//set oReturn = oCmd.CreateParameter("u_id", adInteger,
adParamOutput)
'//oCmd.Parameters.append oReturn
'<!--#include file="EmailLoginUser.asp"-->
oCmd.execute()
Else
'---------------------------------------------
'..COOKIE DELETED
'---------------------------------------------
Response.write "<br><br>CookieID should not be present..<br>"
u_FromURL=bh.Referrer
If u_FromURL="" then
u_FromURL=Request.servervariables("Remote_Host")
If u_FromURL="" then
u_FromURL="Unknown"
End If
End If
u_CurrentURL=Request.Servervariables("URL")
'//response.write u_CurrentURL
'response.write u_FromURL
'response.end
Response.redirect
"/catamaranco/join/logon.asp?CookieChk=Deleted&u_FromURL=" & u_FromURL &
"&u_CurrentURL=" & u_CurrentURL
End If
else
'---------------------------------------------
'SUPPORTS COOKIES BUT Disabled
'---------------------------------------------
u_FromURL=bh.Referrer
If u_FromURL="" then
u_FromURL=Request.servervariables("Remote_Host")
If u_FromURL="" then
u_FromURL="Unknown"
End If
End If
If u_CurrentURL="" then
u_CurrentURL=Request.servervariables("URL")
If u_CurrentURL="" then
u_CurrentURL="Unknown"
End If
End If
'response.write u_FromURL
'response.write "<b>Cookies disabled<br>"
'//response.write
"catamaranco/join/logon.asp?CookieChk=Disabled&FromURL=" & u_FromURL
'//response.write "<p>" & "Just logged in with VID...but no
database processing script" & "<p>VID=" & Request("vID")
If Request("vID") <> "" then '// no cookie, but ID is present
CookieBln=0
'//retrieve user database details as cookies not present
u_id=Request("vID")
u_FromURL=Request("u_FromURL")
u_CurrentURL=Request.servervariables("URL")
set oConn = GetConnection()
Set oCmd = GetStoredProcedure(oConn,"sp_GetUser")
oCmd.Parameters.append oCmd.CreateParameter("u_id", adInteger,
adParamInput,10,u_id)
set oRS = oCmd.execute()
if oRS.eof then
Response.Write("You do not appear to be in our database")
else
u_name=escapeString(oRS.fields("u_name"))
'//response.write u_name
'//response.end
Set oCmd = GetStoredProcedure(oConn,"spr_addUserPath")
oCmd.Parameters.append oCmd.CreateParameter("u_id",
adInteger, adParamInput,4,u_id)
oCmd.Parameters.append oCmd.CreateParameter(" u_name",
adVarChar, adParamInput,70, u_name)
oCmd.Parameters.append oCmd.CreateParameter("UserIP",
adVarChar, adParamInput,20, u_VisitorIP)
oCmd.Parameters.append oCmd.CreateParameter("URLFrom",
adVarChar, adParamInput,100,u_FromURL)
oCmd.Parameters.append oCmd.CreateParameter("URLCurrent",
adVarChar, adParamInput,100,u_CurrentURL)
oCmd.Parameters.append oCmd.CreateParameter("u_browser",
adVarChar, adParamInput,100,u_browser)
oCmd.Parameters.append oCmd.CreateParameter("u_Cookies",
adInteger, adParamInput,4,CookieBln)
oCmd.execute()
response.write "done"
end if
Else
response.redirect
"/catamaranco/join/logon.asp?CookieChk=Disabled&u_FromURL=" & u_FromURL &
"&u_CurrentURL=" & u_CurrentURL
End If
end if
End If
%>