Hi Everyone,
I am new to this site and hope I am posting in the right area. I have a website and I need help with some coding. I need to limit the amount of newsletters that are sent out to my registered users.
Can someone tell me how to add a line or so in this script to maybe choose sending to members 1 - 200 and then I could change to at any time to send it to different member numbers?
I really appreciate any information that is given. Thank you so much for your time.
Here is the newsletter script:
<? require_once("../conn.php"); require_once("access.php"); require_once("AdminNavigation.php"); if(isset($_POST[s1])) { $q1 = "select * from class_members"; $r1 = mysql_query($q1) or die(mysql_error()); while($a1 = mysql_fetch_array($r1)) { $to = $a1[email]; $subject = $_POST[sub]; $message = $_POST[MyMessage]; $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/plain; charset=iso-8859-1\n"; $headers .= "Content-Transfer-Encoding: 8bit\n"; $headers .= "From: $_SERVER[HTTP_HOST] <$aset[ContactEmail]>\n"; $headers .= "X-Priority: 1\n"; $headers .= "X-MSMail-Priority: High\n"; $headers .= "X-Mailer: PHP/" . phpversion()."\n"; mail($to, $subject, $message, $headers); $i++; } $error = "$i messages was sent"; } //get the number of registered members $q1 = "select count(*) from class_members"; $r1 = mysql_query($q1) or die(mysql_error()); $a1 = mysql_fetch_array($r1); if($a1[0] == 0) { echo "There are no registered members, yet!"; exit(); } ?>
Newsletter <?=$error?> |
|
Subject: | |
Message: | |
  |