salve mi date una man ho uno script che inserisce i dati nel db inpiu mi avvisa che l utente si e iscritto alla newsletter e manda automaticamente un messaggio di conferma agli utenti pero c e un problema non va secondo voi qual e il problema? posto lo script<?php include_once("include/config.php");
$adminaddress = "info@marikwebdesigner.com"; $siteaddress ="http://www.marikwebdesigner.com"; $sitename = "marikwebdesigner";
$CONFIG['expire'] = 60; $CONFIG['regexpire'] = 24; //in ore
$CONFIG['check_table'] = array( "name" => "check_global", "email" => "check_global" ); function check_email($value) { global $CONFIG;
$value = trim($value);
if (($value == "")) { echo"&error =<b>Il campo non può essere lasciato vuoto"; } else{ $query = @mysql_query("SELECT id FROM mailing WHERE email='$value'")or die("&error= Errore nella query");
if (@mysql_num_rows($query) != 0) return "&mess= Email già utilizzata"; else return"OK"; } } //-------------- define('AUTH_LOGGED', 99); define('AUTH_NOT_LOGGED', 100);
define('AUTH_USE_COOKIE', 101); define('AUTH_USE_LINK', 103); define('AUTH_INVALID_PARAMS', 104); define('AUTH_LOGEDD_IN', 105); define('AUTH_FAILED', 106);
define('REG_ERRORS', 107); define('REG_SUCCESS', 108); define('REG_FAILED', 109);
$conn = @mysql_connect($CONFIG['host'], $CONFIG['user'], $CONFIG['pass']) or die("&error= Impossibile stabilire una connessione"); @mysql_select_db($CONFIG['dbname']) or die("Errore nel DB");
//No need to change anything below ... // Gets the date and time from your server $date = date("d/m/Y H:i:s");
// Gets the IP Address if ($_SERVER['REMOTE_ADDR'] == "") { $ip = "no ip"; } else { $ip = gethostbyaddr($_SERVER['REMOTE_ADDR']); }
// Gets the POST Headers - the Flash variables $action = $_REQUEST['action'] ; $name = $_REQUEST['name'] ; $email = $_REQUEST['email'] ; //Process the form data! // and send the information collected in the Flash form to Your nominated email address
if ($action == "send") { //Innanzitutto controlliamo la var.le name: $controllo = check_email($email);
if ($controllo != "OK") { echo $controllo;
//Qui potresti anche far visualizzare una cosa del genere: echo "&mess=<BR><A HREF=\"http://www.marikweb.com/homeita/\">Ritorna alla registrazione</A>"; } else { //Ora inseriamo i dati nel DB. //Ovviamente devi creare una tabella in cui inserire i dati ke passi con il post.
$link_db = mysql_connect($CONFIG['host'],$CONFIG['user'],$CONFIG['pass']); mysql_select_db($CONFIG['dbname']); $sql_insert = "INSERT INTO mailing (name,email) VALUES ('$name','$email')"; if (mysql_query($sql_insert)) { echo "&mess= OK RIGA INSERITA <br/>"; } else { die(mysql_error()); }
mysql_close($link_db);
//A questo punto inviamo l'e-mail mail ("$adminaddress","informazioni", "L'utente: $name si è iscritto alla MailingList ------------------------------ Name Utente: $name EmailUtente: $emailn ------------------------------
Logged Info : ------------------------------ Using: {$_SERVER['HTTP_USER_AGENT']} Hostname: $ip IP address: {$_SERVER['REMOTE_ADDR']} Date/Time: $date","FROM:$email" ) ; //This sends a confirmation to your visitor mail ("$email","Re:", "Salve $name,n Per confermare l'iscizione alla Newsletter Le basta cliccare sul link sottostante $siteaddress/homeita/mailinglist/conferma.php?email=$email&name=$name
Saluti dallo Staff di $sitename $siteaddress","FROM:$adminaddress") ;
//Confirmation is sent back to the Flash form that the process is complete $sendresult = "Thank you. You will receive a confirmation email shortly."; $send_answer = "answer="; $send_answer .= rawurlencode($sendresult); echo $send_answer; } }//
?>