Different outcome strpos-test in $_SERVER[REQUEST_URI]
-
With the next function, running in functions.php in Weaver-child, I want to determine whether a user has visited my site in an hour before.
Some pages must be ignored in that test. That is the reason why I test the url-string before setting a cookie.In http://www.vakantiehuisverhuur.eu/nieuws/huisbeoordelingen/ the string ‘/nieuws’ is recognized and the cookie is NOT set.
In http://www.vakantiehuisverhuur.eu/nieuws/restaurants/ the string ´/nieuws´ is NOT recognized and the cookie is set.
The other strings are recognized, except ´/huurv´ (in http://www.vakantiehuisverhuur.eu/huurvoorwaarden/) which I also cann’t explain.
The site is http://www.vakantiehuisverhuur.eu.I guess the function in function.php is executed prior to loading the page. So the content of the page has nothing to do with it? The sequence of loading these pages seems to be irrelevant.
Has anyone any idea what causes the different outcome of those strpos-tests?
By the way, COOKIEPATH is empty.function set_newuser_cookie()
{
$actual_link = “http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]”;if ( !is_admin() && !isset($_COOKIE[‘vhv_site’]))
{if (strpos($actual_link,’eu/20′)==false && strpos($actual_link,’/author/’)==false && strpos($actual_link,’/category/’)==false && strpos($actual_link,’/huurv’)==false && strpos($actual_link,’/nieuws/’)==false && strpos($actual_link,’/tag/’)==false && strpos($actual_link,’/verkocht’)==false)
{setcookie(‘vhv_site’, “VHV Home”, time()+3600, COOKIEPATH, “.vakantiehuisverhuur.eu”, false);}
}
}Regards,
Rudolph Smits – Netherlands
- The topic ‘Different outcome strpos-test in $_SERVER[REQUEST_URI]’ is closed to new replies.