phpregexpreg-matcheregi

I need assistance with eregi - preg_match


I was getting the following error:

Deprecated: Function eregi() is deprecated in /home/herbalhe/public_html/admin/includes/auth.inc.php

So I searched and found that I should be using preg_match() instead of eregi(). So I made the changes and now I am getting this error:

Warning: preg_match(): Unknown modifier 'p' in /home/herbalhe/public_html/admin/includes/auth.inc.php

The code on that line is:

if (preg_match(".inc.php",$HTTP_SERVER_VARS['PHP_SELF']) || 
    preg_match(".inc.php",$_SERVER['PHP_SELF'])) 

Any idea what I should now?


Solution

  • It should be:

    preg_match("/\.inc\.php$/i", $HTTP_SERVER_VARS['PHP_SELF'])