# *****************************************************************************************
# camp_schedule.cgi
#
# *****************************************************************************************
# include Perl Modules
use strict;
use CGI;
use empire;
# get some objects to use later
my $pms = empire->new;
my $query = CGI->new;
my $sth;
my $sth2;
my $sql;
my $dbh;
my $campaign_id = $query->param('campaign_id');
my $list_id;
my $status;
my $cname;
my $schedule_date;
my $shour;
my $smin;
my $max_emails;
my $old_mid;
my $old_dname;
my $clast60;
my $openflag;
my $aolflag;
my $yahoo_flag;
my $yahoo_only_flag;
my $yahoo_no_flag;
my $yes_flag;
my $no_flag;
my $seven_flag;
my $last90_flag;
my $last120_flag;
my $last240_flag;
my $yes_open_flag;
my $no_open_flag;
my $aol_yes_flag;
my $aol_no_flag;
my $both_flag;
my $light_table_bg = $pms->get_light_table_bg;
my $images = $pms->get_images_url;
my $list_members = 1;
my $counter;
# connect to the pms database
$pms->db_connect();
$dbh = $pms->get_dbh;
# check for login
my $user_id = empire::check_security();
if ($user_id == 0)
{
print "Location: notloggedin.cgi\n\n";
$pms->clean_up();
exit(0);
}
# make sure this campaign has some valid member list or lists assigned to it before
# allowing the user to schedule it to be sent.
$sql = "select list_id from campaign_list where campaign_id = $campaign_id";
$sth = $dbh->prepare($sql);
$sth->execute();
while (($list_id) = $sth->fetchrow_array())
{
$sql = "select member_cnt from list where list_id = $list_id and status = 'A'";
$sth2 = $dbh->prepare($sql);
$sth2->execute();
($counter) = $sth2->fetchrow_array();
$sth2->finish();
$list_members = $list_members + $counter;
}
$sth->finish();
if ($list_members == 0)
{
empire::logerror("Error, the campaign you selected does not have any email member lists
assigned to it. You must assign at least one email list that contains
some active members to this campaign before it can be scheduled.");
$pms->clean_up();
exit(0);
}
# print out the html page
my $cdate;
$sql = "select now()";
$sth = $dbh->prepare($sql);
$sth->execute();
($cdate)=$sth->fetchrow_array();
$sth->finish();
empire::header("Campaign Schedule");
$sql = "select status,curdate(),max_emails,last60_flag,aol_flag,open_flag,yahoo_flag,hour(schedule_time),minute(schedule_time),mid,redirect_domain,campaign_name from campaign where campaign_id=$campaign_id";
$sth = $dbh->prepare($sql);
$sth->execute();
($status,$schedule_date,$max_emails,$clast60,$aolflag,$openflag,$yahoo_flag,$shour,$smin,$old_mid,$old_dname,$cname) = $sth->fetchrow_array();
print << "end_of_html";
Schedule Your Campaign |
|
Set your Campaign status to either Draft or Scheduled. Your Campaign
will remain in Draft mode until you move it to Scheduled. If you schedule your
Campaign, it will be sent on the date specified beginning around midnight.
If you schedule your Campaign for today, it will begin going out
in the next 5 minutes.
|
|
| |