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

98 Like 51 Dislike
Previous php-forum Next php-forum
Other php-forum

utf8_general_ci error ??
I have all kinds of data to be inserted in database table

//I am getting this error

Yo

Not "Just Another" MMORPG - text based.
Hello,

I've been learning MySQL and PHP for the last 2-3 years.
Though, I've had long paus

Looping Problem
I've got a client that has a database with about 200 events at any given time. I'm trying to loop t

ob_ dynamic content
i was wondering about the potential to use ob to create a <div then remove it when the page

Beginner PHP code help
Hi I'm new to php but if someone could please read the question below and help it would be great.

First root of a number
Hi,

I can't find any function in php to give me the first root of a number.
Is there any

Calling strings from other php class
I have test1.php{
$string1;
$string2;
....
... //10 strings in this class <

Not sure why this script is not working?
Hi I am new to php programing and I was trying to make up a simple script like a captcha but I canno

article site help remaining text
Hi all hope you will be fine
I am creating a article site in this site i want to put some text on

form variables from database help.
Hi all,

I would like to have a form that gives you options based on the results of an mysql q

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