Solved

referer from domain

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

730 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