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

}?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.