Avatar of sabecs
sabecs
 asked on

PHP - Function eregi() is deprecated error message.

Hi,
I am receiving the following error message.

Deprecated: Function eregi() is deprecated in /home/mywebsit/public_html/includes/functions.php on line 262

How should I recode the code below to correct the error?


$GP_uploadAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
  if (!eregi("GP_upload=true", $HTTP_SERVER_VARS['QUERY_STRING'])) {
            $GP_uploadAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING']."&GP_upload=true";
      } else {
            $GP_uploadAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING'];
      }
} else {
  $GP_uploadAction .= "?"."GP_upload=true";
}
PHP

Avatar of undefined
Last Comment
Ray Paseur

8/22/2022 - Mon
StingRaY

$GP_uploadAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
  if (preg_match("/GP_upload=true/", $HTTP_SERVER_VARS['QUERY_STRING']) == 0) {
            $GP_uploadAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING']."&GP_upload=true";
      } else {
            $GP_uploadAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING'];
      }
} else {
  $GP_uploadAction .= "?"."GP_upload=true";
}

Open in new window

ASKER CERTIFIED SOLUTION
hernst42

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Ray Paseur

For PHP developers, the PHP.net web site is an invaluable resource.  If you are upgrading to PHP 5.4, you really need to read this:
http://php.net/migration54

On that page you will also find a line with the links for the other recent upgrade paths.  It says something like this:
See also the migration guides for PHP versions 5.0.x, 5.1.x, 5.2.x and 5.3.x.

The migration guides explain what is deprecated and what is removed, as well as what is added in each new release of PHP.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23