Connecting Tech Pros Worldwide Help | Site Map

Linking back to specific referrer sites... How to?

Haitashi's Avatar
Member
 
Join Date: Jun 2007
Location: Orlando, FL
Posts: 94
#1: May 22 '08
There are many ways to reach my site. But I what I'm trying to accomplish is to test if the user comes back from 3 specific sites. If they are linking to my site from theirs, I want to store that info in a variable to dynamically create a URL that links back to that original site.

I was thinking that I could use CGI.http_referrer and somehow test if it contains specific URL info. And if it contains any of those 3 sites then save the content to a variable.

Can I even test of specific text exists as part of CGI.http_referrer? I also think that I need to test for the domain and have it completely ignore any sub directory (so that blabla.com & blabla.com/home/ would both come back as 'true' if I test it for the blabla.com string).

Any suggestions?
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: May 23 '08

re: Linking back to specific referrer sites... How to?


Use it as a string. Use a combination of string functions (find, refind, left, mid, etc.) or perhaps someone has already written a UDF over on cflib.org
Haitashi's Avatar
Member
 
Join Date: Jun 2007
Location: Orlando, FL
Posts: 94
#3: May 29 '08

re: Linking back to specific referrer sites... How to?


Thanks. Even though your suggestion worked (I saved the referrer info and would do a find. If it found any piece of the URLs I needed, then it would set a variable to contain that info).

Even though in theory this should work. However, we would sometimes end up with unreliable information inside the referrer and this would cause errors. Mostly from users using the BACK and FORWARD button to navigate around.

I decided not to implement this feature until I find a safe and proved method to do it. Thanks anyways!
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#4: May 29 '08

re: Linking back to specific referrer sites... How to?


Yes, cgi.http_referer is unreliable. It's even spelt incorrectly! The user can spoof or disable it or the firewall can block it. Not something that can be relied upon.
Haitashi's Avatar
Member
 
Join Date: Jun 2007
Location: Orlando, FL
Posts: 94
#5: Jun 10 '08

re: Linking back to specific referrer sites... How to?


I've decided to abandon this idea for now. If I do find a reliable way, I'll post back.
Reply