in reply to Re: Object Identifier?
in thread Object Identifier?
Thanks for the reply. I only inserted part of the code to show where the addition was among its similar elements. Every other $lastflag works. This code was written and worked for a decade. I just wanted to add the new flag. I'd hire a new admin if I had the money. I am doing what I can to keep things going at this point, hence the plea for help here. I would just like to know why my additional elseif for $last240_flag does not work. The error I get is that it selects all recipients instead of ones that have been active for last 240 days. All the other last flags perform correctly.
#!/usr/bin/perl # ******************************************************************** +********************* # camp_schedule.cgi # # this page is for scheduling the email # # History # name removed, 7/30/01, Creation # name removed, 08/07/01, Added logic to allow editing of campa +ign # name removed, 04/30/02, Added Logic to specify number of emails to s +end # ******************************************************************** +********************* # 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 = $campaig +n_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 s +tatus = '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 a +ny email member lists <br> assigned to it. You must assign at least one emai +l list that contains <br> 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_f +lag,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"; </TD> </TR> <TR> <TD vAlign=top align=left bgColor=#999999> <TABLE cellSpacing=0 cellPadding=10 bgColor=#999999 border=0 width +="100%"> <TBODY> <TR> <TD vAlign=top align=left bgColor=#ffffff colSpan=10><!-- doing ct +-table-open --> <TABLE cellSpacing=0 cellPadding=0 width=660 bgColor=#ffffff b +order=0> <TBODY> <TR> <TD vAlign=center align=left><font face="verdana,arial,hel +vetica,sans serif" color="#509C10" size="3"><b>Schedule Your Campaign</b> +</font></TD> </TR> <TR> <TD><IMG height=3 src="$images/spacer.gif"></TD> </TR> </TBODY> </TABLE> <TABLE cellSpacing=0 cellPadding=0 width=660 bgColor=#ffffff b +order=0> <TBODY> <TR> <TD><FONT face="verdana,arial,helvetica,sans serif" color=#509 +C10 size=2> Set your Campaign status to either Draft or Scheduled. You +r 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 goi +ng out in the next 5 minutes.<BR></FONT></TD> </TR> <TR> <TD><IMG height=5 src="$images/spacer.gif"></TD> </TR> </TBODY> </TABLE> <FORM action="camp_copy_schedule_save.cgi" method=post name="b +date"> <INPUT type=hidden name="campaign_id" value="$campaign_id"> <TABLE cellSpacing=0 cellPadding=0 width=760 bgColor=#ffffff b +order=0> <TBODY> <TR> <TD> <TABLE cellSpacing=0 cellPadding=5 width="100%" border=0> <TBODY> <TR> <TD align=middle> <TABLE cellSpacing=0 cellPadding=0 width=500 bgColor=$ +light_table_bg border=0> <TBODY> <TR align=top bgColor=#509C10 height=18> <TD vAlign=top align=left height=15><IMG src="$images/ +blue_tl.gif" border=0 width="7" height="7"></TD> <TD height=15><IMG height=1 src="$images/spacer.gif" w +idth=3 border=0></TD> <TD align=middle height=15> <TABLE cellSpacing=0 cellPadding=0 width="100%" bo +rder=0> <TBODY> <TR bgColor=#509C10 height=15> <TD align=middle width="100%" height=15> <FONT face=Verdana,Arial,Helvetica,sans-serif +color=white size=2> <B>Campaign Status</B> Current Date +time: $cdate </FONT> </TD> </TR> </TBODY> </TABLE> </TD> <TD height=15><IMG height=1 src="$images/spacer.gif" w +idth=3 border=0></TD> <TD vAlign=top align=right bgColor=#509C10 height=15> <IMG src="$images/blue_tr.gif" border=0 width="7" +height="7"></TD> </TR> <TR bgColor=$light_table_bg> <TD colSpan=5><IMG height=3 src="$images/spacer.gif" w +idth=1 border=0></TD> </TR> <TR bgColor=$light_table_bg> <TD><IMG height=3 src="$images/spacer.gif" width=3></T +D> <TD align=middle><IMG height=3 src="$images/spacer.gif +" width=3></TD> <TD align=middle> <TABLE cellSpacing=0 cellPadding=0 width="100%" bo +rder=0> <TBODY> <TR> <TD align=middle><IMG height=3 src="$images/spacer +.gif" width=3></TD> </TR> <tr> <TD vAlign=center align=left><FONT face="verdana,a +rial,helvetica,sans serif" color=#509C10 size=2>New Campaign Name: <input type=text name=cname value="$cname" siz +e=50></font></td> </tr> <TR> <TD vAlign=center align=left><FONT face="verdana,a +rial,helvetica,sans serif" color=#509C10 size=2> end_of_html # get schedule information for this campaign if ($old_dname eq "") { $old_dname="NONE"; } if ($status eq "D") { my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localti +me(); $year = $year + 1900; $mon = $mon + 1; if ($mon < 10) { $mon = "0$mon"; } if ($mday < 10) { $mday = "0$mday"; } $schedule_date = "$mon/$mday/$year"; print<<"end_of_html"; <script language="JavaScript1.2" src="/CalendarPopup.js"></script> <SCRIPT LANGUAGE="JavaScript"> var cal = new CalendarPopup(); </SCRIPT> end_of_html print qq { <INPUT style="BACKGROUND: $light_table_bg" type=radio CHECKED +name=schedule value=D>Draft<BR> <INPUT style="BACKGROUND: $light_table_bg" type=radio name=sch +edule value=S>Scheduled for <INPUT type="text" name="sdate" size="10" value="$schedule_dat +e">\n }; print qq { <A HREF="#" onClick="cal.select(document.forms['bdate'].sdate +,'anchor1','MM/dd/yyyy'); return false;" NAME="anchor1" ID="anchor1"> +<img src="/images/calendar_Icon.jpg" border=0 width="27" height="25"> +</A> }; } else { $schedule_date = substr($schedule_date,5,2) . "/" . substr($schedu +le_date,8,2) . "/" . substr($schedule_date,0,4); print qq { <INPUT style="BACKGROUND: $light_table_bg" type=radio name=sch +edule value=D>Draft<BR> <INPUT style="BACKGROUND: $light_table_bg" type=radio CHECKED +name=schedule value="$status">Scheduled for <INPUT type="text" name="sdate" size="10" value="$schedule_dat +e"> \n }; print qq { <A HREF="#" onClick="cal.select(document.forms['bdate'].sdate +,'anchor1','MM/dd/yyyy'); return false;" NAME="anchor1" ID="anchor1"> +<img src="/images/calendar_Icon.jpg" border=0 width="27" height="25"> +</A> }; } $sth->finish(); my $i=0; print " Hour: <select name=shour>\n"; while ($i < 24) { if ($i == $shour) { print "<option selected value=$i>$i</option>"; } else { print "<option value=$i>$i</option>"; } $i++; } print "</select>"; my $i=0; print " Minute: <select name=smin>\n"; while ($i < 60) { if ($i == $smin) { print "<option selected value=$i>$i</option>"; } else { print "<option value=$i>$i</option>"; } $i++; } print "</select>"; if ($clast60 eq "Y") { $yes_flag="checked"; $no_flag = ""; $seven_flag = ""; $last90_flag = ""; $last120_flag = ""; $last240_flag = ""; } elsif ($clast60 eq "7") { $no_flag=""; $yes_flag = ""; $seven_flag = "checked"; $last90_flag = ""; $last120_flag = ""; $last240_flag = ""; } elsif ($clast60 eq "9") { $no_flag=""; $yes_flag = ""; $seven_flag = ""; $last90_flag = "checked"; $last120_flag = ""; $last240_flag = ""; } elsif ($clast60 eq "2") { $no_flag=""; $yes_flag = ""; $seven_flag = ""; $last90_flag = ""; $last120_flag = "checked"; $last240_flag = ""; } elsif ($clast60 eq "4") { $no_flag=""; $yes_flag = ""; $seven_flag = ""; $last90_flag = ""; $last120_flag = ""; $last240_flag = "checked"; } else { $no_flag="checked"; $yes_flag = ""; $seven_flag = ""; $last90_flag = ""; $last120_flag = ""; $last240_flag = ""; } if ($openflag eq "Y") { $yes_open_flag="checked"; $no_open_flag = ""; } else { $no_open_flag="checked"; $yes_open_flag = ""; } if ($aolflag eq "N") { $aol_yes_flag=""; $aol_no_flag = "checked"; $both_flag = ""; } elsif ($aolflag eq "A") { $aol_yes_flag="checked"; $aol_no_flag = ""; $both_flag = ""; } else { $aol_yes_flag=""; $aol_no_flag = ""; $both_flag = "checked"; } if ($yahoo_flag eq "Y") { $yahoo_flag = "checked"; $yahoo_no_flag = ""; $yahoo_only_flag =""; } elsif ($yahoo_flag eq "O") { $yahoo_flag = ""; $yahoo_no_flag = ""; $yahoo_only_flag ="checked"; } else { $yahoo_flag = ""; $yahoo_only_flag =""; $yahoo_no_flag = "checked"; } print << "end_of_html"; <BR></FONT></TD> </TR> <TR> <TD vAlign=center align=left><FONT face="verdana,a +rial,helvetica,sans serif" color=#509C10 size=2>Send To: <input type=radio name=clast60 value="N" $no_f +lag>All <input type=radio name=clast60 value="Y" $yes_flag +>Last 60 Days <input type=radio name=clast60 value=" +9" $last90_flag>Last 90 Days <input type=radio name= +clast60 value="7" $seven_flag>Last 7 Days <input typ +e=radio name=clast60 value="2" $last120_flag>Last 120 Days   +; <input type=radio name=clast60 value="4" $last240_flag>Last 24 +0 Days</font></td> </tr> <TR> <TD vAlign=center align=left><FONT face="verdana,a +rial,helvetica,sans serif" color=#509C10 size=2>Send To: <input type=radio name=aolflag value="N" $aol_ +no_flag>No AOL <input type=radio name=aolflag value="A" $a +ol_yes_flag>AOL Only <input type=radio name=aolflag +value="B" $both_flag>Both</font></td> </tr> <TR> <TD vAlign=center align=left><FONT face="verdana,a +rial,helvetica,sans serif" color=#509C10 size=2>Include Yahoo: <input type=radio name=yahooflag value="Y" $ya +hoo_flag>Yes <input type=radio name=yahooflag value="N" $y +ahoo_no_flag>No <input type=radio name=yahooflag value="O" + $yahoo_only_flag>Only Yahoo</td></font> </tr> <TR> <TD vAlign=center align=left><FONT face="verdana,a +rial,helvetica,sans serif" color=#509C10 size=2>Openers Only: <input type=radio name=copen value="N" $no_ope +n_flag>No <input type=radio name=copen value="Y" $yes_open +_flag>Yes</font></td> </tr> <tr><td> </td></tr> <tr> <TD vAlign=center align=left><FONT face="verdana,a +rial,helvetica,sans serif" color=#509C10 size=2>Max E-mails To Send ( +-1 means all): <input type=text name=max_emails value=$max_em +ails></font></td> </tr> <tr> <TD vAlign=center align=left><FONT face="verdana,a +rial,helvetica,sans serif" color=#509C10 size=2>IP to Use: <select na +me=mid> end_of_html $sql="select mid,server,ip_addr,domain from mailing_info order by serv +er,ip_addr"; $sth=$dbh->prepare($sql); $sth->execute(); my $mid; my $server; my $ip; my $dname; while (($mid,$server,$ip,$dname)=$sth->fetchrow_array()) { if ($mid == $old_mid) { print "<option selected value=$mid>$server - $ip - $dname</opt +ion>\n"; } else { print "<option value=$mid>$server - $ip - $dname</option>\n"; } } $sth->finish(); print<<"end_of_html"; </font></td> </tr> <tr> <TD vAlign=center align=left><FONT face="verdana,a +rial,helvetica,sans serif" color=#509C10 size=2>Redirect Domain: <sel +ect name=rdomain> end_of_html $sql="select domain_name from redirect_domain order by 1"; $sth=$dbh->prepare($sql); $sth->execute(); my $dname; while (($dname)=$sth->fetchrow_array()) { if ($dname eq $old_dname) { print "<option selected value=$dname>$dname</option>\n"; } else { print "<option value=$dname>$dname</option>\n"; } } $sth->finish(); print<<"end_of_html"; </font></td> </tr> <!-- <TR> <TD vAlign=center align=left><FONT face="verdana,a +rial,helvetica,sans serif" color=#509C10 size=2>Request Read Receipts on +the Emails? <input type=checkbox name=read_receipt></font> +</td> </tr> --> <TR> <TD><IMG height=7 src="$images/spacer.gif"></TD> </TR> </TBODY> </TABLE> </TD> <TD align=middle><IMG height=3 src="$images/spacer.gif +" width=3></TD> <TD><IMG height=3 src="$images/spacer.gif" width=3></T +D> </TR> <TR bgColor=$light_table_bg> <TD colSpan=5><IMG height=3 src="$images/spacer.gif" w +idth=1 border=0></TD> </TR> <TR bgColor=$light_table_bg height=10> <TD vAlign=bottom align=left><IMG height=7 src="$image +s/lt_purp_bl.gif" width=7 border=0></TD> <TD><IMG height=3 src="$images/spacer.gif" width=1 bor +der=0></TD> <TD align=middle bgColor=$light_table_bg><IMG height=3 + src="$images/spacer.gif" width=1 border=0><IMG height=3 src="$images/spacer.gif" wi +dth=1 border=0></TD> <TD><IMG height=3 src="$images/spacer.gif" width=1 bor +der=0></TD> <TD vAlign=bottom align=right><IMG height=7 src="$imag +es/lt_purp_br.gif" width=7 border=0></TD> </TR> </TBODY> </TABLE> </TD> </TR> </TBODY> </TABLE> </TD> </TR> <TR> <TD> <TABLE cellSpacing=0 cellPadding=7 width="100%" border=0> <TBODY> <TR> <td align="center" width="33%"> <a href="mainmenu.cgi"> <IMG src="$images/home_blkline.gif" border=0></A></td> <td align="center" width="33%"><INPUT type=image src="$ima +ges/copy_emailing.gif" border=0></TD> <td align="center" width="33%"><a href="camp_preview.cgi?c +ampaign_id=$campaign_id&format=H" target=_blank><img src="$images/pre +view_rev.gif" border=0></a></TD> </TR> </TBODY> </TABLE> </TD> </TR> </TBODY> </TABLE> </FORM> </TD> </TR> </TBODY> </TABLE> </TD> </TR> <TR> <TD noWrap align=left height=17> end_of_html $pms->footer(); $pms->clean_up(); exit(0);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Object Identifier?
by haj (Vicar) on Oct 22, 2018 at 20:54 UTC | |
by damfer21 (Novice) on Oct 22, 2018 at 21:20 UTC |