"" && $bulk<>""){ $bulk_array=explode("\r\n",$bulk); $bulk_array=array_filter($bulk_array, 'trim'); $no_of_rows=count($bulk_array); $dupes = 0; $nodupes = 0; for($i=0;$i<$no_of_rows;$i++){ $columns=explode(",",$bulk_array[$i]); //print_r($columns); $ip=$columns[0]; //verify if ip has /value if(strpos($ip,"/")==false){ $ip=$ip."/32"; } $sql_ins="INSERT INTO $table_name (ip,type,adddate,enddate,reason) VALUES ('$ip','$type','$now','$enddate','$reason')"; //echo $sql_ins; //echo "
"; if(!mysqli_query($con,$sql_ins)){ // Ignore the error if it is a duplicate entry, just continue. if(substr_compare(mysqli_error($con),"Duplicate",0,9,FALSE) !== 0) { $_SESSION['rezult_msg']="There was an error while recording the row ".$i." in the database. Please try again.
".mysqli_error($con); $_SESSION['ret_link']="add_ip_bulk_frm.php"; header("location:error.php?var=2"); return false; } else { $dupes++; } } else { $nodupes++; } if($i==($no_of_rows-1)){ $sql_last_upd="UPDATE info SET last=$now WHERE list='$list'"; $rez_last_upd=mysqli_query($con,$sql_last_upd); $_SESSION['rezult_msg']=" OK! ( " . $nodupes . " ) records were successfully added to the " . $table_name . " database. Ignored ( " . $dupes . " ) duplicates in ( " . $no_of_rows . " ) lines."; $link="add_ip_bulk_frm.php"; header("location:$link?var=1"); return false; } } } else{ $_SESSION['rezult_msg']="There is insuficient information to be able to add records to the database. Please try again.
".mysqli_error($con); $_SESSION['ret_link']="add_ip_bulk_frm.php"; header("location:error.php?var=2"); return false; } ?>