Deprecated: Function ereg() is deprecated, Please Help Update my Code !

Discussion in 'PHP' started by WebDevNow, Apr 24, 2012.

  1. #1
    Hello,
    I got error message in resgitering new members page on my website,

    Deprecated: Function ereg() is deprecated in .../modules/account/account.inc.php on line 1315

    The Code in this line:

        
    if(ereg('search', $VAR['_page']))
            $arr = $static_var->generate_form('account', 'add', 'search');
            else
            $arr = $static_var->generate_form('account', 'add', 'update');
    
    Code (markup):
    I know abit about code change to match the new version of PHP,
    so please can anyone help me updating this line,
    to get rid of the error message in the front-end.

    Thanks alot,
     
    WebDevNow, Apr 24, 2012 IP
  2. e-abi

    e-abi Member

    Messages:
    122
    Likes Received:
    1
    Best Answers:
    3
    Trophy Points:
    38
    #2
    e-abi, Apr 24, 2012 IP
  3. WebDevNow

    WebDevNow Peon

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for your reply,
    but can you please tell me how should my code line be after change ?
    Thanks
     
    WebDevNow, Apr 24, 2012 IP
  4. WebDevNow

    WebDevNow Peon

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Any help please ?????
     
    WebDevNow, Apr 24, 2012 IP
  5. e-abi

    e-abi Member

    Messages:
    122
    Likes Received:
    1
    Best Answers:
    3
    Trophy Points:
    38
    #5
    if(preg_match('/^search$/', $VAR['_page']))
            $arr = $static_var->generate_form('account', 'add', 'search');
            else
            $arr = $static_var->generate_form('account', 'add', 'update');
    PHP:
    Haven't tested but is should work.
     
    e-abi, Apr 24, 2012 IP
  6. WebDevNow

    WebDevNow Peon

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks alot for your concern,
    I have more codes needs to be corrected can you please just let me know how should they be ?

    [COLOR=#333333][FONT=Bitstream Vera Sans Mono][B]if[/B][/FONT][/COLOR][COLOR=#333333][FONT=Bitstream Vera Sans Mono]([/FONT][/COLOR][COLOR=#008080][FONT=Bitstream Vera Sans Mono]$file_name[/FONT][/COLOR][COLOR=#333333][FONT=Bitstream Vera Sans Mono] [/FONT][/COLOR][COLOR=#333333][FONT=Bitstream Vera Sans Mono][B]!=[/B][/FONT][/COLOR][COLOR=#333333][FONT=Bitstream Vera Sans Mono] [/FONT][/COLOR][COLOR=#DD1144][FONT=Bitstream Vera Sans Mono]'..'[/FONT][/COLOR][COLOR=#333333][FONT=Bitstream Vera Sans Mono] [/FONT][/COLOR][COLOR=#333333][FONT=Bitstream Vera Sans Mono][B]&&[/B][/FONT][/COLOR][COLOR=#333333][FONT=Bitstream Vera Sans Mono] [/FONT][/COLOR][COLOR=#008080][FONT=Bitstream Vera Sans Mono]$file_name[/FONT][/COLOR][COLOR=#333333][FONT=Bitstream Vera Sans Mono] [/FONT][/COLOR][COLOR=#333333][FONT=Bitstream Vera Sans Mono][B]!=[/B][/FONT][/COLOR][COLOR=#333333][FONT=Bitstream Vera Sans Mono] [/FONT][/COLOR][COLOR=#DD1144][FONT=Bitstream Vera Sans Mono]'.'[/FONT][/COLOR][COLOR=#333333][FONT=Bitstream Vera Sans Mono] [/FONT][/COLOR][COLOR=#333333][FONT=Bitstream Vera Sans Mono][B]&&[/B][/FONT][/COLOR][COLOR=#333333][FONT=Bitstream Vera Sans Mono] [/FONT][/COLOR][COLOR=#333333][FONT=Bitstream Vera Sans Mono][B]![/B][/FONT][/COLOR][COLOR=#0086B3][FONT=Bitstream Vera Sans Mono]eregi[/FONT][/COLOR][COLOR=#333333][FONT=Bitstream Vera Sans Mono]([/FONT][/COLOR][COLOR=#DD1144][FONT=Bitstream Vera Sans Mono]"^_"[/FONT][/COLOR][COLOR=#333333][FONT=Bitstream Vera Sans Mono],[/FONT][/COLOR][COLOR=#333333][FONT=Bitstream Vera Sans Mono] [/FONT][/COLOR][COLOR=#008080][FONT=Bitstream Vera Sans Mono]$file_name[/FONT][/COLOR][COLOR=#333333][FONT=Bitstream Vera Sans Mono]))[/FONT][/COLOR]
    Code (markup):
    
    [B]if[/B]([COLOR=#008080]$file_name[/COLOR] [B]!=[/B] [COLOR=#DD1144]'..'[/COLOR] [B]&&[/B] [COLOR=#008080]$file_name[/COLOR] [B]!=[/B] [COLOR=#DD1144]'.'[/COLOR] [B]&&[/B] [B]![/B][COLOR=#0086B3]eregi[/COLOR]([COLOR=#DD1144]"^_"[/COLOR], [COLOR=#008080]$file_name[/COLOR]) )
    			{
    				[COLOR=#008080]$result[/COLOR][[COLOR=#008080]$count[/COLOR]][[COLOR=#DD1144]'name'[/COLOR]] [B]=[/B] [COLOR=#0086B3]eregi_replace[/COLOR]([COLOR=#DD1144]'.php'[/COLOR], [COLOR=#DD1144]''[/COLOR], [COLOR=#008080]$file_name[/COLOR]);
    				[COLOR=#008080]$result[/COLOR][[COLOR=#008080]$count[/COLOR]][[COLOR=#DD1144]'id'[/COLOR]]   [B]=[/B] [COLOR=#008080]$count[/COLOR];
    
    Code (markup):
    Please Help, Thanks :)
     
    WebDevNow, Apr 25, 2012 IP
  7. e-abi

    e-abi Member

    Messages:
    122
    Likes Received:
    1
    Best Answers:
    3
    Trophy Points:
    38
    #7
    No-no-no, if you need code correcting work, then you should order it.
    My help was only to teach and show the correct location, where to fetch information, that is why I supplied the links.
     
    e-abi, Apr 26, 2012 IP