?
Solved

Coldfusion's CGI.HTTP_REFERER sometimes has missing info.

Posted on 2005-03-10
8
Medium Priority
?
998 Views
Last Modified: 2013-12-20
Hello,

I have recently implemented my own hit counter to my website in the application.cfm file.  So far, it has received over 23,000 entries.  Just by chance I noticed a problem that about 1 out of 1,000 of those entries have the CGI.HTTP_REFERER being returned missing the last character.  So for example it would say the referrer is http://www.mywebsite.com/index.cf without the "m" at the end.  When you try to go to that page it comes up as non existent.  But just to double check all my links, none of my links have the missing m.  It seems it is being lost somewhere in the processing.  Has anyone seen anything like this before?  is there a particular browser that is causing this?  Below is my code:

<cfquery name="Counter" datasource="#datasource#">
      INSERT INTO tblHits(Page, Referrer, Agent, HitTime)
      VALUES('#CGI.PATH_INFO#', '#CGI.HTTP_REFERER#', '#CGI.HTTP_USER_AGENT#', #dateadd("h",2,now())#)
</cfquery>

Since it would take approx 1,000 more hits before i could even expect to see this happen again, any links/resources to confirm your findings would be great *IF* you have them.  I wouldn't want to award a wrong answer since it would take a long time to "test" the solution.

Thanks,
Jeff
0
Comment
Question by:js_vaughan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 17

Expert Comment

by:Tacobell777
ID: 13512020
Is the width of the column (allowed character length) long enough or is being truncated?
0
 
LVL 17

Expert Comment

by:Tacobell777
ID: 13512030
Personally I have never seen this before. Weird - maybe someone is fooling around with the http headers?
0
 
LVL 10

Author Comment

by:js_vaughan
ID: 13512265
Tacobell777, its definatly not a length issue.  I am using SQLs nvarchar type with a size of 4000.  Also, its doing this right after the .cfm (or.cf for that matter) so its not even getting to the query string part of the referrer.
0
Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

 
LVL 21

Expert Comment

by:pinaldave
ID: 13513514
never seems something like this...?
Do you have any param at the end of the cmf?param=1
I assume not. Is there any case when there is param and f is missing. Just curious?
--Pinal
0
 
LVL 17

Expert Comment

by:Tacobell777
ID: 13514458
only thing I can think of is that someone fooled around with the http headers...
0
 
LVL 10

Author Comment

by:js_vaughan
ID: 13517776
Pinaldave,

I don't use the term 'param' after any of my strings.  Most of these anomalies come from my page search.cfm.  A typical query string for the search page would look like: search.cfm?search=on&state=IL&City=Chicago.  Four of the occurrences were from my index page which I know for a fact I don't even use query strings with.

Also, I used dreamwaver to search my site and it found 467 occurrences of the term .cfm.  I then did a search for .cf and 467 still came up, so that assures me its not a link problem.

I have tried manually reproducing this problem - I physically typed search.cf in the address bar which produces your typical "page cannot be found" error, then I typed in index.cfm but now the referrer shows us as blank (which is correct).  So as far as I can see its really impossible for those referrers to have .cf at the end cause the pages are nonexistent.  But of course, I have 2 dozen entries staring me in the face with a .cf referrer and I don't know how it got there.

Is http header tinkering really a possibility for the CGI.HTTP_REFERER?  This seems skeptical to me.  The only thing I can think of is a particular type of browser is causing this problem.  We have just started implementing the #CGI.HTTP_USER_AGENT#, we did not use to collect that information, so I don't have enough information yet to rely on that.  Plus from what I have read, it isn’t completely reliable anyways.
0
 
LVL 25

Accepted Solution

by:
James Rodgers earned 1000 total points
ID: 13519145
not sure why it's happening but try this in your insert


<cfquery name="Counter" datasource="#datasource#">
     INSERT INTO tblHits(Page, Referrer, Agent, HitTime)
     VALUES(<cfqueryparam value="#CGI.PATH_INFO#" cfsqltype="CF_SQL_VARCHAR"> , <cfqueryparam value="#CGI.HTTP_REFERER#" cfsqltype="CF_SQL_VARCHAR"> ,<cfqueryparam value="#CGI.HTTP_USER_AGENT#" cfsqltype="CF_SQL_VARCHAR">, <cfqueryparam value="#dateadd("h",2,now())#" cfsqltype="CF_SQL_DATE"> )
</cfquery>

0

Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question