
<form method="POST" action="">
    <input type="text" name="str" size="50" value="<?php echo $_POST['str'] ?>"/><br><br>
    <input type="submit" value="Search" name=""/><br>
    
</form>

<?php
    
    include_once '../account/session.php';
    include_once '../../scripts/bd.php';
    
    if(isset($_POST['str'])){
        echo '<pre>';
        $query=bd::query("select * from track_soft_bounce where bounce_error=''");
        while ($row=mysql_fetch_array($query)) {
            if(!preg_match('#@gmail.com$#i',$row['email_address'])){
                ob_flush();
                flush();
                echo $row['email_address'].'<br>';
                bd::query("INSERT INTO track_unknow_bounce VALUES(NULL,'{$row['id_campaign']}','{$row['id_data_list']}','{$row['email_address']}','{$row['bounce_error']}','{$row['date_bounce']}')");
                bd::query("DELETE FROM track_soft_bounce WHERE id='{$row['id']}'");
            }
        }
        echo '</pre>';
        
        
       /* $file=$_POST['str'];
        ini_set("memory_limit","10000M");
        $table = explode("\n", file_get_contents($file));
        echo '<pre>';
        foreach ($table as $row) {
            $str=explode('"', $row);
            $row=$str[0].$str[2];
            $fields=explode(',', $row);
            //echo $fields[5].' - '.$fields[9].' - '.$fields[20].'<br>';
            if($fields[0]=='b' && $fields[20]!='' && $fields[20]!='0' ){
                $email_address=$fields[5];
                $bounce_error=$fields[9];
                $id_campaign=$fields[20];
                $query=bd::query("select campaign.id_isp,data_isp.hard_bounce_code,campaign.id_data_list,data_list.data_table from campaign,data_list,data_isp where campaign.id='$id_campaign' && campaign.id_data_list=data_list.id && campaign.id_isp=data_isp.id");
                $row=mysql_fetch_array($query);
                $id_data_list=$row['id_data_list'];
                $data_table=$row['data_table'];
                $hard_bounce_code=$row['hard_bounce_code'];
                $date_bounce=date('Y-m-d h:i:s');
                ob_flush();
                flush();
                if(preg_match('#'.$hard_bounce_code.'#i', $bounce_error)){
                    $bounce_error=addslashes($bounce_error);
                    bd::query("INSERT INTO track_hard_bounce VALUES(NULL,'$id_campaign','$id_data_list','$email_address','$bounce_error','$date_bounce')");
                    bd::query("DELETE FROM $data_table WHERE email_address='$email_address'");
                    echo 'HARD BOUNCE: - '.$id_campaign.' - '.$email_address.' - '.$data_table.' - '.$bounce_error.'<br>';
                }else{
                    $bounce_error=addslashes($bounce_error);
                    bd::query("INSERT INTO track_soft_bounce VALUES(NULL,'$id_campaign','$id_data_list','$email_address','$bounce_error','$date_bounce')");
                    echo 'SOFT BOUNCE: - '.$id_campaign.' - '.$email_address.' - '.$data_table.' - '.$bounce_error.'<br>';
                }
            }
        }
        echo '</pre>';*/
    }
    
    
?>