<?php

include '../inc/sqlinf.php';
include "../inc/auth.php";
include 'apple.inc';

$idn = $_POST['idn'];

?>

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" link="#000000" vlink="#000000" alink="#000000">
<table width="100%" border="5" cellspacing="0" cellpadding="0" bordercolor="#FFFFFF">
  <tr> 
        <td> 
          <table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="#FFFFFF" bordercolor="#FFFFFF">
                <tr bgcolor="#000066"> 
                  <td width="100%" colspan="2"> <font color="#FFFFFF">&raquo;</font><b><font color="#FFFFFF"> 
                        Mailing List | <a href="mailinglist.php" target="main"><font color="#CCCCCC">Refresh</font></a></font></b></td>
                </tr>
                <tr> 
                  <td bgcolor="#EEEEEE" width="10%" valign="top"> 
                        <form name="form1" method="post" action="mailinglist.php">
                          <table cellspacing="1" cellpadding="2" border="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
                                <tr> 
                                  <td bgcolor="#F9F9F9"> 
                                        <div align="center"> <b><font color="#000000"> 
                                          <select name="type" size="10">
                                                <?PHP
$SQL = "SELECT * from HOSTINGPACKAGES";
$result = mysql_query( $SQL );
while( $row = mysql_fetch_array( $result ) ) {
$product = $row["NAME"];
ECHO "<option value=\"$product\">$product</option>";
}

?>
                                          </select>
                                          </font></b></div>
                                  </td>
                                </tr>
                                <tr bgcolor="#F9F9F9"> 
                                  <td> 
                                        <div align="center">
                                          <input type="submit" name="Filter" value="Filter">
                                        </div>
                                        </td>
                                </tr>
                          </table>
                        </form>
                  </td>
                  <td bgcolor="#F9F9F9" width="90%"> 
                        <form name="form1" method="post" action="app/mass.php" target="main">
                          <table cellspacing="1" cellpadding="2" border="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
                                <tr bgcolor="#F9F9F9" valign="top"> 
                                  <td bgcolor="#FFFFFF"> 
                                        <div align="center"><font color="#000000"><b><font color="#000000"><b><font color="#000000"><b> 
                                          <select name="to[]" size="10" multiple>
                                                <?PHP
$type = $_POST['type'];
if (empty($type)){
$SQL = "SELECT * from MAILINGLIST";
$result = mysql_query( $SQL );
while( $row = mysql_fetch_array( $result ) ) {
$payer_email = $row["PAYER_EMAIL"];
$product = $row["PRODUCT"];

echo "<option value=\"$payer_email\">$payer_email | $product";
}
}

else {
$SQL = "SELECT * from MAILINGLIST WHERE PRODUCT = '$type'";
$result = mysql_query( $SQL );
while( $row = mysql_fetch_array( $result ) ) {
$payer_email = $row["PAYER_EMAIL"];
$product = $row["PRODUCT"];

echo "<option value=\"$payer_email\">$payer_email | $product";
}
}
?>
                                          </select>
                                          </b></font></b> </font></b></font></div>
                                  </td>
                                  <td bgcolor="#FFFFFF"> <font color="#000000"><b><font color="#000000"><b><font color="#000000"> 
                                        <textarea name="message" cols="45" rows="10"><?PHP echo $message; ?>

