PHP Display Telephone Number On Referrer


Posted on 16th Feb 2014 07:03 pm by admin

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
}?>

No comments posted yet

Your Answer:

Login to answer
98 Like 51 Dislike
Previous forums Next forums
Other forums

how to remove in php string display
My code is

$message="We're looking at developing our website.";

$body= "

Stuck with preg_replace
Hi,

I'm trying to use preg_replace to remove part of the IP address submitted using a form on

Upload Code Help
Hi everyone I need some help with a bit of code ive been working with for a while. I am completely s

xApp Analytics in BI 7.0
Dear all,

I am trying to implement xApp Analytics in BI 7.0. After I installed the analyt

Month String to Numeric?
Hi guys,

Given a month as a string, is there a simple way to find the numeric representation

iterating through an array and escape each value independently.
I have a set up where the variable being escaped is an array and it needs to be iterated and escaped

CE 7.1 and External GIS integration
Hi All,

We want to develop an application on CE 7.1 which uses GIS features from an exter

How to make URL loads only on login
On my page, when a user login he's redirects to user_home.php. I made it also to open the chat scree

How do I create a 2D game "camera" to follow player?
In J2ME programming I'm targeting MIDP 2.0 devices.

I'm using gamecanvas and I was thinking t

Getting Resource id #11 while trying to connect..
So i tried using "DEFINE" for the first time and im using the variables i defined to conne

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash