#!/usr/local/bin/perl

##  Updated 130328 to show message about new update for Constant Contact

########## DO NOT CHANGE ANYTHING IN THIS FILE EXCEPT
########## THE LOCATION OF PERL ON THE LINE ABOVE
#
#  SEE FILE INSTALL.TXT FOR EASY INSTALLATION
#  AND USE INSTRUCTIONS
#
##############################################
#                         EZ MAILER
#             Copyright 2001 Oliver Del Signore
#                    All Rights Reserved
#
#  Please direct questions & comments to ezmailer@toac.com
#
#   ezmcontrol.pl - Displays member control panel
#
#  This module is part of a shareware script.  If you like
#  the script and continue to use it, you should register
#  and pay the very modest registation fee.  This will
#  encourage me to answer your questions regarding
#  the script and to improve it in the future.
#
#  Registration for personal use is only $20 per site.
#  Registration for business use is only $95 per site.
#
#  Send your fee, along with your name, address and
#  email address to:
#
#  Oliver Del Signore, PO Box 324, Medford, MA 02155
#
#  Thank you for your support.
#
##############################################

require "ezmconfig.pl";

$front = "<HTML><HEAD><title>$title</title></head><body bgcolor=\"$background\"><P><TABLE BORDER=2 WIDTH=700 CELLPADDING=2 CELLSPACING=0 align=\"center\" bgcolor=\"#000066\"><TR><TD align=\"center\"><TABLE BORDER=1 WIDTH=696 CELLPADDING=5 CELLSPACING=0 align=\"center\" bgcolor=\"$tablebody\"><TR bgcolor=\"#000066\"><TD align=\"center\"><FONT SIZE=4 FACE=\"ARIAL\" COLOR=\"#FFFFFF\"><B>EZ Mailer</B></FONT></TD></TR><TR><TD align=\"center\"><FONT SIZE=5 FACE=\"ARIAL\"><B>$title</B></FONT><P><FONT SIZE=2 FACE=\"ARIAL\">\n";
$back = "</FONT></TD></TR></TABLE></TD></TR></TABLE><BR></BODY></HTML>\n";

$whichlist = "";
$whichuser = "";
$whichip = "";
$whichid = "";

print "Content-type: text/html\n\n";

if ($ENV{'QUERY_STRING'} eq "") {
    $message = "$error Your unique ID code was not transmitted.  Please try again.";
	&message;
} else {
$controlpage = "<A HREF=\"$controlurl?$ENV{'QUERY_STRING'}\">Click here to return to the Control Panel</A>";
}

# open (HBASE, "$ezmhtml") || print "Can't open $ezmhtml $!";
# flock HBASE, 2;
# @htmllist = <HBASE>;
# flock HBASE, 8;
# close (HBASE);
#
# foreach $hline (@htmllist) {
# 	chomp $hline;
# 	($email,$ip,$id) = split(/::/,$hline);
#
# 	if ($ENV{'QUERY_STRING'} eq "$id") {
# 		$whichlist = "HTML";
# 		$otherlist = "TEXT";
# 		$whichuser = $email;
# 		$whichip = $ip;
# 		$whichid = $id;
# 		&makepage;
# 	}
# }

open (TBASE, "$ezmtext") || print "Can't open $ezmtext $!";
flock TBASE, 2;
@textlist = <TBASE>;
flock TBASE, 8;
close (TBASE);

foreach $tline (@textlist) {
	chomp $tline;
	($email,$ip,$id) = split(/::/,$tline);

	if ($ENV{'QUERY_STRING'} eq "$id") {
		$whichlist = "TEXT";
		$otherlist = "HTML";
		$whichuser = $email;
		$whichip = $ip;
		$whichid = $id;
		&makepage;
	}
}

$message = "$error Your Member code was not found on our list.<BR>Your email address may have been previously removed. $joinpage $homepage";
&message;
exit;

### MAKEPAGE - Generate the control panel for member
#########################################################################

sub makepage {

$message = "<FONT SIZE=\"4\" FACE=\"ARIAL\"><B>Member Control Panel</B></FONT><P>Member code: $whichid<BR>Email address: $whichuser<div style=\"text-align: left; width:580px;\"><FONT SIZE=\"3\" FACE=\"ARIAL\"><P>You have reached the Control Panel for our old Newsletter management software. We no longer use this software.<P>If you are currently receiving the Newsletter and want to change your email address, please scroll to the bottom of the last issue, or the next issue you receive, and look for the link circled in red in the graphic, below, and follow the instructions.<p>Thank you!</FONT></div><img src=\"http://www.backwoodshome.com/nl/pix/unsubscribe-for-old-list-manager.gif\" width=\"650\" height=\"140\"  hspace=\"0\" vspace=\"10\" border=\"0\">";
&message;

}

### MESSAGE - Print message to screen & exit
#########################################################################

sub message {
print "$front $message $back\n\n";
exit;
}




