"; if (isset($_REQUEST["newemail"])){ $newemail=explode("@",($_REQUEST["newemail"] ?? ''),2); $case_defdomain=$newemail[1]; $case_defemail=$newemail[0]; } else { $case_defdomain = "domain.com"; $case_defemail = "mario.rossi"; } if (isset($_REQUEST["newemail"])){ $newpattern=explode("@",($_REQUEST["newemail"] ?? ''),2); $pattern_domain=$newpattern[1]; } else { $pattern_domain = ""; } if ($pattern_domain != ""){ $_REQUEST["pattern"] = $pattern_domain; } switch ($_REQUEST["type"]) { case "SND": $case_desc="mittenti"; $case_file=$sndr_file; break; case "RCP": $case_desc="destinatari"; $case_file=$rcpt_file; break; } # echo "STEP2: [".$_REQUEST["step"]."]
"; # echo "PAT1: [".$_REQUEST["pattern"]."]
"; if ($_REQUEST["step"]=="restart" && $_REQUEST["pattern"] != '') { $sql="SELECT * FROM SPAMILTER where type='".$_REQUEST["type"]."' and (email LIKE '%".$_REQUEST["pattern"]."%' OR domain LIKE '%".$_REQUEST["pattern"]."%') order by domain,email desc"; } else { $sql="SELECT * FROM SPAMILTER where type='".$_REQUEST["type"]."' order by domain,email desc"; } ### echo "STEP3: [".$_REQUEST["step"]."]
"; ### echo "PAT2: [".$_REQUEST["pattern"]."]
"; function WriteFiles($case_file) { $dbh = new PDO('sqlite:db/petar.db3'); $sql="SELECT * FROM spamilter where type='".$_REQUEST["type"]."' order by domain,email desc"; $result=$dbh->query($sql); $rows=$result->fetchAll(); if ( count($rows) > 0 ) { $handle = fopen("$case_file", "w"); foreach($rows as $row){ fprintf($handle, "%-30s | %-30s | %-30s\n" , $row["domain"], $row["email"],$row["action"]); } fclose($handle); } } ?>
"; if (($_REQUEST["step"] == "" && ($_REQUEST["type"] == "SND" || $_REQUEST["type"] == "RCP")) || $_REQUEST["pattern"] != ''){ echo "Gestione dei $case_desc [ $case_file ]". " ". "[ ricarica pagina ]". "
". "
"; echo ""; echo "
";
}
} else {
echo ""; } ### Regola presente $sql= "SELECT domain FROM SPAMILTER where type = '".$_REQUEST["type"]."' and domain = '".$domain."' and email = '".$email."'"; $result = $dbh->query($sql); $rows=$result->fetchAll(); if ( count($rows) > 0 ) { $errore .= "Regola gia' presente
"; } ### Stampa Errore if ($errore){ echo "Errore
". $errore. "
Correzione";
} else {
### Inserimento nel DB
$sql = "insert into SPAMILTER (type,domain,email,action,other) VALUES ('".$_REQUEST["type"]."','".$domain."','".$email."','".$rule."','')";
$result = $dbh->query($sql);
if ($result = 1) {
echo "Scrittura Completata. Premi qui
";
}
WriteFiles($case_file);
}
}
if ($_REQUEST["step"] == "3"){
if (isset($_REQUEST["vapor"])) {
$count = $dbh->exec("DELETE from SPAMILTER where id = '".$_REQUEST["id"]."'");
echo "
". "Scrittura Completata. Premi qui
".
"Record felicemente cancellati: ".$count;
WriteFiles($case_file);
} else {
$sql = "SELECT * FROM SPAMILTER where id = '".$_REQUEST["id"]."'";
$result = $dbh->query($sql);
$row=$result->fetch();
echo " ".
"La tua risposta e' ".
"[ Si, non ho mai sopportato ".$row["domain"]." ! | ".
" No grazie ]";
}
}
?>
".
" Sei sicuro di voler cancellare questa incolpevole regola : ?
".
"".$row["domain"]." : ".$row["email"]." : ".$row["action"].
"