Possible Duplicate:
Converting ereg expressions to preg
I have this Function For filter wrod (bad word) form title/desc. now i see ereg_replace() is deprecated php error Deprecated: Function ereg_replace() is deprecated in C:\xampp\htdocs\share\configs\functions.php on line 2750 and this Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\share\configs\functions.php:2747) in C:\xampp\htdocs\share\modules\signup\signup.php on line 31 in my page. what's problem? how to fix this ?
This is My Function :
    function filter_title($str)
{
    global $config;
    if ( $config['word_filters'] == '1' ) { $str = filterBadWords ( $str ); }
    if ( $config['word_filters'] == '0' ) { $str=mysql_real_escape_string($str); }
    //if ( $config['word_filters'] == '1' ) { $str = filterBadWords ( urlencode($str) ); }
    //$newstr=str_replace('"',"'",$str);
    $pats1 ='\'';  $repls1 ="";
    $pat[] ='\"';  $repl[] ="";
    $pat[] ='\&';  $repl[] =" and ";
    $pat[] ='\~';  $repl[] ="";
    $pat[] ='\@';  $repl[] ="";
    $pat[] ='\#';  $repl[] ="";
    $pat[] ='\$';  $repl[] ="";
    $pat[] ='\%';  $repl[] ="";
    $pat[] ='\^';  $repl[] ="";
    $pat[]='\*';  $repl[]="";
    $pat[]='\(';  $repl[]="";
    $pat[]='\)';  $repl[]="";
    $pat[]='\+';  $repl[]=" ";
    $pat[]='\`';  $repl[]="";
    $pat[]='\=';  $repl[]="";
    $pat[]='\!';  $repl[]="";
    $pat[]='\[';  $repl[]="";
    $pat[]='\]';  $repl[]="";
    $pat[]='\{';  $repl[]="";
    $pat[]='\}';  $repl[]="";
    $pat[]='\;';  $repl[]="";
    $pat[]='\:';  $repl[]="";
    $pat[]='\.';  $repl[]="";
    $pat[]='\/';  $repl[]="";
    $pat[]='\?';  $repl[]="";
    $pat[]='\<';  $repl[]="";
    $pat[]='\>';  $repl[]="";
    //$pat[]='\_';  $repl[]=" ";
    $pat[]="\\\\"; $repl[]="";
    $pat[]='\|';  $repl[]="";
    $pat[]='\,';  $repl[]="";
    $pat[]='\0x';  $repl[]="";
    $newstr = ereg_replace($pats1, $repls1, $str);    // ---> 2747 <---     
    for($i=0;$pat[$i];$i++) {
    $newstr = ereg_replace($pat[$i], $repl[$i], $newstr); // ---> 2750 <---
    }
    $newstr = preg_replace('/\s\s+/', ' ', $newstr); 
    return trim ( $newstr );
}
This My filter_descr function :
function filter_descr($str)
    {
        //$str=mysql_real_escape_string($str);
        global $config;
        if ( $config['word_filters'] == '1' ) { $str = filterBadWords ( $str ); }
        if ( $config['word_filters'] == '0' ) { $str = mysql_real_escape_string($str); }
        //if ( $config['word_filters'] == '1' ) { $str = filterBadWords ( urlencode ( $str ) ); }
        //$newstr=str_replace('"',"'",$str);
        $pats1 = "\'";  $repls1 ="'";
        $pat[] = '\"';  $repl[] =""";
        $pat[] = '\&';  $repl[] ="&";
        //$pat[] ='\~';  $repl[] ="";
        //$pat[] ='\@';  $repl[] ="";
        //$pat[] ='\#';  $repl[] ="";
        $pat[] = '\$';  $repl[] ="";
        $pat[] = '\%';  $repl[] ="";
        $pat[] = '\{';  $repl[] ="";
        $pat[] = '\}';  $repl[]="";
        $pat[] = '\`';  $repl[]="";
        //$pat[]='\/';  $repl[]="";
        $pat[] = '\<';  $repl[]="";
        $pat[] = '\>';  $repl[]="";
        //$pat[]="\\\\"; $repl[]="";
        $pat[] = '\|';  $repl[]="";
        //$pat[]="\n";  $repl[]="<br>";
        //$pat[]='\r';  $repl[]="<br>";
        $pat[] = '\0x';  $repl[]="";
        $newstr = ereg_replace($pats1, $repls1, $str);
        for($i=0;$pat[$i];$i++) {
        $newstr=ereg_replace($pat[$i], $repl[$i], $newstr);
        }
        $newstr = preg_replace('/\s\s+/', ' ', $newstr);
        return trim ( $newstr );
    } 
PHP Signup ( LINE 31 commented ) :
session_start();
include('../../configs/config.php');
$smarty->assign('country', set_country_box(filter_title($_REQUEST['fcountry'])));
//if somebody is logged in and active, we don't need to see the registration page
if ($_SESSION["USERNAME"]!="" && $_SESSION["IS_ACTIVE"]=="1")
{
    header("Location: $config[base_url]/main");
    exit;
}
//if Cancel is pressed
if (filter_descr($_REQUEST[scancel])!="")
{
    header("Location: $config[base_url]/main"); // ----> LINE 31 <----
    exit;
}
 
     
     
    