Solved

referer from domain

Posted on 2006-10-19
1
298 Views
Last Modified: 2008-02-01
hello,
how can I make something so that if user comes from
domain.com, domain.com/test/ and domain12.com
display hello 2 otherwise display hello 4

<?
$referer = $_SERVER['HTTP_REFERER'];
if (strstr($referer, "domain.com") !== false) {
   echo "hello 2";
}  
 else{
   echo "hello 4";
}
?>
0
Comment
Question by:Sabrin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 16

Accepted Solution

by:
hankknight earned 500 total points
ID: 17767938
Try:

<?
$referer = $_SERVER['HTTP_REFERER'];
if (strstr($referer, "domain.com") !== false ||  strstr($referer, "domain12.com") !== false || strstr($referer, "domain.com/test/") !== false) {
   echo "hello 2";
}  
 else{
   echo "hello 4";
}
?>
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question