";
$errmsg.="
";
$errmsg.=$l_missingemail." | ";
$errors=1;
}
if(!isset($id) || !$id)
{
$errmsg.="";
$errmsg.="| ";
$errmsg.=$l_missingid." |
";
$errors=1;
}
if($errors==1)
{
include_once('./includes/head.inc');
?>
|
";
include_once('./includes/footer.inc');
exit;
}
$sql = "select * from ".$tableprefix."_subscriptions where email='$email' and unsubscribeid='$id'";
if(!$result = mysql_query($sql, $db))
die("| Could not connect to the database.");
$subscriberrow=mysql_fetch_array($result);
$category=$subscriberrow["category"];
$sql = "delete from ".$tableprefix."_subscriptions where email='$email' and unsubscribeid='$id'";
if(!$result = mysql_query($sql, $db))
die(" |
| Could not connect to the database.");
if($subremovenotify==1)
{
if($subscriberrow["category"]>0)
{
$tmpsql="select * from ".$tableprefix."_categories where catnr=".$subscriberrow["category"];
if(!$tmpresult = mysql_query($tmpsql, $db))
die(" |
| Could not connect to the database.".mysql_error());
if($tmprow=mysql_fetch_array($tmpresult))
{
$catname=stripslashes($tmprow["catname"]);
$tmpsql2="select * from ".$tableprefix."_catnames where catnr=".$tmprow["catnr"]." and lang='".$act_lang."'";
if(!$tmpresult2=mysql_query($tmpsql2,$db))
die(" |
| Unable to connect to database.".mysql_error());
if($tmprow2=mysql_fetch_array($tmpresult2))
{
if(strlen($tmprow2["catname"])>0)
$catname=stripslashes($tmprow2["catname"]);
}
}
else
$catname="???";
}
else
$catname=$l_general;
$tmpsql="select u.* from ".$tableprefix."_newsubnotify nsn, ".$tableprefix."_users u where u.usernr=nsn.usernr";
if(!$tmpresult = mysql_query($tmpsql, $db))
die(" |
| Could not connect to the database.".mysql_error());
while($tmprow=mysql_fetch_array($tmpresult))
{
if($tmprow["email"])
{
$tmpsql2="select * from ".$tableprefix."_texts where lang='".$tmprow["language"]."' and textid='remsubsubj'";
if(!$tmpresult2 = mysql_query($tmpsql2, $db))
die(" |
| Could not connect to the database.".mysql_error());
if(!$tmprow2=mysql_fetch_array($tmpresult2))
$subject=$l_remsubsubj;
else
$subject=undo_htmlspecialchars($tmprow2["text"]);
$subject=str_replace("{sitename}",$simpnewssitename,$subject);
$subject=strip_tags($subject);
$tmpsql2="select * from ".$tableprefix."_texts where lang='".$tmprow["language"]."' and textid='remsubmsg'";
if(!$tmpresult2 = mysql_query($tmpsql2, $db))
die(" |
Could not connect to the database.".mysql_error());
if(!$tmprow2=mysql_fetch_array($tmpresult2))
$mailmsg=$l_remsubmsg;
else
$mailmsg=undo_htmlspecialchars($tmprow2["text"]);
$mailmsg=str_replace("{sitename}",$simpnewssitename,$mailmsg);
$mailmsg=str_replace("{email}",$subscriberrow["email"],$mailmsg);
$mailmsg=str_replace("{category}",$catname,$mailmsg);
$mailmsg_asc=str_replace(" ","\r\n",$mailmsg);
$mailmsg_asc=strip_tags($mailmsg_asc);
$mail = new htmlMimeMail();
$mail->setCrlf($crlf);
$mail->setTextWrap($mailmaxlinelength);
$mail->setHTMLCharset($contentcharset);
$mail->setTextCharset($contentcharset);
$mail->setHTML($mailmsg,$mailmsg_asc);
$mail->setSubject($subject);
if($simpnewsmailname)
$fromadr="\"$simpnewsmailname\" <$simpnewsmail>";
else
$fromadr=$simpnewsmail;
$mail->setFrom($fromadr);
$receiver=array();
array_push($receiver,$tmprow["email"]);
if(!$insafemode)
@set_time_limit($msendlimit);
if($use_smtpmail)
{
$mail->setSMTPParams($smtpserver,$smtpport,NULL,$smtpauth,$smtpuser,$smtppasswd);
$sendresult=$mail->send($receiver, "smtp");
}
else
$sendresult=$mail->send($receiver, "mail");
do_emaillog($sendresult,$tmprow["email"],"delete subscription");
}
}
}
$redirect=1;
include_once('./includes/head.inc');
?>
|
|
";
echo "";
echo "$l_unsubscribed | ";
if($subredirecturl)
$backurl=$subredirecturl;
else if(!isset($backurl))
{
if(!isset($category))
$category=0;
$backurl="news.php?$langvar=$act_lang&layout=$layout&category=$category";
}
if($redirectdelay>=0)
{
echo "";
echo "| ";
echo "$l_redirected |
";
}
echo "";
echo "| ";
echo "$l_news |
";
echo "";
include_once('./includes/footer.inc');
exit;
?>