$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();
}
$dtnum = date(Ymd);
$today = date("F j, Y");
$subject = $_POST['subject'];
if($subject == ""){
echo("Missing a Subject.
Please go back and correct.
");
exit();
}
$greeting = $_POST['greeting'];
$message = $_POST['message'];
if($message == ""){
echo("No Message.
Please go back and correct.
");
exit();
}
$out = array("\"","\'");
$in = array(""","’");
$mess = str_replace($out, $in, $message);
$messo = nl2br($mess);
$link_ex = $_POST['link_ex'];
$link = $_POST['link'];
$closing = $_POST['closing'];
$nlist = $_POST['nlist'];
$namo = explode("\r\n", $nlist);
$namcount = count($namo);
if($namcount < 1){
echo("No Name List.
Please go back and correct.");
exit();
}
$elist = $_POST['elist'];
$emo = explode("\r\n", $elist);
$emcount = count($emo);
if($emcount < 1){
echo("
No Address List.
Please go back and correct.");
exit();
}
if($namcount != $emcount){
echo("
Name List does not match Email List.
Please go back and correct.");
exit();
}
$dbcnx = @mysql_connect('mysql.plainhost.com', 'ecosmar_ecosmart', 'ecoman1');
mysql_select_db('ecosmar_contacts', $dbcnx);
$oot = mysql_query("SELECT address FROM em_out");
if(!$oot){
echo("
Could not check out list.
".mysql_error()."
");
}else{
while($row = mysql_fetch_array($oot)){
$em_out[] = $row['address'];
}
}
mysql_select_db('ecosmar_friendly', $dbcnx);
$checkit = mysql_query("SELECT ID from ml_temp WHERE subject='$subject'");
if(!$checkit){
echo("Could not check for message status".mysql_error()."
");
}else{
$numrows = mysql_num_rows($checkit);
$new = mysql_fetch_array($checkit);
$oldMID = $new['ID'];
}
if($numrows < 1){
$setit = mysql_query("INSERT INTO ml_temp SET subject='$subject',greeting='$greeting',message='$mess',link_ex='$link_ex',link='$link',closing='$closing',dtnum='$dtnum'");
if(!$setit){
echo("Email message not saved.
".mysql_error()."
");
}
$query = mysql_query("SELECT LAST_INSERT_ID()");
mysql_query( $query );
$MID = mysql_insert_id();
}else{
$MID = $oldMID;
$setup = mysql_query("UPDATE ml_temp SET subject='$subject',greeting='$greeting',message='$mess',link_ex='$link_ex',link='$link',closing='$closing',dtnum='$dtnum' WHERE subject='$subject'");
if(!$setup){
echo("Email message not updated.
".mysql_error()."
");
}
}
$nono = 0;
$c = 0;
while($c < $namcount){
$namcut = explode(' ', $namo[$c]);
$blammo = count($namcut);
if($blammo < 2){
$nono = 1;
}elseif($blammo == 3){
$nam = $namcut[0]." ".$namcut[2];
}elseif($blammo == 4){
$nam = $namcut[0]." ".$namcut[3];
}else{
$nam = $namo[$c];
}
if($nono != 1 and $emo[$c] != ""){
if(!in_array($emo[$c], $em_out)){
$lista[] = $nam." ".$emo[$c];
}
}
$c = $c + 1;
}
$listcount = count($lista);
if($listcount > 30){
$warn = 'on';
$tonot = "Too many recipients.
TO list has been shortened to the first 30.
";
$listleft = array_slice($lista, 30);
$lista = array_slice($lista, 0, 30);
}
?>
Eco-$mart Mail-room
Email from Non-Contact List
Create Email for Outside List
|
Help
|
©2007 - Data Base Interface - Custom Built at:
|