Solved

referer from domain

Posted on 2006-10-19
1
284 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
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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

827 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