• andy chuks PHP Tricks: Referral Url Uses
    Share This, Tweet, +1 or Recommend   
    Show Users How they got to your site -
    $referer = $_SERVER['HTTP_REFERER'];
    echo "You reached this site via " . $referer;

    Send users to a certain page depending on where they come from to your site.
    The script below would send visitors who found your site through Facebook to one page, while all others would be redirected to another.

    if (strlen(strstr($_SERVER["HTTP_REFERER"],"facebook"))>0) {
    header ('Location: http://' . $_SERVER['HTTP_HOST'] . '/from_facebook.html');
    } else {
    header ('Location: http://' . $_SERVER['HTTP_HOST'] . '/not_from_facebook.html');
    27 October 2010Comment
    Share This, Tweet, +1 or Recommend   
    • ogugua belonwu How can i know the location a person is visiting from using PHP?
      Like It1 Unlike It0 29 October 2010