$dnum = date(Ymd)*4;
$from = $_GET['fr'];
if($from == ""){
$from = $_POST['fr'];
}
if($from != $dnum){
echo("<<<<Restricted Area>>>>" .
"
Sorry, you must Log In to view this Page
");
exit();
}
$usrn = $_GET['usrn'];
if($usrn == ""){
$usrn = $_POST['usrn'];
}
if($usrn == ""){
echo("<<<<Restricted Area>>>>" .
"
Problem with your username. Please Log In again.
");
exit();
}
$done = $_POST['done'];
$temp = $_POST['temp'];
$dbcnx = @mysql_connect('mysql.plainhost.com', 'ecosmar_ecosmart', 'ecoman1');
if($temp != ""){
mysql_select_db('ecosmar_friendly', $dbcnx);
$temp = @mysql_query("SELECT listit FROM ml_temp WHERE ID='$temp'");
if(!$temp){
echo("Error retrieving Email Template Recipients.
" . "Error: " . mysql_error(). "
");
}else{
$t_row = mysql_fetch_row($temp);
$t_l = $t_row['listit'];
$t_li = explode("-",$t_l);
foreach($t_li as $value){
$t_cut = explode(":",$value);
$t_nam[] = $t_cut[0];
}//foreach
}//else
}else{
$t_nam[] = "NO LIST";
}//else
$replistdo = $_POST[replist];
print_r($replistdo);
$replistrem = $_POST[replistrem];
print_r($replistrem);
if(empty($replistdo)){
$rep0 = "on";
}else{
mysql_select_db('ecosmar_website', $dbcnx);
foreach($replistdo as $value){
$listaddy = @mysql_query("SELECT usrn,email FROM psw WHERE usrn='$value' ORDER BY last_name");
if (!$listaddy) {
echo("Error getting representative addresses.
" . "Error: " . mysql_error(). "
");
}else{
while($adrow = mysql_fetch_array($listaddy)){
$repnam = $adrow['usrn'];
if(!in_array($repnam, $replistrem) and !in_array($repnam, $t_nam)){
$repnames[] = $repnam;
$repna[] = $repnam.":".$adrow['email'];
}//if
}//while
}//else
}//foreach
} //else
$bizlistdo = $_POST[bizlist];
print_r($bizlistdo);
$bizlistremdo = $_POST[bizlistrem];
print_r($bizlistremdo);
if(!empty($bizlistremdo)){
foreach($bizlistremdo as $value){
$bizlistrema[] = $value;
}
}
if(empty($bizlistdo)){
$biz0 = "on";
}else{
mysql_select_db('ecosmar_contacts', $dbcnx);
foreach($bizlistdo as $value){
$bizcheck = @mysql_query("SELECT first_Name,Name,email FROM con_main WHERE biztype='$value' AND mkt='1' ORDER BY Name");
if (!$bizcheck) {
echo("Error getting business addresses.
" . "Error: " . mysql_error(). "
");
}else{
while($badrow = mysql_fetch_array($bizcheck)){
$bizremc = $badrow['email'];
if(ereg("@", $bizremc)){
if(!in_array($bizremc, $bizlistrema) and !in_array($bizremc, $t_nam)){
$name1a = $badrow['first_Name'];
$name1b = explode(" ",$name1a);
$name1count = count($name1b);
$name1 = $name1b[0];
$name2a = $badrow['Name'];
$name2b = explode(",",$name2a);
$name2 = $name2b[0];
$bizna[] = $name1." ".$name2.":".$bizremc;
$bizname[] = $name1." ".$name2;
$bize[] = $bizremc;
}//if
}//if
}//while
}//else
}//foreach
}//else
$rcount = count($repna);
$bcount = count($bizna);
$tcount = $rcount + $bcount;
if($tcount > 30){
$alarm = "on";
$whattodo = "Edit Recipient List";
$messcolor = "red";
$alrmess = "There are too many contacts in this list to email all at once.";
$there = "ml_makelist.php";
$button = "Enter";
$color = "yellow";
}else{
$alarm = "off";
}
if($alarm != "on" and $done !="on"){
$whattodo = "Edit Recipient List";
$messcolor = "black";
$alrmess = "You may continue to edit. Check "Finished Editing" below when done.";
$there = "ml_makelist.php";
$button = "Enter";
$color = "white";
}
if($alarm != "on" and $done =="on"){
$whattodo = "Make Email";
$there = "ml_makemail.php";
$button = "Make Email";
$color = "white";
}
?>
Eco-$mart Mail-room
Send Email
©2007 - Data Base Interface - Custom Built at:
|