Jump to content


Problems with EREGI and $_SERVER in my root web dir


  • Please log in to reply
1 reply to this topic

#1 Guest_kilbad_*

Guest_kilbad_*
  • Guests

Posted 03 September 2006 - 12:44 AM

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"::
<?php
echo $_SERVER['HTTP_REFERER'];

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

}
else
{
    echo "Nice try";
}

?>

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"::
<?php
echo $_SERVER['HTTP_REFERER'];

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

?>


#2 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 03 September 2006 - 03:21 AM

What is in $_SERVER['HTTP_REFERER']? Keep in mind that . is a metacharacter in regex.
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users