Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HTTP_REFERRER to database problem

    I have a problem with my script, it doesn't enter the server variable HTTP_REFERRER into the database field correctly; it only ever enters the domain as "Not Referred" :

    Code:
    <% Dim strURL, arrURL, x, i, refURL, refDomain, currURL
    strURL = LCASE(Request.ServerVariables("HTTP_REFERRER"))
    If strURL > "" then
    'Split example into array based on / char
    	arrURL = Split(strURL, "/")
    	refDomain = arrURL(0)&"//"&arrURL(2)
    		For i = 3 to UBound(arrURL)
    			refURL = refURL&"/"&arrURL(i)
    		Next
    	Else 
    	refDomain = "Not Referred"
    	refURL = ""
    End If
    currURL = "http://"&Request.ServerVariables("SERVER_NAME")&Request.ServerVariables("URL")
    
    	Set objReferrer = Server.CreateObject("ADODB.Recordset")
    	objReferrer.ActiveConnection = "dsn=INVITEDB"
    	objReferrer.Source = "SELECT * FROM Referrer_Stats WHERE LoggedFromPage = '"&currURL&"' AND Ref_Domain = '"&refDomain&"' AND Ref_URL = '"&refURL&"'"
    	objReferrer.CursorType = 0
    	objReferrer.CursorLocation = 2
    	objReferrer.LockType = 2
    	objReferrer.Open()
    
    	objReferrer_numRows = 0
    
    	If Not objReferrer.EOF Or Not objReferrer.BOF Then
    		objReferrer("Referrals") = (objReferrer.Fields.Item("Referrals")+1)
    		objReferrer.Update
    	Else
    		objReferrer.AddNew
    		objReferrer("LoggedFromPage") = currURL
    		objReferrer("Ref_Domain") = refDomain
    		objReferrer("Ref_URL") = refURL
    		objReferrer("Referrals") = 1
    		objReferrer.Update
    	End If
    %>
    can anyone see anything wrong here?
    tia
    Last edited by Detonate; 01-17-2005 at 09:26 AM.

  • #2
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    argh, messy, use [code|[/code| blocks in your posts

    btw the problem in there is that its spelt HTTP_REFERER

    i always this loop to chck servervariables exist then copy them in from the page displayed:

    Code:
    <%
    For Each strServerVariable in Request.ServerVariables
    	Response.Write strServerVariable & "<br><br>" & Request.ServerVariables(strServerVariable) & "<hr>"
    Next
    %>

  • #3
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    bah, a simple sp was all it was

    thanks ghell


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •