include "../rcontrol/config.php";
include "../rcommon/functions.php";
include "../rcommon/database.php";
if($submit)
{
$emailto="webmaster@yarsandfibers.com";
$headers = "From:support@yarnsandfibers.com\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "bcc:juzer@yarnsandfibers.com,webmaster@yarnsandfibers.com,murthy@yarnsandfibers.com\r\n";
//if he is a member of yarnsandfibers.com
if($member=='Y')
{
$sql="select login, companyname from member where email='$email'";
$result=mysql_db_query($DATABASE,$sql);
if(mysql_num_rows($result))
{
while($row=mysql_fetch_row($result))
{
$login=$row[0];
$cname=$row[1];
$update="update member set newsletter='N' where login='$login'";
$resultu=mysql_db_query($DATABASE,$update);
$subject="$cname unsubcribed newsletter";
$content="Login : $login \n
Companyname : $cname\n
Email : $email has unsubscribed the newsletter";
//echo $content."
";;
mail($emailto, "$subject", "$content", $headers);
}//end of while
}//end of if result
}//end of if member
//if he is a member of direct email table
if($member=='N')
{
$sql="select * from directemail where emailid='$email'";
$result=mysql_db_query($DATABASE,$sql);
if(mysql_num_rows($result))
{
while($row=mysql_fetch_row($result))
{
$update="update directemail set flagunsub='Y' where emailid='$email'";
$resultu=mysql_db_query($DATABASE,$update);
$subject="$email has unsubcribed for directemail";
$content="The following member from our Direct mailing database with email ID : $email has unsubscribed.";
mail($emailto, "$subject", "$content", $headers);
}//end of while
}//end of if result
}//end of if member
header("location:thankyou.php");
exit();
}//end of if submit
?>
|
|||