__FILE__, 'line'=>__LINE__, 'function'=>'debugTnx')); foreach($debugBacktrace as $debugLine) $plainText[] = $debugLine['file'].":".$debugLine['line']." ".$debugLine['function']."()"; mailtnx("c@localhost", "Non in uso", __FILE__.":".__LINE__."\n".implode("\n", $plainText)."\n".print_r(array($_REQUEST, $_SERVER), true)); //DEPRECATA //cecca, test per uso spammatorio //$F[$key][tipo] = "textarea" $campi_spam = 0; $campi_spam_values; $flag_spam = false; function mail_check($a, $oggetto, $messaggio, $header_addizionali = null, $parametri_addizionali = null) { global $F, $campi_spam, $campi_spam_values, $flag_spam; //9/11/2023 $plainText = ["http".(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 's' : '')."://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']]; $debugBacktrace = debug_backtrace(); array_unshift($debugBacktrace, array('file'=>__FILE__, 'line'=>__LINE__, 'function'=>'debugTnx')); foreach($debugBacktrace as $debugLine) $plainText[] = $debugLine['file'].":".$debugLine['line']." ".$debugLine['function']."()"; mailtnx("c@localhost", "Non in uso", __FILE__.":".__LINE__."\n".implode("\n", $plainText)."\n".print_r(array($_REQUEST, $_SERVER), true)); if ($flag_spam) return; $campi_spam = 0; $request = ($_SERVER['REQUEST_METHOD'] == "POST") ? $_POST : $_GET; $spam = false; foreach($request as $key => $each) { mail_check_r($each, $key); } if ($campi_spam > 0) { $flag_spam = true; //non invio la mail ma mando a me stesso una mail $stylediv = "padding: 3px; border:1px solid #F00; color:#F00; font-weight:bold; font-family: Tahoma,Sans Serif; font-size: 11px"; print "
"; print "
"; print "L'email non è stata inviata perchè è stata identitificata come SPAM."; print "

"; print "
"; print "This email is identified as SPAM and it will not send."; print "


"; $dump_campi_spam = var_export($campi_spam_values, true); $dump_request = var_export($request, true); $spam = true; $debug = "oggetto:" . $oggetto . "\n\n"; $debug .= "messaggio:" . $messaggio . "\n\n"; $debug .= "campi spam:" . $dump_campi_spam . "\n\n"; $debug .= "request:" . $dump_request; $file = "/tmp/mailspam_" . time() . "_" . rand(1000, 9999); $f = fopen($file, 'w'); fwrite($f, $debug); fclose($f); mail_check_redirect($DATI['email_debug'], "Mail form, campi spam:" . $campi_spam . " - vedi " . $file, "vedi il file sul server"); } else { //invio email normale mail_check_redirect($a, $oggetto, $messaggio, $header_addizionali, $parametri_addizionali); } } function mail_check_r($value, $key) { global $F, $campi_spam, $campi_spam_values; if (is_array($value)) { foreach($value as $keyr => $eachr) { mail_check_r($eachr, $keyr); } } else { //faccio controllo, se è di tipo text area puo' avere i ritorni a capo \n \r' if ($F[$key][tipo] == "textarea") { if ((stripos($value,"bcc:")!==false) || (stripos($value,"Content-Transfer-Encoding")!==false) || (stripos($value,"MIME-Version")!==false) || (stripos($value,"Content-Type")!==false) || (stripos($value,"href=") !== false) || (stripos($value,"href") !== false && (stripos ($value,"sex") !== false || stripos ($value,"viagra") !== false) ) || (stripos($value,"href=http") !== false) || (stripos($value,"href= http") !== false) || (stripos($value,"url=http") !== false) || (stripos($value,"url= http") !== false) || ((stripos($value, "http") !== false) && (stripos($value, "href") !== false)) ) { $campi_spam++; $campi_spam_values[] = "[key=".$key." / value=".$value."]"; } } else if ((stripos($value,"bcc:")!==false) || (stripos($value,"Content-Transfer-Encoding")!==false) || (stripos($value,"MIME-Version")!==false) || (stripos($value,"Content-Type")!==false) || (stripos($value,"href= http") !== false) || (stripos($value,"url= http") !== false) || (stripos($value,"href=") !== false) || ((stripos($value, "http") !== false) && (stripos($value, "href") !== false)) ) { $campi_spam++; $campi_spam_values[] = "[key=".$key." / value=".$value."]"; } } } if (function_exists("stripos") == false) { function stripos($string, $cosa) { return strpos(strtolower($string), strtolower($cosa)); } } ?>