• 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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Rudolph Smits

    (@rudolph-smits)

    I am a few steps further.

    The function is executed in functions.php in a Weaver-child. So it runs prior to loaded the requested page.

    When I call i.e. http://www.vakantiehuisverhuur.eu/huurvoorwaarden/ the actual link found by the script is: link%3Ahttp%3A%2F%2Fwww.vakantiehuisverhuur.eu%2Fverhuurbemiddeling%2F.

    The string “verhuurbemiddeling” is odd, should it not have been “huurvoorwaarden”?
    But “verhuurbemiddeling” is the name of the next page in WordPress. Is that db corrupt or something?
    Or is it impossible to determine an actual url prior to loading that page.

    Thread Starter Rudolph Smits

    (@rudolph-smits)

    Having called another page after http://www.vakantiehuisverhuur.eu/huurvoorwaarden/ and the going back using the “go back”-function (left arrow) of the browser is DOES show the right URL.

    I am lost……………. 😉

    So the basic question seems to be: “using WordPress, is it possible to obtain the requested URL before a page is loaded”.

    Again, the php is executed from within functions.php in theme Waever-child.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Different outcome strpos-test in $_SERVER[REQUEST_URI]’ is closed to new replies.