[thelist] How to simply display referer url in html

Bojan Tesanovic btesanovic at gmail.com
Sat Jul 7 03:13:19 CDT 2007

Mike Maughan wrote:
> Hi all,
> (hopefully) a very simple request here ...
> I have been reviewing the domains I have registered (too many) and have
> decided to try to sell off some of the unwanteds, so I've used the
> "redirect" facility at my hosters (dreamhost) to point browsers to a landing
> page at my site forsale.bolleaux.com.
> At the moment I have a noddy page there but I would like to start to improve
> it by at least being able to display the url that sent the browser to my
> page, so instead of saying "the domain you clicked on o get here is for
> sale" I'd like to say something like "domain.com is for sale", filling in
> domain.com from the referer field.
> I have done a fair bit of Googling (tm) but so far drawn a blank.
> Can I do this at all?  Can anyone point me in the right direction, please?

$refferer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] ? false;
$validDomains = explode(',','www.exmaple.com,www2.com,www5,.....');
$foundDomain = false;
  foreach ($validDomains as $domain){
	if(strpos($domain,$refferrer) !== false){
		$foundDomain = $domain;

if($foundDomain ) echo "Hey $foundDomain only for $9.99  ;) ";

if you have PHP installed on server ;)


Bojan Tesanovic

More information about the thelist mailing list