rvdb86 Posted August 11, 2009 Share Posted August 11, 2009 Hey, I want to execute a function if the visitor is refered to the page from another page on same the domain. I know I can get the refferring url through $_SERVER['HTTP_REFERER'] but how do i search the returned string to see if http://www.mydomain.com is present? TIA! Link to comment https://forums.phpfreaks.com/topic/169793-solved-find-domain-in-string/ Share on other sites More sharing options...
premiso Posted August 11, 2009 Share Posted August 11, 2009 stristr would be one way to do it. $domain = $_SERVER['HTTP_REFERER']; if (stristr($domain, "mydomain.com") !== false) echo "mydomain.com is present."; But remember, checking the referrer is not a fail safe way, as an fyi as it can be spoofed easily. Link to comment https://forums.phpfreaks.com/topic/169793-solved-find-domain-in-string/#findComment-895761 Share on other sites More sharing options...
rvdb86 Posted August 11, 2009 Author Share Posted August 11, 2009 great thanks! Link to comment https://forums.phpfreaks.com/topic/169793-solved-find-domain-in-string/#findComment-895790 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.