Jump to content

Archived

This topic is now archived and is closed to further replies.

Guest kilbad

Problems with EREGI and $_SERVER in my root web dir

Recommended Posts

Guest kilbad
I am having the following problem..  the first example of code works if it is in a subdir of my website.  However, the same script (minus the reference to the subdir) does not work when in my root web dir..  any ideas?

Example 1 works; located in the test dir, if loaded from a previous page in the test dir, it both echos the referer and "passed validation"::
[code]<?php
echo $_SERVER['HTTP_REFERER'];

if ( eregi ( "http://example.com/test", $_SERVER['HTTP_REFERER'] ) )
{
   
    echo "passed validation";

}
else
{
    echo "Nice try";
}

?>[/code]

Example 2 doesnt work; located in my root web dir, if loaded from another page in the root dir, never echos the referer or "passed validation"::
[code]
<?php
echo $_SERVER['HTTP_REFERER'];

if ( eregi ( "http://example.com/", $_SERVER['HTTP_REFERER'] ) )
{
   
    echo "passed validation";
}
else
{
    echo "Nice try";
}

?>[/code]

Share this post


Link to post
Share on other sites
What is in[tt] $_SERVER['HTTP_REFERER'][/tt]? Keep in mind that[tt] . [/tt] is a metacharacter in regex.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.