<?php
/***************************************************************************
File Name : index.php
Domain : http://www.Triangle-Solutions.com/
----------------------------------------------------------------------------
Author : Ian Warner
Copyright : (C) 2001 Triangle Solutions Ltd
Email : hide@address.com
URL : http://www.triangle-solutions.com/
Description : Brings together all the elements of the newsletter app.
Date Created : Tuesday 24 February 2004 11:31:44
File Version : 2.7
\\||************************************************************************/
#############################################################################################
######################### CURRENT CASEID'S ON THIS PAGE ##############################
#############################################################################################
// home - Literally shows the front page of the newsletter - and processes the join.
// archive - Shows an archive of the past sent newsletters without the template.
// unregister - Allows the user to unsubscribe from there registered newsletters.
// verify - Makes the users verify there email address - set in config to TRUE or FALSE
#############################################################################################
############ INCLUDE THE CONFIG, FUNCTIONS, LANGUAGE AND HEADER FILE #################
#############################################################################################
include ('config.php');
include ('class/functions.php');
IF (!isset($_REQUEST['lang']))
$_REQUEST['lang'] = $langdefault;
include ('language/'.$_REQUEST['lang'].'.php');
include ('header.php');
#############################################################################################
########## MAKE SURE THE RIGHT CASEID IS ENTERED OR DEFAULT TO HOME ID ###############
#############################################################################################
IF (!isset($_GET['caseid']) || $_GET['caseid'] == '' || $_GET['caseid'] != 'home' && $_GET['caseid'] != 'archive' && $_GET['caseid'] != 'unregister' && $_GET['caseid'] != 'trackit' && $_GET['caseid'] != 'verify')
$_GET['caseid'] = 'home';
#############################################################################################
############################# DISPLAY THE PAGE TITLE #################################
#############################################################################################
IF ($_GET['caseid'] != 'trackit')
{
?>
<TABLE Width=<?= $maintablewidth ?> Cellspacing=0 Cellpadding=0 Border=0 Align=<?= $maintablealign ?>>
<TR>
<TD><A HREF=<?= $_SERVER['PHP_SELF'] ?>><IMG SRC=images/mulitple_newsletter_logo.gif Width=83 Height=61 title='PHP Multiple Newsletters' alt='PHP Multiple Newsletters' Vspace=1 Border=0></TD>
</TR>
</TABLE>
<TABLE Width=<?= $maintablewidth ?> Cellspacing=1 Cellpadding=1 Border=1 Bordercolor=#000000 Align=<?= $maintablealign ?>>
<TR Bgcolor=<?= $backout ?>>
<TD Bgcolor=<?= $background ?>><P><A HREF=<?= $_SERVER['PHP_SELF'] ?> OnMouseOver="window.status='<?= $text_titlelink ?>';return true;" OnMouseOut="window.status=' ';return true;"><?= $text_titlelink ?></A> <?= $text_title ?></TD>
<TD Width=12% OnMouseOver="this.style.background='<?= $backover ?>';window.status='<?= $text_joinbutton ?>';return true;" OnMouseOut="this.style.background='<?= $backout ?>';window.status=' ';return true;" Align=Center><A HREF=<?= $_SERVER['PHP_SELF'] ?>?caseid=home Style=Width:100%;Color:#000000><?= $text_joinbutton ?></TD>
<TD Width=12% OnMouseOver="this.style.background='<?= $backover ?>';window.status='<?= $text_archivebutton ?>';return true;" OnMouseOut="this.style.background='<?= $backout ?>';window.status=' ';return true;" Align=Center><A HREF=<?= $_SERVER['PHP_SELF'] ?>?caseid=archive Style=Width:100%;Color:#000000><?= $text_archivebutton ?></TD>
<TD Width=12% OnMouseOver="this.style.background='<?= $backover ?>';window.status='<?= $text_unregisterbutton ?>';return true;" OnMouseOut="this.style.background='<?= $backout ?>';window.status=' ';return true;" Align=Center><A HREF=<?= $_SERVER['PHP_SELF'] ?>?caseid=unregister Style=Width:100%;Color:#000000><?= $text_unregisterbutton ?></TD>
</TR>
</TABLE>
<?php
}
#############################################################################################
##### START OF THE SWITCH FOR THE CASEID IE WHAT PAGE THIS IS HOME - ARCHIVE ETC #####
#############################################################################################
SWITCH ($_GET['caseid'])
{
#############################################################################################
########## HOME CASE THIS DEALS WITH THE SUBMISSION PAGE FOR THE NEWSLETTER ##########
#############################################################################################
CASE 'home':
// DISPLAY ERROR IF NO NEWSLETTER IS SELECTED
IF (isset($_POST['form']) && !isset($_POST['newsletter']))
{
?>
<TABLE Width=<?= $maintablewidth ?> Cellspacing=1 Cellpadding=1 Border=1 Bordercolor=#000000 Align=<?= $maintablealign ?>>
<TR Bgcolor=#AACCEE>
<TD><P>Please select a Newsletter</TD>
</TR>
</TABLE>
<?php
}
// CHECK FOR ERRORS IN THE SUBMITTED FORM
IF (isset($_POST['form']) && isset($_POST['newsletter']))
{
?>
<TABLE Width=<?= $maintablewidth ?> Cellspacing=1 Cellpadding=1 Border=1 Bordercolor=#000000 Align=<?= $maintablealign ?>>
<TR>
<TD><BR>
<TABLE Width=300 Cellspacing=1 Cellpadding=1 Border=1 Bordercolor=#000000 Align=Center>
<TR>
<TD Bgcolor=<?= $background ?>><P><B><?= $text_name ?>:</TD>
<TD><P>
<?php
// EXAMINE NAME IF NAME IS NOT THERE THEN DO ERROR
IF ($_POST['name'] != '')
echo stripslashes($_POST['name']);
ELSE
{
echo '<FONT Color=#FF0000>'.$text_errorname;
$error = 'TRUE';
}
?>
</TD>
</TR>
<TR>
<TD Bgcolor=<?= $background ?>><P><B><?= $text_email ?>:</TD>
<TD><P>
<?php
// EXAMINE EMAIL IF EMAIL IS NOT THERE THEN OR DOES NOT COMPLY THEN DO ERROR
IF (ereg('^.+@.+\\..+$', $_POST['email']))
echo $_POST['email'].'<BR></TD></TR>';
ELSE
{
echo '<FONT Color=#FF0000>'.$text_erroremail.'<BR></TD></TR>';
$error = 'true';
}
// IF VERIFY EMAIL IS TRUE ADD SOME TEXT TO STATE THIS
IF ($makeverify == 'TRUE')
{
?>
<TR>
<TD Bgcolor=<?= $background ?>><P><B><?= $text_verify ?>:</TD>
<TD><P><?= $text_verifyt ?></TD>
</TR>
<?php
$memstatus = '0';
}
ELSE
$memstatus = '1';
?>
</TABLE>
<BR></TD>
</TR>
</TABLE>
<?php
// IF NO ERROR IS RECORDED THEN BEGIN TO SIGN UP AND SEND THE
// USER AN EMAIL SAYING THEY HAVE SIGNED UP FOR EACH NEWSLETTER
IF (!isset($error))
{
PageTitle('Newsletter(s) Chosen.');
?>
<TABLE Width=<?= $maintablewidth ?> Cellspacing=1 Cellpadding=1 Border=1 Bordercolor=#000000 Align=<?= $maintablealign ?>>
<TR Bgcolor=<?= $background ?>>
<TD><P><?= $text_newslettertitle ?></TD>
<TD><P><?= $text_newsletterdesc ?></TD>
<TD><P><?= $text_status ?></TD>
</TR>
<?php
$numrows = count($_POST['newsletter']);
include ('class/class.phpmailer.php');
FOR ($i = 0; $i < $numrows; $i++)
{
// QUERY TO GET THE NEWSLETTERS AVAILABLE
$query = " SELECT newsletter_title, newsletter_description, newsletter_welcome
FROM news_newsletter
WHERE newsletter_id = '".$_POST['newsletter'][$i]."'
AND newsletter_status = '1'";
$result = @mysql_query($query);
$row = @mysql_fetch_array($result);
extract($row);
?>
<TR>
<TD Valign=Top><P><?= stripslashes($newsletter_title) ?></TD>
<TD><P><?= stripslashes($newsletter_description) ?></TD>
<TD><P>
<?php
// QUERY TO CHECK THAT THE USER ISNT ALREADY SIGNED UP TO THIS NEWSETTER
$query1 = " SELECT members_newsid, members_email
FROM news_member
WHERE members_newsid = '".$_POST['newsletter'][$i]."'
AND members_email = '".$_POST['email']."'";
$result1 = @mysql_query($query1);
IF (@mysql_num_rows($result1) > '0')
echo $text_statusmsgnosub;
ELSE
{
// IF USER IS NOT SIGNED UP THEN INSERT THEM INTO THE DATABASE
echo $text_statusmsgsub;
$query = " INSERT INTO news_member (members_id, members_name, members_email, members_newsid, members_mailpref, members_ip, members_timestamp, members_status)
VALUES ('', '".$_POST['name']."', '".$_POST['email']."', '".$_POST['newsletter'][$i]."', '".$_POST['mailpref']."', '".$_SERVER['REMOTE_ADDR']."', '".mktime()."', '".$memstatus."')";
$result = @mysql_query($query);
// MAIL THE CUSTOMER AND THE SIGNUP DETAILS
$mail = new phpmailer();
$mail -> SMTPKeepAlive = 'true';
$mail->IsSMTP();
$mail->Host = $sockethost;
$mail -> SetLanguage('en', 'class/');
IF ($smtpauth == 'TRUE')
{
$mail->SMTPAuth = 'true';
$mail->Username = $smtpauthuser;
$mail->Password = $smtpauthpass;
}
$mail->From = $socketfrom;
$mail->FromName = $socketfromname;
$mail->AddReplyTo($socketfrom, $socketfromname);
$mail->IsHTML(False);
$mail->Subject = 'Signup For '.$newsletter_title.' - Newsletter From '.$sitename;
$mail->AddAddress($_POST['email'], stripslashes($_POST['name']));
$body = (ereg_replace('NEWSLETTERTITLEHERE', stripslashes($newsletter_title), stripslashes($newsletter_welcome)));
$body = (ereg_replace('NEWSLETTERDESCRIPTIONHERE', stripslashes($newsletter_description), stripslashes($body)));
$body = (ereg_replace('MEMBERNAMEHERE', stripslashes($_POST['name']), stripslashes($body)));
$body = (ereg_replace('MEMBEREMAILHERE', stripslashes($_POST['email']), stripslashes($body)));
$body = (ereg_replace('MEMBERIP', stripslashes($_SERVER['REMOTE_ADDR']), stripslashes($body)));
$body = (ereg_replace('MEMBERDATE', stripslashes(date('d/m/Y')), stripslashes($body)));
$body = (ereg_replace('SITENAMEHERE', stripslashes($sitename), stripslashes($body)));
$body = (ereg_replace('SITEURLHERE', stripslashes($siteurl), stripslashes($body)));
// VERIFY THE EMAIL ADDRESS
IF ($makeverify == 'TRUE')
{
$regid = md5($_POST['email'].$_POST['name'].$_POST['newsletter'][$i]);
$body .= "\n\n You must verify your email address to enable this newsletter choice. Please go to this link ".$verifypath."?caseid=verify®id=".$regid;
}
$mail -> Body = $body;
// EMAIL THE USER IF THE CONFIG IS SET TO TRUE
IF ($usermailsign == 'TRUE')
{
IF(!$mail -> Send())
echo '<FONT Color=#FF0000>Error: '.$mail -> ErrorInfo.'</FONT>';
$mail -> ClearAddresses();
}
// EMAIL THE ADMIN IF THE CONFIG IS SET TO TRUE
IF ($adminmailsign == 'TRUE')
{
$mail->AddAddress($siteemail, $sitename.'- [Admin]');
IF(!$mail -> Send())
echo '<FONT Color=#FF0000>Error: '.$mail -> ErrorInfo.'</FONT>';
$mail -> ClearAddresses();
}
$mail -> SmtpClose();
}
?>
</TD>
</TR>
<?php
}
?>
</TABLE>
<?php
}
ELSE
{
?>
<TABLE Width=<?= $maintablewidth ?> Cellspacing=1 Cellpadding=1 Border=1 Bordercolor=#000000 Align=<?= $maintablealign ?>>
<TR>
<TD Align=Center><BR><P><?= $text_errormsg ?>.<BR>
<INPUT Type=Button Value="<?= $textai_back ?>" onClick=history.back()><BR><BR>
</TD>
</TR>
</TABLE>
<?php
}
?>
</TD>
</TR>
</TABLE>
<?php
}
ELSE
{
// DISPLAY THE INTRODUCTION TEXT - SIGNUP DETAILS AND NEWSLETTERS
?>
<TABLE Width=<?= $maintablewidth ?> Cellspacing=1 Cellpadding=1 Border=1 Bordercolor=#000000 Align=<?= $maintablealign ?>>
<FORM Action=<?= $_SERVER['PHP_SELF'] ?> Method=POST>
<TR>
<TD><BLOCKQUOTE>
<LI><?= $text_joinmessage ?><BR>
<LI><?= $text_unregistermessage ?><BR><BR>
</TD>
</TR>
</TABLE>
<TABLE Width=<?= $maintablewidth ?> Cellspacing=1 Cellpadding=1 Border=0 Class=boxborder Align=<?= $maintablealign ?>>
<TR>
<TD><BLOCKQUOTE><P><?= $text_name ?>:</TD>
<TD><P><INPUT Name=name Size=30></TD>
<TD><P><?= $text_mailpref ?>:</TD>
<TD Align=Right><P><?= $text_html ?>:</TD>
<TD Align=Right><P><INPUT CHECKED Type=Radio Name=mailpref Value=html></TD>
</TR>
<TR>
<TD><BLOCKQUOTE><P><?= $text_email ?>:</TD>
<TD Colspan=2><P><INPUT Name=email Size=30></TD>
<TD Align=Right><P><?= $text_plain ?>:</TD>
<TD Align=Right><P><INPUT Type=Radio Name=mailpref Value=plain></TD>
</TR>
<TR>
<TD Height=10></TD>
</TR>
</TABLE>
<TABLE Width=<?= $maintablewidth ?> Cellspacing=1 Cellpadding=1 Border=1 Bordercolor=#000000 Align=<?= $maintablealign ?>>
<TR Bgcolor=<?= $background ?>>
<TD><P><?= $text_newslettertitle ?></TD>
<TD><P><?= $text_newsletterdesc ?></TD>
<TD><P><?= $text_newsletterselect ?></TD>
</TR>
<?php
// QUERY TO SELECT ALL THE ENTERED NEWSLETTERS WITH STATUS 1
$query = " SELECT newsletter_id, newsletter_title, newsletter_description
FROM news_newsletter
WHERE newsletter_status = '1'
ORDER BY newsletter_id ASC";
$result = @mysql_query($query);
WHILE($row = mysql_fetch_array($result))
{
extract($row);
?>
<TR>
<TD Valign=Top><P><?= stripslashes($newsletter_title) ?></TD>
<TD><P><?= stripslashes($newsletter_description) ?></TD>
<TD Valign=Top Align=Right><INPUT Type=checkbox Name=newsletter[] Value="<?= $newsletter_id ?>"></TD>
</TR>
<?php
}
?>
</TABLE>
<TABLE Width=<?= $maintablewidth ?> Cellspacing=1 Cellpadding=1 Border=0 Align=<?= $maintablealign ?>>
<TR>
<TD Align=Right>
<INPUT Type=Submit Name=form Value="<?= $text_subbutton ?>">
</TD>
</TR>
</FORM>
</TABLE>
<?php
}
BREAK;
#############################################################################################
####### DISPLAY THE NEWSLETTER ARCHIVE FOR USERS TO VIEW ALL NEWSLETTERS SENT ########
#############################################################################################
CASE 'archive';
PageTitle($texta_title);
?>
<TABLE Width=<?= $maintablewidth ?> Cellspacing=1 Cellpadding=1 Border=1 Bordercolor=#000000 Align=<?= $maintablealign ?>>
<?php
// QUERY TO GET THE ARCHIVES SENT BY ALL NEWSLETTERS
$query = " SELECT archive_id, archive_subject, archive_body, FROM_UNIXTIME(archive_timestamp, '%d/%m/%Y') AS timestamp
FROM news_archive";
// IS ISSET NEWSID THEN SHOW THE INDIVIDUAL ARCHIVE SELECTED BY THE USER
IF (isset($_GET['newsid']))
$query .= " WHERE archive_id = '".$_GET['newsid']."'
LIMIT 0,1";
ELSE
$query .= ' ORDER BY archive_timestamp DESC';
$result = @mysql_query($query);
// IF THERE ARE ANY ARCHIVES AT ALL THEN DECIDE TO PRINT THE INDIVIDUAL OR LIST
IF (mysql_num_rows($result) > 0)
{
// IS ISSET NEWSID THEN SHOW THE INDIVIDUAL ARCHIVE SELECTED BY THE USER
IF (isset($_GET['newsid']))
{
$row = mysql_fetch_array($result);
extract($row);
?>
<TR>
<TD Width=100><P><B><?= $textai_volume ?>:</TD>
<TD><P><?= $archive_id ?></TD>
</TR>
<TR>
<TD><P><B><?= $textai_date ?>:</TD>
<TD><P><?= $timestamp ?></TD>
</TR>
<TR>
<TD><P><B><?= $textai_subject ?>:</TD>
<TD><P><?= stripslashes($archive_subject) ?></TD>
</TR>
<TR>
<TD Valign=Top><P><B><?= $textai_body ?>:</TD>
<TD><P><?= stripslashes(nl2br($archive_body)) ?></TD>
</TR>
<TR>
<TD Colspan=2 Align=Center><BR><P><INPUT Type=Button Value="<?= $textai_back ?>" onClick=history.back()><BR><BR></TD>
</TR>
<?php
}
// ELSE SHOW ALL THE NEWSLETTERS SENT SO THE USER CAN SELECT AN INDIVIDUAL ONE
ELSE
{
?>
<TR Valign=Top>
<TD><P><B><?= $texta_volume ?></TD>
<TD><P><B><?= $texta_date ?></TD>
<TD><P><B><?= $texta_subject ?></TD>
<TD><P><B><?= $texta_select ?></TD>
</TR>
<?php
WHILE ($row = mysql_fetch_array($result))
{
extract($row);
?>
<TR BGcolor=<?= UseColor() ?> Valign=Top>
<TD><P><?= $archive_id ?></TD>
<TD><P><?= $timestamp ?></TD>
<TD><P><?= stripslashes($archive_subject) ?></TD>
<TD><P><BUTTON onClick=location='<?= $_SERVER['PHP_SELF'] ?>?caseid=archive&newsid=<?= $archive_id ?>'>Select</BUTTON>
</TR>
<?php
}
}
}
// IF THERE ARE NO ARCHIVES THEN SHOW THIS MESSAGE
ELSE
{
?>
<TR>
<TD><P><?= $texta_noarchive ?></TD>
</TR>
<?php
}
?>
</TABLE>
<?php
BREAK;
#############################################################################################
############# DISPLAY THE UNREGISTER ELEMENT FOR THE USERS TO UNSUBSCIBE #############
#############################################################################################
CASE 'unregister';
PageTitle($textu_title);
// DELETE THE MEMBER FROM THE DATABASE MAIL THE GOODBYE MESSAGE
IF (isset($_POST['form']) == 'new' && isset($_POST['newsletter']))
{
?>
<TABLE Width=<?= $maintablewidth ?> Cellspacing=1 Cellpadding=1 Border=1 Bordercolor=#000000 Align=<?= $maintablealign ?>>
<TR>
<TD><P><?= $textu_unsubmessage ?></TD>
</TR>
</TABLE>
<?php
$numrows = count($_POST['newsletter']);
include ('class/class.phpmailer.php');
FOR ($i = 0; $i < $numrows; $i++)
{
$querydel = " DELETE FROM news_member
WHERE members_newsid = '".$_POST['newsletter'][$i]."'
AND members_email = '".$_POST['email']."'";
$resultdel = @mysql_query($querydel);
// QUERY TO GET THE CORRECT UNSUB MESSAGE
$querymsg = " SELECT newsletter_title, newsletter_description, newsletter_unsubscribe
FROM news_newsletter
WHERE newsletter_id = '".$_POST['newsletter'][$i]."'
AND newsletter_status = '1'
LIMIT 0,1";
$resultmsg = @mysql_query($querymsg);
$rowmsg = @mysql_fetch_array($resultmsg);
extract($rowmsg);
// MAIL THE USER THE GOODBYE MESSAGE
$mail = new phpmailer();
$mail -> SMTPKeepAlive = 'true';
$mail->IsSMTP();
$mail->Host = $sockethost;
$mail -> SetLanguage('en', 'class/');
IF ($smtpauth == 'TRUE')
{
$mail->SMTPAuth = 'true';
$mail->Username = $smtpauthuser;
$mail->Password = $smtpauthpass;
}
$mail->From = $socketfrom;
$mail->FromName = $socketfromname;
$mail->AddReplyTo($socketfrom, $socketfromname);
$mail->IsHTML(False);
$mail->Subject = 'Unsubscribe from '.$newsletter_title.' - Newsletter From '.$sitename;
$mail->AddAddress($_POST['email'], stripslashes($_POST['name']));
$body = (ereg_replace('NEWSLETTERTITLEHERE', stripslashes($newsletter_title), stripslashes($newsletter_unsubscribe)));
$body = (ereg_replace('NEWSLETTERDESCRIPTIONHERE', stripslashes($newsletter_description), stripslashes($body)));
$body = (ereg_replace('MEMBERNAMEHERE', stripslashes($_POST['name']), stripslashes($body)));
$body = (ereg_replace('MEMBEREMAILHERE', stripslashes($_POST['email']), stripslashes($body)));
$body = (ereg_replace('SITENAMEHERE', stripslashes($sitename), stripslashes($body)));
$body = (ereg_replace('SITEURLHERE', stripslashes($siteurl), stripslashes($body)));
$mail -> Body = $body;
// EMAIL THE USER IF THE CONFIG IS SET TO TRUE
IF ($usermailunsu == 'TRUE')
{
IF(!$mail -> Send())
echo '<FONT Color=#FF0000>Error: '.$mail -> ErrorInfo.'</FONT>';
$mail -> ClearAddresses();
}
// EMAIL THE ADMIN IF THE CONFIG IS SET TO TRUE
IF ($adminmailunsu == 'TRUE')
{
$mail->AddAddress($siteemail, $sitename.'- [Admin]');
IF(!$mail -> Send())
echo '<FONT Color=#FF0000>Error: '.$mail -> ErrorInfo.'</FONT>';
$mail -> ClearAddresses();
}
$mail -> SmtpClose();
}
}
// DISPLAY THE INTRODUCTION TEXT
?>
<TABLE Width=<?= $maintablewidth ?> Cellspacing=1 Cellpadding=1 Border=1 Bordercolor=#000000 Align=<?= $maintablealign ?>>
<TR>
<TD><BLOCKQUOTE>
<LI><?= $textu_instruction1 ?>
<LI><?= $textu_instruction2 ?>
<BR></TD>
</TR>
</TABLE>
<TABLE Width=<?= $maintablewidth ?> Cellspacing=1 Cellpadding=1 Border=0 Class=boxborder Align=<?= $maintablealign ?>>
<FORM Action=<?= $_SERVER['PHP_SELF'] ?>?caseid=unregister Method=POST>
<TR>
<TD><BLOCKQUOTE><P><?= $textu_email ?>:</TD>
<TD><P>
<INPUT Name=email
<?php
// IF AN EMAIL HAS BEEN TRIED THEN ALSO DISPLAY IT
IF (isset($_POST['email']))
echo 'Value="'.$_POST['email'].'"';
?>
Size=30>
<INPUT Type=submit Value="<?= $textu_list ?>">
</TD>
</TR>
</FORM>
</TABLE>
<?php
// IF EMAIL IS EMPTY OF INCORRECT THEN SHOW THE NOT VALID TEXT
IF (!isset($_POST['email']) || !ereg('^.+@.+\\..+$', $_POST['email']))
{
?>
<TABLE Width=<?= $maintablewidth ?> Cellspacing=1 Cellpadding=1 Border=1 Bordercolor=#000000 Align=<?= $maintablealign ?>>
<TR>
<TD><BLOCKQUOTE><LI><?= $textu_valid ?></TD>
</TR>
</TABLE>
<?php
}
// IF EMAIL IS VALID THEN QUERY THE DATABASE TO FIND NEWSETTERS ASSOCIATED TO THIS EMAIL ADDRESS
ELSE
{
$query = " SELECT newsletter_id, newsletter_title, newsletter_description, members_name
FROM news_newsletter a, news_member b
WHERE b.members_email = '".$_POST['email']."'
AND b.members_newsid = a.newsletter_id
ORDER BY a.newsletter_id ASC";
$result = mysql_query($query);
// IF NO NEWSLETTERS ARE FOUND THEN SHOW THE NOT A MEMBER TEXT PLEASE SUBSCRIBE
IF (mysql_num_rows($result) <= '0')
{
?>
<TABLE Width=<?= $maintablewidth ?> Cellspacing=1 Cellpadding=1 Border=1 Bordercolor=#000000 Align=<?= $maintablealign ?>>
<TR>
<TD><BLOCKQUOTE><LI><?= $textu_nomember ?> <A HREF=index.php><?= $textu_subscribe ?></TD>
</TR>
</TABLE>
<?php
}
// IF NEWSLETTER(S) ARE FOUND THEN DISPLAY THE LIST AND ALLOW USER TO SELECT ONES TO UNSUB FROM
ELSE
{
PageTitle($textu_subscribed);
?>
<TABLE Width=<?= $maintablewidth ?> Cellspacing=1 Cellpadding=1 Border=1 Bordercolor=#000000 Align=<?= $maintablealign ?>>
<FORM Action=<?= $_SERVER['PHP_SELF'] ?>?caseid=unregister Method=POST>
<TR Bgcolor=#F4F7FD>
<TD><P><B><?= $text_newslettertitle ?></TD>
<TD><P><B><?= $text_newsletterdesc ?></TD>
<TD Align=Right><P><B><?= $textu_title ?></TD>
</TR>
<?php
WHILE ($row = mysql_fetch_array($result))
{
extract($row);
?>
<TR>
<TD Valign=Top><P><?= stripslashes($newsletter_title) ?></TD>
<TD><P><?= stripslashes($newsletter_description) ?></TD>
<TD Align=Right><INPUT ACTIVE Type=checkbox Name=newsletter[] Value=<?= $newsletter_id ?>></TD>
</TR>
<?php
}
?>
</TABLE>
<TABLE Width=<?= $maintablewidth ?> Cellspacing=1 Cellpadding=1 Border=0 Align=<?= $maintablealign ?>>
<TR>
<TD><DIV Align=Right>
<INPUT Type=Hidden Name=name Value="<?= $members_name ?>">
<INPUT Type=Hidden Name=email Value="<?= $_POST['email'] ?>">
<INPUT Type=submit Name=form Value="<?= $textu_unsubbutton ?>">
</TD>
</TR>
</FORM>
</TABLE>
<?php
}
}
BREAK;
#############################################################################################
############## VERIFY THE USER EMAIL ADDRESS AND CHANGE STATUS TO 1 ##################
#############################################################################################
CASE 'verify';
PageTitle('Registration Confirmation');
// CHECK THAT THE REGID AND THE COUNTRY EXIST
IF (isset($_GET['regid']))
{
// CHECK THAT THE REGID IS THE SPECIFIED 32 LONG
IF (strlen($_GET['regid']) == '32')
{
// QUERY THE DATABASE AND PULL OUT THE MATCHING FILE AND AUTHENTICATE
$query = " SELECT members_id, COUNT(*) AS total
FROM news_member
WHERE MD5(CONCAT(members_email,members_name,members_newsid)) = '".$_GET['regid']."'
GROUP BY members_id
LIMIT 0,1";
$result = mysql_query($query);
IF (mysql_num_rows($result) > '0')
{
$row = mysql_fetch_array($result);
extract($row);
$query = " UPDATE news_member
SET members_status = '1'
WHERE members_id = '".$members_id."'";
IF ($result = mysql_query($query))
$msg = 'Your account has been activated please log in now.';
ELSE
$msg = 'Error with updating your account please contact us.';
}
ELSE
$msg = 'This page is for authenticating accounts only.';
}
ELSE
$msg = 'This page is for authenticating accounts only.';
}
ELSE
$msg = 'This page is for authenticating accounts only.';
?>
<TABLE Width=<?= $maintablewidth ?> Cellspacing=1 Cellpadding=1 Border=1 Bordercolor=#000000 Align=<?= $maintablealign ?>>
<TR>
<TD><P><?= $msg ?></TD>
</TR>
</TABLE>
<?php
BREAK;
#############################################################################################
############## TRACK THE CLICK THROUGH AND FORWARD TO REDIRECT URL ###################
#############################################################################################
CASE 'trackit';
$query = " INSERT INTO news_tracking (tracking_id, tracking_send, tracking_email)
VALUES ('', '".$_GET['archive_id']."', '".$_GET['members_email']."')";
$result = @mysql_query($query);
$query = " SELECT newsletter_redirect_url
FROM news_newsletter
WHERE newsletter_id = '".$_GET['newsid']."'";
$result = @mysql_query($query);
$row = @mysql_fetch_array($result);
extract($row);
?>
<meta http-equiv=refresh content='0;URL=<?= $newsletter_redirect_url ?>'>
<?php
BREAK;
}
#############################################################################################
######### ADD THE FOOTER INFORMATION - THIS CAN BE TURNED OFF IN CONFIG ##############
#############################################################################################
IF ($footeron == 'TRUE' && $_GET['caseid'] != 'trackit')
include('footer.php');
?>