• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 304
  • Last Modified:

referer from domain

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
Sabrin
Asked:
Sabrin
1 Solution
 
hankknightCommented:
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now