Viewing file: print_list.php (4.55 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<? include("../include/settings"); include("../include/db_connect");
if ($type == "update"){ $query = "SELECT first, last, address, ID FROM email ORDER BY last, first"; $email_data = mysql_query($query, $db); $rows = mysql_num_rows($email_data);
for ($i = 0; $i < $rows; $i++){ $first = mysql_result($email_data, $i, 'first'); $last = mysql_result($email_data, $i, 'last'); $address = mysql_result($email_data, $i, 'address'); $ID = mysql_result($email_data, $i, 'ID'); $recipient[]= array("first" => $first, "last" => $last, "address" => $address, "ID" => $ID); } } else{ $query = "SELECT address, active, option_1, option_2, option_3, option_4, option_5 FROM email ORDER BY address"; $email_data = mysql_query($query, $db); $rows = mysql_num_rows($email_data);
for ($i = 0; $i < $rows; $i++){ $address = mysql_result($email_data, $i, 'address'); $send = mysql_result($email_data, $i, 'active'); $option_1 = mysql_result($email_data, $i, 'option_1'); $option_2 = mysql_result($email_data, $i, 'option_2'); $option_3 = mysql_result($email_data, $i, 'option_3'); $option_4 = mysql_result($email_data, $i, 'option_4'); $option_5 = mysql_result($email_data, $i, 'option_5'); if ($send == "yes"){ $active[]= array("address" => $address, "option_1" => $option_1, "option_2" => $option_2, "option_3" => $option_3, "option_4" => $option_4, "option_5" => $option_5); } else{ $inactive[] = array("address" => $address); } } }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html> <head> <title>List of e-mail subscribers</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <br> <center> <span class="title"><?print(($type == "update") ? "Update e-mail subscriber information" : "E-mail addresses of active subscribers");?></span><br><br> </center>
<table border="2" bordercolor="#222244" cellpadding="0" cellspacing="0" align="center"><tr><td> <table align="center" border="0"cellpadding="0" cellspacing="8">
<? if ($type == "update"){ //do this for clickable names to modify record print("\t<tr>\n"); print("\t\t<td colspan=\"2\" align=\"center\">\n"); print("\t\t<b>Click on a name below to update record</b>\n"); print("\t\t<hr width=\"90%\" size=\"1\" noshade>\n"); print("\t\t</td>\n"); print("\t</tr>\n"); for ($i = 0; $i < $rows; $i++){ $address = $recipient[$i]["address"]; $last = $recipient[$i]["last"]; $first = $recipient[$i]["first"]; $ID = $recipient[$i]["ID"]; $address = $recipient[$i]["address"]; print("\t<tr>\n"); print("\t\t<td><a href=\"e-mail_form.php?ID=$ID\">$last, $first</a></td>\n"); print("\t\t<td>$address</td>\n"); print("\t</tr>\n"); } } // end of if type=update else{ //do this to print out mailing list
print("\t<tr>\n"); print("\t\t<td width=\"400\"><b>Active e-mail list addresses</b><hr width=\"90%\" size=\"1\" noshade></td>\n"); print("\t</tr>\n"); print("\t<tr>\n"); print("\t\t<td><b>All active addresses:</b></td>\n"); print("\t</tr>\n"); print("\t<tr>\n"); print("\t\t<td bgcolor=\"#ffffcc\">\n"); for ($i = 0; $i < count($active); $i++){ $address = $active[$i]["address"]; print("$address"."; "); } print("\t\t</td>\n"); print("\t</tr>\n"); print("\t<tr>\n"); print("\t\t<td><b>Active option 1 addresses:</b></td>\n"); print("\t</tr>\n"); print("\t<tr>\n"); print("\t\t<td bgcolor=\"#ffffcc\">\n"); for($i = 0; $i < count($active); $i++){ $address = $active[$i]["address"]; $option_1 = $active[$i]["option_1"]; print($option_1 == "yes" ? "$address"."; " : ""); } print("\t\t</td>\n"); print("\t</tr>\n"); print("\t<tr>\n"); print("\t\t<td><b>Active option 2 addresses:</b></td>\n"); print("\t</tr>\n"); print("\t<tr>\n"); print("\t\t<td bgcolor=\"#ffffcc\">\n"); for($i = 0; $i < count($active); $i++){ $address = $active[$i]["address"]; $option_2 = $active[$i]["option_2"]; print($option_2 == "yes" ? "$address"."; " : ""); } print("\t\t</td>\n"); print("\t</tr>\n"); print("\t<tr>\n"); print("\t\t<td><hr width=\"70%\" size=\"1\" noshade></td>\n"); print("\t</tr>\n"); print("\t<tr>\n"); print("\t\t<td><b><i>Inactive</i> addresses:</b></td>\n"); print("\t</tr>\n"); print("\t<tr>\n"); print("\t\t<td bgcolor=\"#ffffcc\">\n"); for($i = 0; $i < count($inactive); $i++){ $address = $inactive[$i]["address"]; print("$address"."; "); } print("\t\t</td>\n"); print("\t</tr>\n"); } ?> <tr> <td colspan="2" align="center"><br> <a href="index.php">Back to Admin. index</a><br> </td> </tr> </table> </tr></td></table>
|