require_once 'views/menu_left_blank.php'; $err = ''; $done = FALSE; // needs to be a GET so this hack had to be! if (!isset($_POST['email']) && isset($_GET['email'])) { $_POST['email'] = $_GET['email']; } // check to see if the page has been submitted if (echo_value('page_flag', FALSE) == 'unsubscribe') { $email = echo_value('email', FALSE); $row = db_fetch("SELECT id FROM " . TABLE_COMMUNITY . " WHERE email='{$email}'"); if ($row['id'] == null) { $err = array('This email does not exist in our database!'); } else { insert_value('newsletter', '0', $row['id']); $r = send_newsletter_auto_email($email, true); $done = TRUE; } } ?> <div id="content"> <div id="title"> <div class="text">Unsubscribe Newsletter Service</div> </div> <?php if ($err) { ?> <div class="error_message"><?php echo implode('<br />', $err); ?> </div>
//-------------------------------------------------------------- $s = 'emailAddress'; #if (!isset($_REQUEST[$s])) { die(); } else { $email_to = $_REQUEST[$s]; } if (isset($_REQUEST[$s])) { $email = strip_tags(htmlentities($_REQUEST[$s])); } else { exit("ERROR"); } //-------------------------------------------------------------- $r = create_file($folder_name, $filename); $s = $displayDate . ',' . $displayTime . ','; $s .= '"' . $email . '"' . "\r\n"; $r = write_file($filename, $s); //-------------------------------------------------------------- $r = send_newsletter_email($email); $r = send_newsletter_auto_email($email); //-------------------------------------------------------------- // add to DB $row = mysql_fetch_assoc(mysql_query("SELECT id, email, title, forename, surname FROM " . TABLE_COMMUNITY . " WHERE email='" . $email . "'")); check_db_error(); // id exists if ($row['email']) { $pid = $row['id']; } else { $sql_cmd = "\tINSERT INTO " . TABLE_COMMUNITY . " (dt, mdt, email)\n\t\t\t\t\tVALUES(\n\n\t\t\t\t\t\tNOW(),\n\t\t\t\t\t\tNOW(),\n\t\t\t\t\t\t'" . $email . "'\n\n\t\t\t\t\t)"; mysql_query($sql_cmd); check_db_error(); $pid = mysql_insert_id(); } insert_value('newsletter', '1', $pid); //--------------------------------------------------------------