i am having the code

          if (eregi($file,$_SERVER["HTTP_ACCEPT_LANGUAGE"]) && !$use_lang) $use_lang = $file;


   This line of code is giving error:-Deprecated: Function eregi() is deprecated in C:\xampp\htdocs\spm\includes\header.php on line 15

Recommended Answers

All 8 Replies

after changing with preg_match it is giving another error- preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash in C:\xampp\htdocs\spm\includes\header.php on line 15

<?php
  //to know, where I am (just for display this in the menuebar) - easy replacement of the extension
  $show = str_replace(".php","",basename($_SERVER["SCRIPT_NAME"]));

  include_once ("conf.php");
  include ("functions.php");

  if ($_REQUEST["use_lang"]) $use_lang = $_REQUEST["use_lang"];
  if (!$pm_auth) {
    //all languages
    if ($handle = opendir('lang/')) {
      while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != ".." && is_dir("lang/$file")) {
          $languages[] = $file;
          if (eregi($file,$_SERVER["HTTP_ACCEPT_LANGUAGE"]) && !$use_lang) $use_lang = $file;
        }
      }
      closedir($handle);
    }
    if (!$use_lang) $use_lang = "en";
  }
  /*** Language File ***/
  $lang_file = "lang/$use_lang/common.lang.php";
  if (file_exists($lang_file)) {
    include($lang_file);
  } else {
    $output = error(array("Language file $lang_file not found")) . "</div></body></html>";
    exit($output);  
  }

this is the top lines of my code.

line 15 is the line which is giving error.

Doesn’t line 15 have eregi ? That wasn’t the topic ? Is that the old code ?

yes it is the old code.

if (preg_match("~$file~i", $_SERVER["HTTP_ACCEPT_LANGUAGE"]) && !$use_lang) 
    $use_lang = $file;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.