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

CHMOD script
Hi,

I need a script to read all files in a folder and set to 777.

Can anyone help out

smart reading from a text file
Hello there fellow coders, i was wondering if one of you wouldnt mind helping me with this problem i

Format String help
I have a textbox where a person enters an application number. the application number is 10 characte

Problems with returning true or false in eval()'d code
Hi guys,

Would appreciate some help with a problem when running eval() on a function that sho

help with multi-update
Now sure how to ask this really....
10g database if that matters.

I have a customer

Post PHP form to non-existing page
The company that I work for host their PHP code on IIS on a Windows server, no Apache, so no mod_rew

Save username into DB
OkaY so I got my blog to actually save the posts and whatever, all I need now is for it to keep the

Drop Down and text box issue
Is it possible to set a drop down list and text boxes to a certain width?

here is my code

Disabling SAP menu
How do I disable SAP menu for all the users and just restrict them to User Menu in SAP ECC 6.0?

getting weird error..
okay, I'm getting an error on this particular function, something about the syntax in the mysql LIMI

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