2

i am using php 5.3.0 and i am use wamp server function is like that

eregi("^[ \f\r\t\n]{0,}(SELECT){1}(.+)$",$this->ss_last_query)  
eregi("^[ \f\r\t\n]{0,}(UPDATE|INSERT|DELETE){1}(.+)$",$this->ss_last_query)
Phil
  • 157,677
  • 23
  • 242
  • 245
user697932
  • 23
  • 2
  • 4

3 Answers3

6

Two options

  1. Don't use the ereg* functions (use the PCRE suite instead)
  2. Disable E_DEPRECATED error reporting. See error_reporting()

The best option is #1 as the entire POSIX Extended suite will be removed in a future version.

I can't comprehend how people are still using this. It's been marked for removal for years. Not to mention the pre-deprecated "These functions are inferior!" warning that was up for even longer.

Phil
  • 157,677
  • 23
  • 242
  • 245
  • 1
    Some people still use `mysql_*` too. :) – alex Apr 08 '11 at 03:27
  • `mysql_*` doesn't appear to have been deprecated. – ceejayoz Apr 08 '11 at 03:30
  • 1
    @ceejayoz Whilst that's true, there are *much* better options available – Phil Apr 08 '11 at 03:32
  • 3
    Sure, but there's a big difference between that and using functions that've you've been warned for years that they're going away... – ceejayoz Apr 08 '11 at 03:33
  • mysql_ is easy for the beginners (me when I first learned how to write a registration scripts) and it was consistent for the people who didn't have to release code or need for it to be secure/user proof (me until I started coding for cash). I would be lying if I said I will never show a new php'er mysql_*, but I do make an effort to teach any people with programming experience to use mysqli or PDO. – Jake Mar 13 '12 at 12:55
4

Use the preg_match with the i modifier, which specifies that you want a case insensitive match with your regex.

So you want:

preg_match("/regexhere/i", $str);

Mike Lewis
  • 63,433
  • 20
  • 141
  • 111
1
error_reporting(E_ALL ^ E_DEPRECATED);

If you must use eregi, but...

preg_match("/^[ \f\r\t\n]{0,}(UPDATE|INSERT|DELETE){1}(.+)$/is", $this->ss_last_query)

should also work.

Dejan Marjanović
  • 19,244
  • 7
  • 52
  • 66