Jump to content


Photo

About PHP Referrer


  • Please log in to reply
6 replies to this topic

#1 jeboy

jeboy
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts
  • LocationRizal, Philippines

Posted 16 October 2006 - 08:45 AM

I write a code that will show up the referers url, I used $HTTP_REFERER, $_SERVER['HTTP_REFERRER'] but it doesnt work. Here's my code:

$ref = @$_SERVER["REFERER"];
// try to catch the referrer
if (empty($ref) && !empty($HTTP_REFERER)){
$ref = $HTTP_REFERER;
}
echo 'Your referer to this page is ';
echo $ref;


I'd like to use that method for me to track the page in which the visitor used to click the link and the visitor will be redirected back to that page.

Hope you could help me, thanks

#2 xsist10

xsist10
  • Members
  • PipPipPip
  • Advanced Member
  • 114 posts

Posted 16 October 2006 - 08:54 AM

All you need to know about tracking visitors:
http://www.phparchiv...les.php?file=13


The referer variable is:
<?php

$_SERVER['HTTP_REFERER']

?>
SA PHP Archives - www.phparchives.za.org

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 16 October 2006 - 09:06 AM

<?php
$host=apache_request_headers();
echo "\$host['Referer'] = {$host['Referer']}\n";
echo "\$_SERVER['HTTP_REFERER'] = {$_SERVER['HTTP_REFERER']}\n";
?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 jeboy

jeboy
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts
  • LocationRizal, Philippines

Posted 16 October 2006 - 09:07 AM

Thanks! I use dreamweaver in writing php scripts, when I type the code $_SERVER['HTTP_REFERER'], it auto completes to HTTP_REFERRER instead of HTTP_REFERER.

#5 xsist10

xsist10
  • Members
  • PipPipPip
  • Advanced Member
  • 114 posts

Posted 16 October 2006 - 09:11 AM

Dreamweaver + PHP =  >:(
SA PHP Archives - www.phparchives.za.org

#6 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 16 October 2006 - 09:12 AM

That why most php programmers use notepad lol.

All the best redarrow.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#7 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 16 October 2006 - 09:37 AM

Just to note that referals are not reliable - they depend on the previous host using transfers and the client to actually submit the data, which doesn't always happen. :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users