</textarea>
                                        </font> </b> </font></b></font></td>
                                  <td bgcolor="#FFFFFF">
                                        <table cellspacing="1" cellpadding="2" border="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
                                          <tr bgcolor="#F9F9F9"> 
                                                <td bgcolor="#F9F9F9"> 
                                                  <div align="center"><font color="#000000"><font color="#000000"><b><font color="#000000"><b><font color="#000000"><b><font color="#000000"><font color="#000000"><b><font color="#000000">From 
                                                        </font></b></font></font></b> </font></b></font></b></font></font></div>
                                                </td>
                                                <td bgcolor="#FFFFFF"> 
                                                  <div align="center"><font color="#000000"><b><font color="#000000"><font color="#000000"><b><font color="#000000"><font color="#000000"><b><font color="#000000"><font color="#000000"><b><font color="#000000"><b><font color="#000000"> 
                                                        <input type="text" name="from" size="20">
                                                        </font></b></font></b></font></font></b></font></font></b></font></font></b></font></div>
                                                </td>
                                          </tr>
                                          <tr bgcolor="#F9F9F9"> 
                                                <td bgcolor="#F9F9F9"><font color="#000000"><b><font color="#000000"><font color="#000000"><b><font color="#000000"><font color="#000000"><b><font color="#000000"><b><font color="#000000"><b><font color="#000000"><font color="#000000"><b><font color="#000000"><font color="#000000"><b><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><b>Subject</b></font></font></font></font></font></b></font></font></b></font></font></b></font></b></font></b></font></font></b></font></font></b></font></td>
                                                <td bgcolor="#FFFFFF"><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><b><font color="#000000"><font color="#000000"><b><font color="#000000"><font color="#000000"><b><font color="#000000"><b><font color="#000000"><b><font color="#000000"><font color="#000000"><b><font color="#000000"><font color="#000000"><b><font color="#000000"> 
                                                  <input type="text" name="subject" size="20">
                                                  </font></b></font></font></b></font></font></b></font></b></font></b></font></font></b></font></font></b></font></font></font></font></font></td>
                                          </tr>
                                        </table>
                                  </td>
                                </tr>
                                <tr bgcolor="#F9F9F9" valign="top"> 
                                  <td bgcolor="#FFFFFF" colspan="3"> 
                                        <div align="right"><font color="#000000"> 
                                          <input type="submit" name="Send" value="Send">
                                          </font></div>
                                  </td>
                                </tr>
                          </table>
                          <br>
                        </form>
                  </td>
                </tr>
                <tr bgcolor="#000066"> 
                  <td width="100%" colspan="2"> <font color="#FFFFFF">&raquo;<b> Mailing 
                        List Management</b></font></td>
                </tr>
                <tr> 
                  <td bgcolor="#EEEEEE" width="10%">&nbsp; </td>
                  <td bgcolor="#F9F9F9" width="90%"> 
                        <form name="form2" method="post" action="app/deletemail.php?refresh=mailinglist.php">
                          <table cellspacing="1" cellpadding="2" border="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
                                <tr bgcolor="#F9F9F9"> 
                                  <td bgcolor="#FFFFFF"> 
                                        <div align="center"><font color="#000000"><b> 
                                          <select name="delete" size="10">
                                                <?PHP
$type = $_POST['type'];
if (empty($type)){
$SQL = "SELECT * from MAILINGLIST";
$result = mysql_query( $SQL );
while( $row = mysql_fetch_array( $result ) ) {
$payer_email = $row["PAYER_EMAIL"];
$product = $row["PRODUCT"];
$DEL = $row["ID"];

echo "<option value=\"$DEL\">$payer_email | $product";
}
}

else {
$SQL = "SELECT * from MAILINGLIST WHERE PRODUCT = '$type'";
$result = mysql_query( $SQL );
while( $row = mysql_fetch_array( $result ) ) {
$payer_email = $row["PAYER_EMAIL"];
$product = $row["PRODUCT"];

echo "<option value=\"$DEL\">$payer_email | $product";
}
}
?>
                                          </select>
                                          </b></font></div>
                                  </td>
                                </tr>
                                <tr bgcolor="#F9F9F9"> 
                                  <td bgcolor="#F9F9F9"> 
                                        <div align="center"><font color="#000000"> 
                                          <input type="submit" name="Delete" value="Delete">
                                          </font></div>
                                  </td>
                                </tr>
                          </table>
                          <font color="#000000"><font color="#000000"><br>
                          </font></font> 
                        </form>
                  </td>
                </tr>
          </table>
        </td>
  </tr>
</table>
<div align="center"></div>
<div align="right"></div>
                                  </body>
</html>
