assign('errors', $errors); if ($errors > 0) { $error = array_unique($error); foreach ($error as $key => $value) { $newsletter_errors .= $value; } $smarty->assign('newsletter_errors', $newsletter_errors); } if ($errors == 0) { $sql = "SELECT email FROM diffshop_newsletter WHERE email = '$email' ORDER BY newsletter_id ASC"; $result= mysql_query($sql); if(mysql_num_rows($result) > 0) { $email_exist = "YES"; } else { $email_exist = "NO"; } } if (isset($_POST['newsletter_x'])) { $smarty->assign('post_newsletter', "YES"); } if ($errors == 0) { if ($email_exist == "NO") { /////// insert into database $sql = "INSERT INTO diffshop_newsletter (newsletter_id, firstname, lastname, email, format, active, date_added, date_last_sent) VALUES ('', '', '', '$email', 'HTML', 'Y', ".time().", '0')"; $result = mysql_query($sql) or die("error in query - $sql - ".mysql_error()); /* //////// get email message $query = "SELECT shop_name, shop_email, ".select_language('shop_email_subject_lang1', 'shop_email_subject_lang2', 'shop_email_subject_lang3', 'shop_email_subject_lang4', 'shop_email_subject_lang5', 'shop_email_subject_lang6').", ".select_language('shop_email_description_lang1', 'shop_email_description_lang2', 'shop_email_description_lang3', 'shop_email_description_lang4', 'shop_email_description_lang5', 'shop_email_description_lang6')." FROM diffshop_general_settings_newsletter WHERE id='1'"; $result = mysql_query($query) or die("error in query - $query - ".mysql_error()); while($row = mysql_fetch_array($result)) { $shop_name = $row[0]; $shop_email = $row[1]; $shop_email_subject = magic_quotes_strip($row[2]); $shop_email_description = magic_quotes_strip($row[3]); } ///////// convert message //////////// $shop_email_description = str_replace('%email%', $email, $shop_email_description); $shop_email_description = str_replace('%password%', $password, $shop_email_description); $mail_header = "From: $shop_email\n"; $mail_header .= "Reply-to: $shop_email\n"; $mail_header .= "Content-Type: text/html\n"; mail($email, $shop_email_subject, $shop_email_description, $mail_header); */ } } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*\ $smarty->display('newsletter.tpl'); include ("close_mysql.php"); ?>