* Website:
http://www.giuseppecalbi.com * * Licenza: l'utilizzo di questo script è gratuito. Sarei grato se inseriste un link a
http://www.giuseppecalbi.com * o
http://www.giuseppecalbi.com/scripts in fondo alle pagine che utlizzano questo script, o in un'area credits o links del vostro sito * * Vi suggerisco di inserire nei form, per i quali userete questo script, in fondo alla pagina la riga: * * ricordandovi di dare alla pagina un'estensione .php e di inserire eventualmente l'url completo dello script nel caso in cui * il form non si trovasse nella stessa cartella. * In questo modo sarà possibile essere avvisati automaticamente di nuovi aggiornamenti rispetto alla versione corrente **/ // Non toccare NULLA in questo file include "config.php"; $version = "1.2"; if ($act == 1) { echo getCredits(); return; } $key = array (); $val = array (); $output = ""; $senderNames = array ($senderNames); foreach($_POST as $chiave=>$valore) { // array_push ($key, $chiave); array_push ($val, eregi_replace("\\\'", "'", $valore)); if (!empty($emailField)) { if ($chiave == $emailField) { $emailMittente = $valore; } } if (!empty($subjectField)) { if ($chiave == $subjectField) { $subject = $valore; } } if (!empty($senderNames)) { for ($i = 0; $i < count ($senderNames); $i++) { if ($chiave == $senderNames[$i]) { $nome .= $valore." "; } } } } if (!empty($subject)) { $oggetto .= " - ".$subject; } if ($html) { $output = getHtmlOutput ($key, $val); $intestazioni = "MIME-Version: 1.0\r\n"; $intestazioni .= "Content-type: text/html; charset=iso-8859-1\r\n"; } else { for ($i = 0; $i < count ($key); $i++) { $output .= $key[$i].": ".$val[$i]."\n"; } $intestazioni = ""; } if ( (!empty($emailMittente)) || (!empty($nome)) ) { $intestazioni .= "From: ".$nome."<".$emailMittente."> \r\n"; } else { $intestazioni .= "From: ".$mittente."\r\n"; } if (!mail($destinatari, $oggetto, $output, $intestazioni)) { echo "
".$messaggioErrore."
".getHtmlOutput($key, $val)."
".getCredits(); if (strlen($paginaErrore) < 5) { exit (); } else { echo ""; } } echo "
".$messaggioConferma."
".getHtmlOutput($key, $val)."
".getCredits(); if (strlen($paginaConferma) < 5) { exit (); } else { echo ""; } function getHtmlOutput ($k, $v) { global $stripsHtml; global $tagAllowed; $return = "
"; $return .= ""; $return .= "Dati inseriti
"; $return .= ""; $return .= ""; for ($i = 0; $i < count ($k); $i++) { $v[$i] = eregi_replace ("\n", "
", $v[$i]); if ($stripsHtml) { $v[$i] = strip_tags ($v[$i], $tagAllowed); } $return .= ""; } $return .= "
".$k[$i].": ".$v[$i]."
"; return $return; } function getCredits () { global $version; $return = "
GC_Formmail ".$version."
Written by Giuseppe Calbi
Check for script updates:
"; return $return; } /* * To Do: * - Limite inserimento ogni n secondi o n richieste al minuto * - Messaggio di conferma al mittente. Più complicato, potrebbe essere hackerato e diventerebbe minaccia seria. */ /* * * Changelog: * 1.2 (21/2/05) * - Configuration file * - Documentation * - Other few changes * * 1.12 (19/2/05) * - Removed backslash before char "'". * - In html output and mail, \n becomes
* - Possibility to strips (all or some) html tags from html ouput * - Possibility to set some field names as Name and Email Address of mail received * - Possibility to set a field as subject after that set in "$oggetto" * - Button green/red to see updates * * 1.11 (18/2/05) * - Added Html Email Format */ ?>