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?

Did you know?Explore Trending and Topic pages for more stories like this.
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

upload form file types....
Hey all, I am learning PHP and I am writing a script from the W3C Schools tutorials for uploading fi

Email logic not working
I would like to send an email using the php email() function then if it does execute i.e sends i wou

Date help - fetch dates for Mondays between xxx and yyy?
Does anyone know the best way to do this? I have two dates, say:

2010-01-26 and 2010-05-30

Redirecting Admin
In my members table, I have a field called "perm" and it's set to zero for all members. Ho

BIG file upload!
Hey guys!

I'm trying to upload a file, it works well with smaller files but with 60mb+, I get

Set Categories
I am creating a submission form for somebody to come in and submit products. These products are sep

Restricted access to sub-folder in iis6 doesn't work?
Basically I'm trying to add restriction to sub-folder (which contains pdf) in web.config for iis6 as

Generate PDF
Hi guys,

I would like to know if there is a way to generate pdf when clicking on a link. In f

Extending Exception to contain method name
I was wondering, if there's a way to extend Exception in such a way, that it would contain name of a

j1inmis Ouput layout changes
Hi,

Can anybody tell how can j1inmis output layout can be changed so that vendor names ge

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