regex - Checking PHP referrer -


so, need check referrer page using php, , if *.example.com, or *.anothersite.com, execute code, if not, redirect elsewhere.

how go checking if http_referer equal values, wildcard character?

thanks!

edit: url contain more 1 domain, regex needs match first occurance found.

$ref = $_server['http_referer']; if (strpos($ref, 'example.com') !== false) {    redirect wherever example.com people should go } if (strpos($ref, 'example.org') !== false) {     redirect wherever example.org people should go } 

of course, works if referer "nice". instance, coming google possibly have "example.org" in search term somewhere, in case strpos see it, , redirect, though came google.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -