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

array & querys help/advice.
Ok so here goes , I have a mysql database and basically here's what I need to do.

// foreach

C problem struct and string
Hi guys,

This is my first post and I'm hoping the experts here can help me solve my problem.<

upload image name with extension using php
hi frds..

<input id="file1" type="file" name="file[]" &a

problem with GROUP BY and ORDER BY
i usually use this query to display the last 10 entries from a sql table:

Code: $query = &quo

Need help with unexpected T-STRING error
I'm a newbie and I'm still learning PHP. However this error has me stumped. I've googled, searched t

Character Sets/Collations Stuff
Can someone please give me a check list of things I must do to setup all the charset stuff for my ph

Confused with Loop
guys, i got confused with Looping...this is the case

I have 3 stocks, let say "Stock A&q

Upload file!
Ok i have a form..
Code: <form name="form1" method="post" action=&quo

Undefined offset
The following script checks to see if the user answer matches the correct answer.

Form Fiel

Multi-user card game
I'm writing a batch of games and such. Lottery is finished, Poker,blackjack,etc are next. They will

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