Jump to content

PHP Display Telephone Number On Referrer


dremes

Recommended Posts

I have used the php below to show a different telephone number in the header of the site depending upon where the visitor comes from. The code below works but looses the original referrer information upon click of own site links, defaulting the telephone number back to the generic number.

 

Is there away to save it to the session, maybe the start session and save session is not done correct?

 

Thanks for any help

 

.............................................................................

 

<?PHP

session_start();

if(!isset($_SESSION[’referrer’])){

 

$referer = strtolower($_SERVER["HTTP_REFERER"]);

 

if (strstr($referer,"site1"))

{

echo("<h1>Telephone Number1</h1>");

}

else if (strstr($referer,"site2"))

{

echo("<h1>Telephone Number2</h1>");

}

else if (strstr($referer,"site3"))

{

echo("<h1>Telephone Number3</h1>");

}

else if (strstr($referer,"site4"))

{

echo("<h1>Telephone Number4</h1>");

}

else

{

echo("<h1>Telephone Number5</h1>");

} $_SESSION[’referrer’] = $referrer; // store session data

}?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.