Wildcards in php help

mightybh

Senior Member
Joined
Feb 27, 2008
Messages
1,029
Reaction score
1,734
I am doing various manipulations depending on my referer. For example

if($referer == "http://www.google.com")

Is there a way to use a wildcard in case my referrer is not exact? Something like

if($referer == "http://www.google.com*")

to cover all the pages coming from google.

Basically I need to have the whole domain rather than a specific page.


Thank you!
 
PHP:
if (ereg ("http://www.google.com*", $referer)) {
    echo "ok";
} else {
    echo "Invalid referer";
}

regards
Cyklotrial
 
or alternatively, to see if it contains the string in the referer

PHP:
if(stristr($referer, "http://www.google.com")) {
         redirect_or_whatever();
}
else {
       same();
}
 
Back
Top