#!/usr/bin/perl ############################################ ## ## ## WebAdverts (Admin) ## ## by Darryl Burgdorf ## ## (e-mail burgdorf@awsd.com) ## ## ## ## version: 3.20 ## ## last modified: 09/08/02 ## ## copyright (c) 2002 ## ## ## ## latest version is available from ## ## http://awsd.com/scripts/ ## ## ## ############################################ # Define the locations of your "ads_settings," "ads_text" # and "ads_rebuild" files. $ADVsettings_path = "/home/slowtwitch/slowtwitch.com/cgi-bin/webadverts/ads_settings.pl"; $ADVtext_path = "/home/slowtwitch/slowtwitch.com/cgi-bin/webadverts/ads_text.pl"; $ADVrebuild_path = "/home/slowtwitch/slowtwitch.com/cgi-bin/webadverts/ads_rebuild.pl"; # NOTHING BELOW THIS LINE NEEDS TO BE ALTERED! $version = "3.20"; $AdminRun = 1; $cryptword = 0; $time = time; require $ADVsettings_path; require $ADVtext_path; require $ADVdisplay_path; $_ = $UserUploadDir; /^(.+)$/; $UserUploadDir = $1; print "Content-type: text/html\n\n"; $ADVtime = time; unless ($ADVUseLocking) { &ADVMasterLockOpen; } ($SSIvirtual,$SSIfile,$PseudoQS) = (&FindSpecifics); if (($ENV{'REMOTE_ADDR'} =~ /\d+\.\d+\.\d+\.\d+/) && (!($ENV{'REMOTE_HOST'}) || ($ENV{'REMOTE_HOST'} =~ /\d+\.\d+\.\d+\.\d+/))) { @domainbytes = split(/\./,$ENV{'REMOTE_ADDR'}); $packaddr = pack("C4",@domainbytes); $resolvedip = (gethostbyaddr($packaddr, 2))[0]; unless ($resolvedip =~ /^[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,6}|[0-9]{1,3})$/) { $resolvedip = ""; } if ($resolvedip) { $ENV{'REMOTE_HOST'} = $resolvedip; } } unless ($ENV{'REMOTE_HOST'}) { $ENV{'REMOTE_HOST'} = $ENV{'REMOTE_ADDR'}; } if ($BannedIPs) { @ignoredips = split(/ /,$BannedIPs); foreach $ignoredip (@ignoredips) { if (($ENV{'REMOTE_HOST'} =~ /$ignoredip/i) || ($ENV{'REMOTE_ADDR'} =~ /$ignoredip/i)) { &Header("$text{'9000'}","$text{'9010'}"); print "

$text{'9011'}\n"; &Footer("$text{'9010'}"); } } } if ($ENV{'CONTENT_TYPE'} =~ /^multipart\/form-data/) { if ($ENV{'CONTENT_TYPE'} =~ /boundary=(\"?([^\";,]+)\"?)*/) { $boundary = $1; } binmode STDIN; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @buffer = split(/\r\n/,$buffer); foreach $line (@buffer) { if ($line =~ /$boundary/) { $Current = ""; next; } if ($line =~ /Content-Disposition/) { if ($line =~ /^.+name\s*=\s*"*([^\s"]+).+$/) { $Current = $1; } $INPUT{$Current} = ""; next; } if ($line =~ /Content-Type/) { if ($line =~ /gif/) { $BannerType = "GIF"; } elsif (($line =~ /jpeg/) || ($line =~ /jpg/)) { $BannerType = "JPG"; } $Current = "BannerFile"; $INPUT{'BannerFile'} = ""; next; } if (($line eq "") && ($Current ne "BannerFile")) { next; } if ($INPUT{$Current} && ($Current eq "BannerFile")) { $INPUT{$Current} .= "\r\n"; } $INPUT{$Current} .= $line; } } else { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; if ($INPUT{$name}) { $INPUT{$name} = $INPUT{$name}." ".$value; } else { $INPUT{$name} = $value; } } } if ($INPUT{'rebuild'}) { require $ADVrebuild_path; &RebuildDatabase; } if ($INPUT{'check_database'}) { require $ADVrebuild_path; &CheckDatabase; } if ($ENV{'QUERY_STRING'} =~ /reginfo/i) { ®info; } elsif ($ENV{'QUERY_STRING'} =~ /admin/i) { &adminintro; } elsif ($INPUT{'getpass'}) { &GetPassword; } elsif ($INPUT{'register'}) { ®ister; } elsif ($INPUT{'expireemailupdate'}) { &ExpireEmailUpdate; } elsif ($INPUT{'emails'}) { &emailmembers; } elsif ($INPUT{'basedon'}) { &edit; } elsif ($INPUT{'edit'}) { &edit; } elsif ($INPUT{'newuserpassword'}) { &NewUserPassword; } elsif ($INPUT{'UserEdit'}) { &UserEdit; } elsif ($INPUT{'UploadBannerForm'}) { &UploadBannerForm; } elsif ($INPUT{'uploadbanner'}) { &UploadBanner; } elsif ($INPUT{'renameaccount'}) { &RenameAccount; } elsif ($INPUT{'del'}) { &del; } elsif ($INPUT{'delgroup'}) { &delgroup; } elsif ($INPUT{'newpass'}) { &newpass; } elsif ($INPUT{'resetcount'}) { &resetcount; } elsif ($INPUT{'editfinal'}) { &editfinal; } elsif ($INPUT{'delfinal'}) { &delfinal; } elsif ($INPUT{'delgroupfinal'}) { &delgroupfinal; } elsif ($INPUT{'reviewone'} eq "Define View") { if ($AdminDisplaySetup) { &defineview; } else { $INPUT{'whichtype'} = "pending established groups"; $INPUT{'whichtime'} = "active expired disabled"; $INPUT{'whichzone'} = ""; &reviewall; } } elsif ($INPUT{'reviewone'} eq "Review All Accounts") { &reviewall; } elsif ($INPUT{'reviewone'}) { &reviewone; } elsif ($INPUT{'dailystats'}) { &dailystats; } elsif ($INPUT{'monthlystats'}) { &monthlystats; } elsif ($INPUT{'masteriplog'}) { &masteriplog; } elsif ($INPUT{'iplog'}) { &iplog; } elsif ($INPUT{'logbyzone'}) { &logbyzone; } elsif ($INPUT{'cheatercheck'}) { &cheatercheck; } elsif ($INPUT{'resetadminlog'}) { &resetadminlog; } elsif ($INPUT{'adminlog'}) { &adminlog; } elsif ($INPUT{'listemail'}) { &ListEmail; } elsif ($INPUT{'expireemail'}) { &ExpireEmail; } elsif ($INPUT{'editgroupfinal'}) { &editgroupfinal; } elsif ($INPUT{'editgroup'}) { &editgroup; } else { &userintro; } sub userintro { &Header("$text{'1000'}","$text{'1001'}"); print "

$text{'1010'}\n", "

\n", "

$text{'1011'} ", "\n", "
$text{'1012'} ", "\n", "

\n", "

\n"; if ($AllowUserEdit) { print "


$text{'1020'}\n", "

\n", "

$text{'1021'} ", "\n", "
$text{'1022'} ", "\n", "\n", "

\n", "

\n"; } if ($mailprog) { print "


$text{'1030'}\n", "

\n", "

$text{'1031'} ", "\n", "

\n", "

\n"; } &Footer; } sub adminintro { open (PASSWORD, "<$ADVadverts_dir/adpassword.txt"); $password = ; close (PASSWORD); chomp ($password); if (!$password) { &InitializePassword; } &Header("$text{'1000'}","$text{'1001'}"); print "

$text{'1040'}\n", "

\n", "

$text{'1041'} ", "\n", "\n", "

", "

\n"; &Footer; } sub InitializePassword { &Header("$text{'1000'}","$text{'1001'}"); print "

Before you can do anything else, ", "you'll need to set your administrative password. ", "This will allow you to access the admin functions, ", "create and edit accounts, review statistics, etc. ", "Please enter your desired password below. ", "(Enter it twice.)\n", "

\n", " ", "

", " ", "\n", "
\n"; &Footer; } sub ConfirmAdminPassword { local($which_admin) = @_; if ($INPUT{'password'}) { $newpassword = crypt($INPUT{'password'}, "aa"); } else { &Header("$text{'9000'}","$text{'9020'}"); print "

$text{'9021'}\n"; &Footer; } open (PASSWORD, "<$ADVadverts_dir/adpassword.txt"); $password = ; close (PASSWORD); chomp ($password); unless ($password && ($newpassword eq $password)) { if ($AllowUserEdit && $INPUT{'newuser'} && ($which_admin == 2)) { &Header("$text{'9000'}","$text{'9030'}"); print "

$text{'9031'}\n"; &Footer; } else { &Header("$text{'9000'}","$text{'9022'}"); print "

$text{'9023'}\n"; &Footer; } } $cryptword = 1; } sub ConfirmUserPassword { unless ($INPUT{'password'}) { &Header("$text{'9000'}","$text{'9020'}"); print "

$text{'9021'}\n"; &Footer; } if ($INPUT{'admincheck'}) { &ConfirmAdminPassword(2); } open (DISPLAY, "<$ADVadverts_dir/$subdir/$AccountName.dat"); @lines = ; close (DISPLAY); chomp (@lines); $pass = $lines[0]; unless ($INPUT{'password'} eq $pass) { if ($INPUT{'groupstatus'}) { open (DISPLAY, "<$ADVadverts_dir/$INPUT{'groupstatus'}.grp"); @grpck = ; close (DISPLAY); chomp (@grpck); } unless ($grpck[0] && ($INPUT{'password'} eq $grpck[0])) { &ConfirmAdminPassword(2); } } } sub CheckName { $AccountName =~ s/[^\w\.\-\']//g; $AccountName =~ tr/A-Z/a-z/; unless ($AccountName =~ /^[a-z,0-9]/) { $AccountName = "a".$AccountName; } $AccountName = substr($AccountName,0,25); $subdir = substr($AccountName,0,1); $subdir .= "/$AccountName"; $_ = $AccountName; /^(.+)$/; $AccountName = $1; $_ = $subdir; /^(.+)$/; $subdir = $1; if (-e "$ADVadverts_dir/$subdir/$AccountName.txt") { unless (-e "$ADVadverts_dir/$subdir/$AccountName.dat") { open (OLDDATA, "$ADVadverts_dir/$subdir/$AccountName.txt"); @lines = ; close (OLDDATA); chomp (@lines); ($pass,$username,$email) = @lines[8,17,18]; open (NEWDATA,">$ADVadverts_dir/$subdir/$AccountName.dat"); print NEWDATA "$pass\n$username\n$email\n"; close (NEWDATA); } } } sub GetPassword { $AccountName = $INPUT{'getpass'}; &CheckName; open (DISPLAY, "<$ADVadverts_dir/$subdir/$AccountName.dat"); @lines = ; close (DISPLAY); chomp (@lines); ($pass,$email) = @lines[0,2]; unless ($email) { &Header("$text{'9000'}","$text{'9040'}"); print "

$text{'9041'} "; print "$AccountName $text{'9042'}\n"; &Footer; } &SendMail($email,"getpass"); &Header("$text{'1000'}","$text{'1001'}"); print "

$text{'1050'} $AccountName "; print "$text{'1051'}\n"; &Footer; } sub defineview { &ConfirmAdminPassword(1); &Header("$text{'1000'}","$text{'1001'}"); unless ((-e "$ADVadverts_dir/register.txt") && (-w "$ADVadverts_dir/register.txt")) { print "

Unregistered copy. "; print "Click here "; print "for registration info.


\n"; } print "

Select Which Accounts ", "You Wish to View:\n", "

\n", "\n"; if ((-s "$ADVadverts_dir/adnew.txt") || (-s "$ADVadverts_dir/groups.txt")) { print "

Pending Accounts (those awaiting "; print "administrative approval), Established Accounts,\n"; print "
and/or Defined Groups ("sets" "; print "of accounts):
\n
"; if (-s "$ADVadverts_dir/adnew.txt") { print "Pending Accounts "; } print "Established Accounts"; if (-s "$ADVadverts_dir/groups.txt") { print " Defined Groups"; } print "\n"; print "
(If no selection is made, "; print "only Established Accounts will be displayed.)\n"; print "

(If including Established Accounts, "; print "select which ones below.)\n"; } else { print "\n"; } print "

Active Accounts, Expired Accounts,\n", "
and/or Disabled Accounts (those with weights ", "temporarily set to 0):
\n", "
Active Accounts ", "Expired Accounts ", "Disabled Accounts\n", "
(If no selection is made, ", "only Active Accounts will be displayed.)\n"; if (@zones) { print "

Accounts Displaying in Zone(s):\n
"; foreach $setzone (sort (@zones)) { print "$setzone "; } print "\n"; print "
(If no selection is made, "; print "accounts from all zones will be displayed.)\n"; } print "\n"; print "

"; print "

\n"; &Footer; } sub reviewall { &ConfirmAdminPassword(1); if (!(-d "$ADVadverts_dir/a") || !(-d "$ADVadverts_dir/0")) { require $ADVrebuild_path; &RebuildDatabase; } unless ($MasterIPLogDays) { $MasterIPLogDays = 2; } if (!(-e "$ADVadverts_dir/update.txt") || ((-M "$ADVadverts_dir/update.txt") > 1)) { foreach $key (a..z,0..9) { opendir (FILES,"$ADVadverts_dir/$key"); @files = readdir(FILES); closedir (FILES); foreach $file (@files) { next unless (-d "$ADVadverts_dir/$key/$file"); opendir (SUBFILES,"$ADVadverts_dir/$key/$file"); @subfiles = readdir(SUBFILES); closedir (SUBFILES); foreach $subfile (@subfiles) { if (($subfile=~/\d\d\d\d\.log/) && ((-M "$ADVadverts_dir/$key/$file/$subfile") > $MasterIPLogDays)) { unlink "$ADVadverts_dir/$key/$file/$subfile"; } } } } if (-e "$ADVadverts_dir/register.txt") { open (REGISTER, "$ADVadverts_dir/register.txt"); $register = ; close (REGISTER); chomp $register; $count = (length($register)-1); foreach $key (0..$count) { $fig = substr($register,$key,1); $fig = ord($fig); $checksum += $fig; } unless (($count==5) && ($checksum==688)) { unlink ("$ADVadverts_dir/register.txt"); } } open (UPDATE,">$ADVadverts_dir/update.txt"); print UPDATE " "; close (UPDATE); } &Header("$text{'1000'}","$text{'1001'}"); unless ((-e "$ADVadverts_dir/register.txt") && (-w "$ADVadverts_dir/register.txt")) { print "

"; print "Unregistered copy. "; print "Click here "; print "for registration info.


\n"; } unless ($INPUT{'whichtype'}) { $INPUT{'whichtype'} = "established"; } unless ($INPUT{'whichtime'}) { $INPUT{'whichtime'} = "active"; } if ($INPUT{'whichtype'} =~ /established/) { print "

"; print "The Following Accounts "; print "Have Been Established:\n"; if ($AdminDisplaySetup) { print "

"; print "(Accounts Included: "; print "$INPUT{'whichtime'})\n"; if ($INPUT{'whichzone'}) { @whichzones = split(/\s+/,$INPUT{'whichzone'}); print "
(Zones Included: "; print "$INPUT{'whichzone'})\n"; } } open (LIST, "<$ADVadverts_dir/adlist.txt"); @advertisements = ; close (LIST); chomp (@advertisements); @sortedadverts = sort (@advertisements); &ADVLockOpen (DBMLIST, "dbmlist.txt"); if ($ADVlockerror) { &Error_DBM; } else { &ADVDBMOpen; if ($ADVdbmerror) { &Error_DBM; } else { foreach $advertiser (@sortedadverts) { $name = $advertiser; next if (length($advertiser) < 1); ($max,$shown,$visits,$image,$start,$weight, $zone,$raw,$displayratio,$clicksfrom) = split(/\t/,$DBMList{$name}); if (length($zone) > 2) { $ZoneColumn = 1; last; } } print "

", "", "\n"; print "

\n", "", "", "", ""; if ($ZoneColumn) { print ""; } print "", "", "", "", "", "\n"; ($other,$exposures,$starttime) = split(/\n/,$DBMList{'adcount.txt'}); ($exposures,$other) = split(/\|/,$exposures); foreach $advertiser (@sortedadverts) { $expired = 0; $name = $advertiser; next if (length($advertiser) < 1); ($max,$shown,$visits,$image,$start,$weight, $zone,$raw,$displayratio,$clicksfrom) = split(/\t/,$DBMList{$name}); unless ($max || $displayratio || $clicksfrom) { print ""; print "\n"; next; } ($max,$maxtype) = split(/\|/, $max); unless ($maxtype) { $maxtype = "E"; } ($text,$texttype) = split(/\|/, $text); unless ($texttype) { $texttype = "B"; } ($displayratio,$displaycount) = split(/\|/, $displayratio); ($clicksfrom,$clicksratio) = split(/\|/, $clicksfrom); if (($maxtype eq "N") && ($displayratio == 0) && ($clicksratio == 0) && ($start < $time) && ($weight == 1) && (length($zone) < 3)) { $AlwaysAvailable = 1; } if ($DefaultBanner eq $name) { $DefaultAvailable = 1; } if ($INPUT{'whichzone'} && (length($zone)>2)) { $zoneok = 0; foreach $whichzones (@whichzones) { if ($zone =~ /$whichzones/) { $zoneok = 1; } } next unless ($zoneok); } if (($displayratio > 0) || ($displaycount > 0) || ($clicksfrom > 0) || ($clicksratio > 0)) { $SecondaryDisplay = 1; } if ($maxtype eq "N") { $max = 0; } if ((($maxtype eq "E") || ($maxtype eq "N")) && ($displayratio > 0)) { $max = $max+int($displaycount/$displayratio); } if ((($maxtype eq "E") || ($maxtype eq "N")) && ($clicksratio > 0)) { $max = $max+($clicksfrom*$clicksratio); } if ($max == 0) { $max = "0"; } $runtime = 0; if ($start) { $runtime = $time - $start + 1; } $average = 0; if (($weight > 0) && ($runtime > 86400)) { &GetAverage; } $expirationstatus = ""; if ($maxtype eq "D") { ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime($max+($ADVHourOffset*3600)); $year += 1900; $expirationstatus .= ""; } elsif (($maxtype eq "N") && ($displayratio == 0) && ($clicksratio == 0)) { $expirationstatus .= ""; } else { $expirationstatus .= ""; } next if (($expired == 1) && ($INPUT{'whichtime'} !~ /expired/)); next if (($expired == 0) && ($weight == 0) && ($INPUT{'whichtime'} !~ /disabled/)); next if (($expired == 0) && ($weight > 0) && ($INPUT{'whichtime'} !~ /active/)); if (($shown == 0) || ($visits == 0)) { $perc = "$text{'2020'}"; $ratio = "$text{'2020'}"; } else { $perc = ((100*($visits/$shown))+.05001); $ratio = (($shown/$visits)+.5001); } unless ($perc eq "$text{'2020'}") { $perc =~ s/(\d+\.\d).*/$1/; $perc = $perc."%"; } unless ($ratio eq "$text{'2020'}") { $ratio =~ s/(\d+)\.\d.*/$1/; $ratio = $ratio.":1"; } print "\n", "\n"; $runtime = 0; if ($start) { ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime($start+($ADVHourOffset*3600)); $year += 1900; print ""; } else { print ""; } print "$expirationstatus"; if ($ZoneColumn) { $zone=~ s/^\s//; $zone=~ s/\s$//; $zone=~ s/\s/
/g; print ""; } print ""; print ""; if ($expired || ($weight < 1)) { print ""; } elsif ($average > 0) { print ""; } else { print ""; } print ""; print "\n"; } &ADVDBMClose; print "
$text{'2010'}

$text{'2011'}

$text{'2012'}

$text{'2013'}

$text{'2014'}

$text{'2015'}

$text{'2016'}

$text{'2017'}

$text{'2018'}

$text{'2019'}

"; print "[ Database Error: "; print "$advertiser.txt ]
$mday $months[$mon] $year"; unless ($max > $time) { $expired = 1 ; $expirationstatus .= "
$text{'2100'}"; } $expirationstatus .= "
$text{'2101'}".&commas($max); if ($maxtype eq "C") { $expirationstatus .= " $text{'2110'}"; if (($average == 0) || ($shown == 0) || ($visits == 0)) { $expirationstatus .= "
$text{'2102'}"; } elsif ($max > $visits) { $daystogo = (($max-$visits)/($average*($visits/$shown))); $calculatedend = $time+($daystogo*86400); ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime($calculatedend+($ADVHourOffset*3600)); $year += 1900; $expirationstatus .= "
(~ $mday $months[$mon] $year)"; } else { $expired = 1; $expirationstatus .= "
$text{'2100'}"; } } else { $expirationstatus .= " $text{'2111'}"; if (($displayratio > 0) || ($clicksratio > 0)) { $expirationstatus .= "
$text{'2101'}"; } elsif ($average == 0) { $expirationstatus .= "
$text{'2102'}"; } elsif ($max > $shown) { $daystogo = (($max-$shown)/$average); $calculatedend = $time+($daystogo*86400); ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime($calculatedend+($ADVHourOffset*3600)); $year += 1900; $expirationstatus .= "
(~ $mday $months[$mon] $year)"; } else { $expired = 1; $expirationstatus .= "
$text{'2100'}"; } } $expirationstatus .= "
", "", "$mday $months[$mon] $year$zone$weight",&commas($shown),"--",&commas($average),"$text{'2020'}",&commas($visits),"$perc$ratio
\n"; print "
\n"; print "

"; ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime($time+($ADVHourOffset*3600)); if ($hour < 10) { $hour = "0".$hour; } if ($min < 10) { $min = "0".$min; } $year += 1900; print "(These figures are accurate as of "; print "$hour:$min on $mday $months[$mon] $year"; if ($starttime) { ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime($starttime+($ADVHourOffset*3600)); if ($hour < 10) { $hour = "0".$hour; } if ($min < 10) { $min = "0".$min; } $year += 1900; print ".
Since $hour:$min on $mday $months[$mon] $year, "; print "there have been a total of ",&commas($exposures); print " advert exposures"; $time = $time - $starttime + 1; if ($time > 86400) { $average = int(($exposures/($time/86400))+.5); print ",
for an average of ",&commas($average); print " exposures per day"; } } print ".)\n"; if ($NotUsingBestDBM) { print "

CAUTION: You do not seem to have ", "the Berkeley "DB_File" DBM (database) module available on your server, ", "so WebAdverts is using an alternate module. The script will still run, but not ", "as efficiently as it could, and in high traffic situations, you may see problems ", "with database corruption or lost exposures. Please contact your server's administrators ", "to see if you can get the "DB_File" module installed!

\n"; } unless ($AlwaysAvailable) { print "

CAUTION: You may see "gaps" ", "in your rotation, where no banners are shown, since you currently have no ", "banners "guaranteed" to always be available for display. You should ", "always have at least one account set to never expire, with no display ratio ", "or click-thru ratio, with a weight of 1, and with no assigned zones."; if ($DefaultBanner) { if ($DefaultAvailable) { print " You've assigned a "default" banner ", "("$DefaultBanner"), so the problem will be "hidden"; ", "however, it's still best to make sure that you actually have banners ", "properly available for display."; } else { print " In addition, your "default" banner assignment ", "("$DefaultBanner") is invalid, as the assignment doesn't ", "match the name of any account in your rotation." } } print "

\n"; } } } print "


"; &ADVLockClose (DBMLIST, "dbmlist.txt"); } if ((-s "$ADVadverts_dir/adnew.txt") && ($INPUT{'whichtype'} =~ /pending/)) { undef @newlines; open (COUNT, "<$ADVadverts_dir/adnew.txt"); @newlines = ; close (COUNT); chomp (@newlines); } if (@newlines > 0) { print "

"; print "The Following Accounts Await "; print "Administrative Approval:"; print "

\n"; @sortednewlines = sort (@newlines); print "
", "", "\n"; foreach $newad (@sortednewlines) { next if (length($newad) < 1); print "

\n"; } print "

\n


"; } if ((-s "$ADVadverts_dir/groups.txt") && ($INPUT{'whichtype'} =~ /groups/)) { undef @grouplines; open (COUNT, "<$ADVadverts_dir/groups.txt"); @grouplines = ; close (COUNT); chomp (@grouplines); } if (@grouplines > 0) { print "

"; print "The Following Groups Have Been Defined:"; print "\n"; print "

", "\n"; print "

\n"; @sortedgroups = sort (@grouplines); foreach $group (@sortedgroups) { next if (length($group) < 1); open (DISPLAY, "<$ADVadverts_dir/$group.grp"); @members = ; close (DISPLAY); chomp (@members); $grppassword = $members[0]; print "", "\n", "\n"; } print "
", "", ""; foreach $member (@members) { unless ($member eq $grppassword) { print " $member"; } } print "
\n


"; } print "
\n", "

The Following Options ", "Are Available:\n", "\n", "

\n", "

-- Account Maintenance --", "

Update (Add/Edit/Delete) Account: ", " ", "\n", "

Add Account Based on Existing Account: ", " ", " ", "\n", "

Rename Account: ", " ", " ", "\n", "

Update (Add/Edit/Delete) Group: ", " ", "\n", "

\n", "

\n", "

-- Exchange Maintenance --"; if ($SecondaryDisplay) { print "

\n"; } if ($ADVLogIP) { print "

\n"; } if ($LogAdminAccesses) { print "

\n"; } if ($mailprog) { print "

\n"; } else { print "

\n"; } print "

\n", "

\n", "

\n", "

-- General Admin Functions --", "

Change Admin Password: ", " ", " ", "\n"; print "

\n"; print "

", "\n", "

", "
\n", "

\n"; &LinkBack; &Footer; } sub ListEmail { &ConfirmAdminPassword(1); $listtype = "active"; open (LIST, "<$ADVadverts_dir/adlist.txt"); @advertlist = ; close (LIST); chomp (@advertlist); foreach $advertiser (@advertlist) { &constructlist; } $listtype = "pending"; open (LIST, "<$ADVadverts_dir/adnew.txt"); @advertlist = ; close (LIST); chomp (@advertlist); foreach $advertiser (@advertlist) { &constructlist; } @sortedemails1 = sort (@emails1); @sortedemails2 = sort (@emails2); &Header("$text{'1000'}","$text{'1001'}"); print "

"; print "Account Holder E-Mail Addresses:"; print "\n"; if ($mailprog) { print "

\n"; print "\n"; print "

Select the account holders to whom the e-mail should be sent:\n

"; $lastemail = ""; foreach $email (@sortedemails1) { if ($lastemail) { print "
"; } print "$email\n"; $lastemail = $email; } print "

Message Subject: \n"; print "

Message Text:\n"; print "
\n"; print "

\n"; print "

"; } else { print "

"; $lastemail = ""; foreach $email (@sortedemails1) { if ($lastemail) { print "
"; } print "$email\n"; $lastemail = $email; } print "

You may, if you like, copy the following listing directly "; print "into the "To:" field in your e-mail program, to e-mail "; print "all account holders.\n

"; $lastemail = ""; foreach $email (@sortedemails2) { if ($email eq $lastemail) { next; } if ($lastemail) { print ", "; } print "$email"; $lastemail = $email; } print "\n"; } &LinkBack; &Footer; } sub ExpireEmail { &ConfirmAdminPassword(1); open (LIST, "<$ADVadverts_dir/adlist.txt"); @advertlist = ; close (LIST); chomp (@advertlist); open (LIST, "<$ADVadverts_dir/adexpirelist.txt"); @recipientlist = ; close (LIST); chomp (@recipientlist); $recipientlist = join(' ',@recipientlist); $recipientlist = " $recipientlist "; foreach $advertiser (@advertlist) { &constructlist; } @sortedemails1 = sort (@emails1); &Header("$text{'1000'}","$text{'1001'}"); print "

"; print "Automatic E-Mail Recipients:"; print "\n"; print "

\n"; print "\n"; print "

If you're using the separate "ads_expire.pl" script, you can send automatic ", "e-mail notices to your account holders, informing them of the progress of their accounts. ", "Select in the list below, which of your account holders should receive such notices. ", "Note that this page sends nothing; it simply determines who will receive the notices ", "sent by the "ads_expire.pl" script, when it is run.\n

"; $lastemail = ""; foreach $email (@sortedemails1) { if ($lastemail) { print "
"; } print "$email\n"; $lastemail = $email; } print "

\n"; print "

"; &LinkBack; &Footer; } sub constructlist { $subdir = substr($advertiser,0,1); $subdir .= "/$advertiser"; open (DISPLAY, "<$ADVadverts_dir/$subdir/$advertiser.dat"); @lines = ; close (DISPLAY); chomp (@lines); unless ($lines[1]) { $lines[1] = "Account Holder"; } if ($lines[2]) { $email = "$lines[2]"; } else { $email = ""; } $listing = ""; if ($mailprog || $recipientlist) { $listing .= "$lines[2])"; } else { $listing .= "E-Mail Unknown)"; } push (@emails1,"$listing"); unless ($lines[2]) { next; } push (@emails2,""$lines[1]" <$lines[2]>"); } sub emailmembers { &ConfirmAdminPassword(1); @bcclist = split(/\s/,$INPUT{'emails'}); foreach $bcc (sort @bcclist) { if ($bcc eq $lastbcc) { next; } if (length($bcc)<3) { next; } push (@bcc,$bcc); $lastbcc = $bcc; } &SendMail($email_address,"groupmail"); &Header("$text{'1000'}","$text{'1001'}"); print "

E-Mail Sent\n", "

The message has been sent.\n"; &LinkBack; &Footer; } sub ExpireEmailUpdate { &ConfirmAdminPassword(1); @recipientlist = split(/\s/,$INPUT{'emails'}); &Header("$text{'1000'}","$text{'1001'}"); print "

Recipient List Updated\n", "

The following accounts will receive update notices ", "when the "ads_expire.pl" script is run:\n

"; open (LIST, ">$ADVadverts_dir/adexpirelist.txt"); $lastrecipient = ""; foreach $recipient (sort @recipientlist) { if ($lastrecipient) { print "
"; } print "$recipient\n"; print LIST "$recipient\n"; $lastrecipient = $recipient; } close (LIST); &LinkBack; &Footer; } sub reviewgroup { $groupstatus = "$AccountName"; unless (-s "$ADVadverts_dir/$AccountName.grp") { if ($AllowUserEdit && $INPUT{'newuser'}) { &UserEdit; } &Header("$text{'9000'}","$text{'9050'}"); print "

$text{'9051'} "; print ""$AccountName" $text{'9052'}\n"; &Footer; } open (DISPLAY, "<$ADVadverts_dir/$AccountName.grp"); @adverts = ; close (DISPLAY); chomp (@adverts); unless ($cryptword) { unless ($INPUT{'password'} eq $adverts[0]) { &ConfirmAdminPassword(2); } } &Header("$text{'1000'}","$text{'1001'}"); print "

$text{'2000'} "; print "$AccountName $text{'2001'}\n"; foreach $advert (@adverts) { $name = $advert; $subdir = substr($advert,0,1); $subdir .= "/$advert"; next unless (-s "$ADVadverts_dir/$subdir/$advert.txt"); open (DISPLAY, "<$ADVadverts_dir/$subdir/$advert.dat"); @lines = ; close (DISPLAY); chomp (@lines); ($pass,$username,$email,$comments) = @lines; open (DISPLAY, "<$ADVadverts_dir/$subdir/$advert.txt"); @lines = ; close (DISPLAY); chomp (@lines); ($max,$shown,$visits,$url,$image,$height,$width, $alt,$nada,$text,$start,$weight,$zone, $border,$target,$raw,$displayratio,$nada,$nada, $displayzone,$clicksfrom) = @lines; ($max,$maxtype) = split(/\|/, $max); unless ($maxtype) { $maxtype = "E"; } ($text,$texttype) = split(/\|/, $text); unless ($texttype) { $texttype = "B"; } ($displayratio,$displaycount) = split(/\|/, $displayratio); ($clicksfrom,$clicksratio) = split(/\|/, $clicksfrom); if ($maxtype eq "N") { $max = 0; } if ((($maxtype eq "E") || ($maxtype eq "N")) && ($displayratio > 0)) { $max = $max+int($displaycount/$displayratio); } if ((($maxtype eq "E") || ($maxtype eq "N")) && ($clicksratio > 0)) { $max = $max+($clicksfrom*$clicksratio); } if ($max == 0) { $max = "0"; } $TotalShown += $shown; $TotalVisits += $visits; print "


\n"; &reviewadvert; } print "


$text{'2002'}", "\n", "

\n", "", "", "", "", "\n"; if (($TotalShown == 0) || ($TotalVisits == 0)) { $perc = "$text{'2020'}"; $ratio = "$text{'2020'}"; } else { $perc = ((100*($TotalVisits/$TotalShown))+.05001); $ratio = (($TotalShown/$TotalVisits)+.5001); } unless ($perc eq "$text{'2020'}") { $perc =~ s/(\d+\.\d).*/$1/; $perc = $perc."%"; } unless ($ratio eq "$text{'2020'}") { $ratio =~ s/(\d+)\.\d.*/$1/; $ratio = $ratio.":1"; } print ""; print ""; print ""; print "\n"; print "
$text{'2015'}

$text{'2017'}

$text{'2018'}

$text{'2019'}

",&commas($TotalShown),"",&commas($TotalVisits),"$perc$ratio
\n"; &Footer("Group: $AccountName"); } sub reviewone { unless ($INPUT{'password'}) { &Header("$text{'9000'}","$text{'9020'}"); print "

$text{'9021'}\n"; &Footer; } $AccountName = $INPUT{'reviewone'}; &CheckName; if ($INPUT{'admincheck'}) { &ConfirmAdminPassword(2); } unless (-s "$ADVadverts_dir/$subdir/$AccountName.txt") { &reviewgroup; } $name = $AccountName; open (DISPLAY, "<$ADVadverts_dir/$subdir/$AccountName.dat"); @lines = ; close (DISPLAY); chomp (@lines); ($pass,$username,$email,$comments) = @lines; open (DISPLAY, "<$ADVadverts_dir/$subdir/$AccountName.txt"); @lines = ; close (DISPLAY); chomp (@lines); ($max,$shown,$visits,$url,$image,$height,$width, $alt,$nada,$text,$start,$weight,$zone, $border,$target,$raw,$displayratio,$nada,$nada, $displayzone,$clicksfrom) = @lines; ($max,$maxtype) = split(/\|/, $max); unless ($maxtype) { $maxtype = "E"; } ($text,$texttype) = split(/\|/, $text); unless ($texttype) { $texttype = "B"; } ($displayratio,$displaycount) = split(/\|/, $displayratio); ($clicksfrom,$clicksratio) = split(/\|/, $clicksfrom); if ($maxtype eq "N") { $max = 0; } if ((($maxtype eq "E") || ($maxtype eq "N")) && ($displayratio > 0)) { $max = $max+int($displaycount/$displayratio); } if ((($maxtype eq "E") || ($maxtype eq "N")) && ($clicksratio > 0)) { $max = $max+($clicksfrom*$clicksratio); } if ($max == 0) { $max = "0"; } unless ($cryptword) { unless ($INPUT{'password'} eq $pass) { &ConfirmAdminPassword(2); } } &Header("$text{'1000'}","$text{'1001'}"); &reviewadvert; if ($cryptword) { if ($comments) { print "

Comments: $comments\n"; } &LinkBack; } else { print "

\n"; print "
\n"; print "\n"; print "
\n"; } &Footer("Account: $AccountName"); } sub reviewadvert { $expired = 0; print "

$text{'2005'} "; print "$name $text{'2006'}\n"; open (COUNT, "$ADVadverts_dir/adnew.txt"); @lines = ; close (COUNT); chomp (@lines); foreach $line (@lines) { if ($line eq $name) { print "

$text{'2007'}"; last; } } print "

\n"; print "

\n"; print ""; print ""; if ($displayratio || $displaycount || $clicksratio || $clicksfrom) { print ""; if ($clicksratio || $cryptword || $ShowClicksFrom) { print ""; print ""; print ""; } print "\n"; print ""; if ($start) { ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime($start+($ADVHourOffset*3600)); $year += 1900; print ""; $runtime = $time - $start + 1; } else { print ""; } if (($displaycount == 0) || ($clicksfrom == 0)) { $foreignperc = "$text{'2020'}"; $foreignratio = "$text{'2020'}"; } else { $foreignperc = ((100*($clicksfrom/$displaycount))+.05001); $foreignratio = (($displaycount/$clicksfrom)+.5001); } unless ($foreignperc eq "$text{'2020'}") { $foreignperc =~ s/(\d+\.\d).*/$1/; $foreignperc = $foreignperc."%"; } unless ($foreignratio eq "$text{'2020'}") { $foreignratio =~ s/(\d+)\.\d.*/$1/; $foreignratio = $foreignratio.":1"; } print ""; if ($clicksratio || $cryptword || $ShowClicksFrom) { print ""; print ""; print ""; } print "\n"; print "
$text{'2011'}

$text{'2040'}"; print "

$text{'2041'}"; print "

$text{'2018'}

$text{'2019'}

$mday $months[$mon] $year",&commas($displaycount),"",&commas($clicksfrom),"$foreignperc$foreignratio
\n"; print "

\n"; print ""; } else { print ""; } if ($image || $raw || $shown || $visits) { print ""; print ""; print ""; print ""; print ""; } print "\n"; if (($shown == 0) || ($visits == 0)) { $perc = "$text{'2020'}"; $ratio = "$text{'2020'}"; } else { $perc = ((100*($visits/$shown))+.05001); $ratio = (($shown/$visits)+.5001); } unless ($perc eq "$text{'2020'}") { $perc =~ s/(\d+\.\d).*/$1/; $perc = $perc."%"; } unless ($ratio eq "$text{'2020'}") { $ratio =~ s/(\d+)\.\d.*/$1/; $ratio = $ratio.":1"; } print ""; $runtime = 0; if ($start) { ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime($start+($ADVHourOffset*3600)); $year += 1900; unless ($displayratio || $displaycount || $clicksratio || $clicksfrom) { print ""; } $runtime = $time - $start + 1; } else { unless ($displayratio || $displaycount || $clicksratio || $clicksfrom) { print ""; } } $average = 0; if (($weight > 0) && ($runtime > 86400)) { &GetAverage; } unless ($displayratio || $clicksratio) { if ($maxtype eq "D") { ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime($max+($ADVHourOffset*3600)); $year += 1900; print ""; } elsif ($maxtype eq "N") { print ""; } else { print ""; } } if ($image || $raw || $shown || $visits) { print ""; if ($expired || ($weight < 1)) { print ""; } elsif ($average > 0) { print ""; } else { print ""; } print ""; print ""; } print "
$text{'2012'}

$text{'2030'}"; print "

$text{'2016'}

$text{'2031'}"; print "

$text{'2018'}

$text{'2019'}

$mday $months[$mon] $year$mday $months[$mon] $year"; unless ($max > $time) { $expired = 1; print "
$text{'2100'}"; } print "
$text{'2101'}",&commas($max); if ($maxtype eq "C") { print " $text{'2110'}"; if (($average == 0) || ($shown == 0) || ($visits == 0)) { print "
$text{'2102'}"; } elsif ($max > $visits) { $daystogo = (($max-$visits)/($average*($visits/$shown))); $calculatedend = $time+($daystogo*86400); ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime($calculatedend+($ADVHourOffset*3600)); $year += 1900; print "
(~ $mday $months[$mon] $year)"; } else { $expired = 1; print "
$text{'2100'}"; } } else { print " $text{'2111'}"; if ($average == 0) { print "
$text{'2102'}"; } elsif ($max > $shown) { $daystogo = (($max-$shown)/$average); $calculatedend = $time+($daystogo*86400); ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime($calculatedend+($ADVHourOffset*3600)); $year += 1900; print "
(~ $mday $months[$mon] $year)"; } else { $expired = 1; print "
$text{'2100'}"; } } print "
",&commas($shown),"--",&commas($average),"$text{'2020'}",&commas($visits),"$perc$ratio

\n"; unless ($image || $raw) { print "

$text{'2120'}\n"; } if ($displayratio || $clicksratio) { unless ($NoBanners) { if ($displaycount<1) { $displaycount = "0"; } print "

$text{'2121'} "; print &commas($displaycount)," $text{'2122'}"; if ($clicksratio || $cryptword || $ShowClicksFrom) { print "$text{'2123'} "; print &commas($clicksfrom)," $text{'2124'}"; } print "$text{'2125'} "; $earnings = 0; if ($displayratio > 0) { $earnings = int($displaycount/$displayratio); } if ($clicksratio > 0) { $earnings += ($clicksfrom*$clicksratio); } print "$text{'2126'} "; print &commas($earnings)," $text{'2127'}"; if ($displayratio > 0) { print " $text{'2128'} "; print "$displayratio $text{'2129'}"; } if (($displayratio > 0) && ($clicksratio > 0)) { print "$text{'2130'}"; } if ($clicksratio > 0) { print " $clicksratio $text{'2131'}"; } print "$text{'2132'}"; unless ($max == $earnings) { print " $text{'2133'} "; print &commas($max-$earnings); print " $text{'2134'}"; } print "\n"; } print "

$text{'2135'}\n"; $HTMLCode = ""; if ($ExchangeName) { $HTMLCode = "<!-- Begin $ExchangeName Code -->\n
"; } unless ($ExchangeBorder) { $ExchangeBorder = "0"; } $HTMLCode .= "<P><CENTER>"; if ($ExchangeLogo && (($ExchangeLogoPosition =~ /^t/i) || ($ExchangeLogoPosition =~ /^l/i) || ($ExchangeLogoPosition =~ /^1/i) || !($ExchangeLogoPosition))) { if ($ExchangeURL) { $HTMLCode .= "<A HREF="$ExchangeURL""; $HTMLCode .= " $DefaultLinkAttribute>"; } $HTMLCode .= "<IMG SRC="$ExchangeLogo""; if ($ExchangeLogoHeight && $ExchangeLogoWidth) { $HTMLCode .= " WIDTH=$ExchangeLogoWidth"; $HTMLCode .= " HEIGHT=$ExchangeLogoHeight"; } if ($ExchangeName) { $HTMLCode .= " ALT="$ExchangeName""; } $HTMLCode .= " BORDER=$ExchangeBorder>"; if ($ExchangeURL) { $HTMLCode .= "</A>"; } if ($ExchangeLogoPosition =~ /^t/i) { $HTMLCode .= "<BR>"; } } if ($JavaScriptExchange) { $HTMLCode .= "<SCRIPT LANGUAGE="JavaScript" "; $HTMLCode .= "SRC="$nonssi_cgi?"; $HTMLCode .= "jscript;member=$name"; if ($displayzone) { $HTMLCode .= ";zone=$displayzone"; } $HTMLCode .= "">"; $HTMLCode .= "</SCRIPT>"; $HTMLCode .= "<NOSCRIPT>"; } if ($IFRAMEexchange) { $HTMLCode .= "<IFRAME SRC="$nonssi_cgi?"; $HTMLCode .= "iframe;member=$name"; if ($displayzone) { $HTMLCode .= ";zone=$displayzone"; } $HTMLCode .= """; $HTMLCode .= " MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0"; $HTMLCode .= " FRAMEBORDER=0 SCROLLING=NO"; if ($ExchangeBannerHeight && $ExchangeBannerWidth) { $IFRAMEWidth = $ExchangeBannerWidth+($DefaultBorder*2); $IFRAMEHeight = $ExchangeBannerHeight+($DefaultBorder*2); $HTMLCode .= " WIDTH=$IFRAMEWidth"; $HTMLCode .= " HEIGHT=$IFRAMEHeight"; } $HTMLCode .= ">"; } $HTMLCode .= "<A HREF="$nonssi_cgi?"; $HTMLCode .= "member=$name;banner=NonSSI;page=01"; if ($displayzone) { $HTMLCode .= ";zone=$displayzone"; } $HTMLCode .= """; $HTMLCode .= " $DefaultLinkAttribute>"; $HTMLCode .= "<IMG SRC="$nonssi_cgi?"; $HTMLCode .= "member=$name;page=01"; if ($displayzone) { $HTMLCode .= ";zone=$displayzone"; } $HTMLCode .= """; if ($ExchangeBannerHeight && $ExchangeBannerWidth) { $HTMLCode .= " WIDTH=$ExchangeBannerWidth"; $HTMLCode .= " HEIGHT=$ExchangeBannerHeight"; } if ($ExchangeName) { $HTMLCode .= " ALT="$ExchangeName""; } $HTMLCode .= " BORDER=$DefaultBorder></A>"; if ($IFRAMEexchange) { $HTMLCode .= "</IFRAME>"; } if ($JavaScriptExchange) { $HTMLCode .= "</NOSCRIPT>"; } if ($ExchangeLogo && (($ExchangeLogoPosition =~ /^b/i) || ($ExchangeLogoPosition =~ /^r/i))) { if ($ExchangeLogoPosition =~ /^b/i) { $HTMLCode .= "<BR>"; } if ($ExchangeURL) { $HTMLCode .= "<A HREF="$ExchangeURL""; $HTMLCode .= " $DefaultLinkAttribute>"; } $HTMLCode .= "<IMG SRC="$ExchangeLogo""; if ($ExchangeLogoHeight && $ExchangeLogoWidth) { $HTMLCode .= " WIDTH=$ExchangeLogoWidth"; $HTMLCode .= " HEIGHT=$ExchangeLogoHeight"; } if ($ExchangeName) { $HTMLCode .= " ALT="$ExchangeName""; } $HTMLCode .= " BORDER=$ExchangeBorder>"; if ($ExchangeURL) { $HTMLCode .= "</A>"; } } if ($ExchangeName && !($ExchangeLogo)) { $HTMLCode .= "<BR><SMALL>"; if ($ExchangeURL) { $HTMLCode .= "<A HREF="$ExchangeURL""; $HTMLCode .= " $DefaultLinkAttribute>"; } $HTMLCode .= "$ExchangeName"; if ($ExchangeURL) { $HTMLCode .= "</A>"; } $HTMLCode .= "</SMALL>"; } $HTMLCode .= "</CENTER>"; if ($ExchangeName) { $HTMLCode .= "\n
<!-- End $ExchangeName Code -->\n"; } print "

"; print ""; print "
\n"; print "

$text{'2150'}\n"; } print "

"; if (($AllowUserEdit || $cryptword) && !($groupstatus)) { print "

\n"; print "\n"; print "\n"; print "\n\n"; if ($UserUploadDir) { print "\n"; print "\n"; print "\n\n"; } print "\n", "\n"; if ($cryptword) { print "\n"; } print ""; print "\n"; print "\n"; print "
"; if ($cryptword) { print ""; print "
"; if ($cryptword) { print "\n"; } print ""; print "
\n"; } print "

\n"; if ($LogByZone) { print "\n"; } print "\n"; print "\n"; if ($ADVLogIP) { print "\n"; } print "
\n"; print "\n"; if ($groupstatus) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } if ($clicksratio || $cryptword || $ShowClicksFrom) { print "\n"; } print ""; print "
\n"; print "\n"; if ($groupstatus) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } if ($clicksratio || $cryptword || $ShowClicksFrom) { print "\n"; } print ""; print "
\n"; print "\n"; if ($groupstatus) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } if ($clicksratio || $cryptword || $ShowClicksFrom) { print "\n"; } print ""; print "
\n"; print "\n"; if ($groupstatus) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } if ($clicksratio || $cryptword || $ShowClicksFrom) { print "\n"; } print ""; print "

\n"; if ($email && $INPUT{'welcomeletter'}) { open (WELCOME, "<$ADVadverts_dir/welcome.txt"); $body = ""; while (defined($line = )) { $body .= $line; } close (WELCOME); $HTMLCode =~ s/
//g; $HTMLCode =~ s/<//g; $HTMLCode =~ s/"/"/g; $body =~ s/<--UserID-->/$name/g; $body =~ s/<--Password-->/$pass/g; $body =~ s/<--HTMLCode-->/$HTMLCode/g; &SendMail($email,"welcome"); } &ShowAdvert; } sub GetAverage { $subdir = substr($name,0,1); $subdir .= "/$name"; open (DISPLAY, "<$ADVadverts_dir/$subdir/$name.log"); @lines = ; close (DISPLAY); chomp (@lines); @reverselines = reverse (@lines); $avexposures = 0; $linecount = 0; foreach $line (@reverselines) { next if (length($line)<10); ($acc,$type) = ($line =~ /^(\d\d\d\d\d\d\d\d\d\d) \d\d \d\d \d\d\d\d (\w)$/); next unless ($type eq "E"); $linecount++; next if ($linecount < 2); last if ($linecount > 8); $avexposures += int($acc); } unless ($linecount > 8) { $avexposures -= int($acc); } if (($avexposures < 1) || ($linecount < 3)) { return; } $average = int(($avexposures/($linecount-2))+.5); } sub logbyzone { $AccountName = $INPUT{'advert'}; &CheckName; &ConfirmUserPassword; open (DISPLAY, "<$ADVadverts_dir/$subdir/$AccountName.txt"); @lines = ; close (DISPLAY); chomp (@lines); &Header("$text{'1000'}","$text{'1001'}"); print "

$text{'2210'} "; print "$AccountName $text{'2211'}:\n"; if (@lines > 21) { foreach $key (21..@lines-1) { if ($lines[$key] =~ /(\S+ \S+) (\S) (\d+)/) { $zone = $1; $type = $2; $count = $3; if ($type eq "E") { $exposures{$zone} += $count; } if ($type eq "C") { $clicks{$zone} += $count; unless ($exposures{$zone}) { $exposures{$zone} = "0"; } } } } print "

\n"; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "\n"; foreach $key (sort (keys %exposures)) { ($zone,$member) = split(/\s/,$key); unless ($clicks{$key}) { $clicks{$key} = "0"; } print ""; if (($exposures{$key} == 0) || ($clicks{$key} == 0)) { $perc = "$text{'2020'}"; $ratio = "$text{'2020'}"; } else { $perc = ((100*($clicks{$key}/$exposures{$key}))+.05001); $ratio = (($exposures{$key}/$clicks{$key})+.5001); } unless ($perc eq "$text{'2020'}") { $perc =~ s/(\d+\.\d).*/$1/; $perc = $perc."%"; } unless ($ratio eq "$text{'2020'}") { $ratio =~ s/(\d+)\.\d.*/$1/; $ratio = $ratio.":1"; } print ""; print ""; print ""; print ""; print ""; print ""; print "\n"; } print "
$text{'2212'}

$text{'2213'}

$text{'2214'}

$text{'2215'}

$text{'2018'}

$text{'2019'}

$zone$member",&commas($exposures{$key}),"",&commas($clicks{$key}),"$perc$ratio
\n"; } print "

\n"; print "\n"; print "\n"; print "\n"; if ($ADVLogIP) { print "\n"; } print "
\n"; print "\n"; if ($cryptword) { print "\n"; } print "\n"; print " "; print "
\n"; print "\n"; if ($INPUT{'groupstatus'}) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } if ($INPUT{'showclicksfrom'}) { print "\n"; } print ""; print "
\n"; print "\n"; if ($INPUT{'groupstatus'}) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } if ($INPUT{'showclicksfrom'}) { print "\n"; } print ""; print "
\n"; print "\n"; if ($INPUT{'groupstatus'}) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } if ($INPUT{'showclicksfrom'}) { print "\n"; } print ""; print "
\n"; &Footer; } sub dailystats { $AccountName = $INPUT{'advert'}; &CheckName; &ConfirmUserPassword; open (DISPLAY, "<$ADVadverts_dir/$subdir/$AccountName.log") || &Error_NoStats; @lines = ; close (DISPLAY); chomp (@lines); foreach $line (@lines) { next if (length($line) < 10); ($acc,$logstring) = ($line =~ /^(\d\d\d\d\d\d\d\d\d\d) (\d\d \d\d \d\d\d\d \w)$/); $accesses{$logstring} = int($acc); ($mday,$mon,$year,$type) = ($logstring =~ /^(\d+) (\d+) (\d+) (\w)/); if ($type eq "E") { $beingshown = 1; $TotalE += int($acc); if (int($acc) > $MaxE) { $MaxE = int($acc); } } elsif ($type eq "C") { $beingshown = 1; $TotalC += int($acc); if (int($acc) > $MaxC) { $MaxC = int($acc); } } elsif ($type eq "S") { $bannex = 1; $TotalS += int($acc); if (int($acc) > $MaxS) { $MaxS = int($acc); } } elsif ($type eq "X") { $bannex = 1; $TotalX += int($acc); if (int($acc) > $MaxX) { $MaxX = int($acc); } } else { next; } unless ($startday) { &date_to_count(int($mon),int($mday),($year-1900)); $startday = $perp_days; } } &date_to_count(int($mon),int($mday),($year-1900)); $endday = $perp_days; if ((($endday-$startday) > 34) && !($INPUT{'FullDailyList'})) { $startday = $endday-34; $ShortenedList = 1; $TotalE = $MaxE = 0; $TotalC = $MaxC = 0; $TotalS = $MaxS = 0; $TotalX = $MaxX = 0; foreach $daycount ($startday..$endday) { &count_to_date($daycount); if ($perp_mon < 10) { $perp_mon = "0$perp_mon"; } if ($perp_day < 10) { $perp_day = "0$perp_day"; } $perp_year = $perp_year + 1900; $exposures = "$perp_day $perp_mon $perp_year E"; $clicks = "$perp_day $perp_mon $perp_year C"; $banners = "$perp_day $perp_mon $perp_year S"; $clicksfrom = "$perp_day $perp_mon $perp_year X"; $TotalE += $accesses{$exposures}; $TotalC += $accesses{$clicks}; $TotalS += $accesses{$banners}; $TotalX += $accesses{$clicksfrom}; if ($accesses{$exposures} > $MaxE) { $MaxE = $accesses{$exposures}; } if ($accesses{$clicks} > $MaxC) { $MaxC = $accesses{$clicks}; } if ($accesses{$banners} > $MaxS) { $MaxS = $accesses{$banners}; } if ($accesses{$clicksfrom} > $MaxX) { $MaxX = $accesses{$clicksfrom}; } } } &Header("$text{'1000'}","$text{'1001'}"); print "

$text{'2220'} "; print "$AccountName $text{'2221'}"; if ($ShortenedList) { print "
$text{'2222'}"; } elsif ($INPUT{'FullDailyList'}) { print "
$text{'2223'}"; } print ":
\n"; print "

\n"; print ""; print ""; if ($bannex) { print ""; print ""; $ColCountA = 2; if ($INPUT{'showclicksfrom'}) { print ""; print ""; $ColCountA += 6; } } if ($beingshown) { print ""; print ""; print ""; print ""; $ColCountB = 8; } $daycounter = (($endday-$startday)+1); if ($TotalE) { $MultE = ((49.5/($MaxE/$TotalE))/$daycounter); } if ($TotalC) { $MultC = ((49.5/($MaxC/$TotalC))/$daycounter); } if ($TotalS) { $MultS = ((49.5/($MaxS/$TotalS))/$daycounter); } if ($TotalX) { $MultX = ((49.5/($MaxX/$TotalX))/$daycounter); } foreach $daycount ($startday..$endday) { print ""; if (($daycount > $startday) && ($daycount-(int($daycount/7)*7)==3)) { print ""; if ($ColCountA) { print ""; print ""; } if ($ColCountB) { print ""; print ""; } print "\n"; print ""; } &count_to_date($daycount); if ($perp_mon < 10) { $perp_mon = "0$perp_mon"; } if ($perp_day < 10) { $perp_day = "0$perp_day"; } $perp_year = $perp_year + 1900; print ""; $banners = "$perp_day $perp_mon $perp_year S"; $clicksfrom = "$perp_day $perp_mon $perp_year X"; $exposures = "$perp_day $perp_mon $perp_year E"; $clicks = "$perp_day $perp_mon $perp_year C"; $banners = $accesses{$banners}; if (($TotalS == 0) || ($banners==$TotalS)) { $bannerspercent = 0; } else { $bannerspercent=int((($banners/$TotalS)*($daycounter*$MultS))+.5); } $clicksfrom = $accesses{$clicksfrom}; if (($TotalX == 0) || ($clicksfrom==$TotalX)) { $clicksfrompercent = 0; } else { $clicksfrompercent=int((($clicksfrom/$TotalX)*($daycounter*$MultX))+.5); } $exposures = $accesses{$exposures}; if (($TotalE == 0) || ($exposures==$TotalE)) { $exposurespercent = 0; } else { $exposurespercent=int((($exposures/$TotalE)*($daycounter*$MultE))+.5); } $clicks = $accesses{$clicks}; if (($TotalC == 0) || ($clicks==$TotalC)) { $clickspercent = 0; } else { $clickspercent=int((($clicks/$TotalC)*($daycounter*$MultC))+.5); } if ($banners < 1) { $banners = "0"; } if ($clicksfrom < 1) { $clicksfrom = "0"; } if ($exposures < 1) { $exposures = "0"; } if ($clicks < 1) { $clicks = "0"; } if ($bannex) { print ""; print ""; if ($bannerspercent==0) { print ""; } else { print ""; } if ($INPUT{'showclicksfrom'}) { print ""; if ($clicksfrompercent==0) { print ""; } else { print ""; } if ($banners == 0) { $perc = "-"; } elsif ($clicksfrom == 0) { $perc = "-"; } else { $perc = ((100*($clicksfrom/$banners))+.05001); } unless ($perc eq "-") { $perc =~ s/(\d+\.\d).*/$1/; $perc = $perc."%"; } print ""; } } if ($beingshown) { print ""; print ""; if ($exposurespercent==0) { print ""; } else { print ""; } print ""; if ($clickspercent==0) { print ""; } else { print ""; } if ($exposures == 0) { $perc = "-"; } elsif ($clicks == 0) { $perc = "-"; } else { $perc = ((100*($clicks/$exposures))+.05001); } unless ($perc eq "-") { $perc =~ s/(\d+\.\d).*/$1/; $perc = $perc."%"; } print ""; print "\n"; } } print "
$text{'2224'}

         $text{'2040'}"; print "

$text{'2041'}"; print "

$text{'2018'}

         $text{'2030'}"; print "

$text{'2031'}"; print "

$text{'2018'}


 
 
$perp_day $months[$perp_mon-1] $perp_year  ",&commas($banners)," 
 ",&commas($clicksfrom)," 
 $perc  ",&commas($exposures)," 
 ",&commas($clicks)," 
 $perc
\n"; if ($ShortenedList) { print "

\n"; print "\n"; if ($INPUT{'groupstatus'}) { print "\n"; } print "\n"; print "\n"; if ($cryptword) { print "\n"; } if ($INPUT{'showclicksfrom'}) { print "\n"; } print ""; print "
\n"; } elsif ($INPUT{'FullDailyList'}) { print "

\n"; print "\n"; if ($INPUT{'groupstatus'}) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } if ($INPUT{'showclicksfrom'}) { print "\n"; } print ""; print "
\n"; } print "

\n"; print "\n"; if ($LogByZone) { print "\n"; } print "\n"; if ($ADVLogIP) { print "\n"; } print "
\n"; print "\n"; if ($cryptword) { print "\n"; } print "\n"; print " "; print "
\n"; print "\n"; if ($INPUT{'groupstatus'}) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } if ($clicksratio || $cryptword || $ShowClicksFrom) { print "\n"; } print ""; print "
\n"; print "\n"; if ($INPUT{'groupstatus'}) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } if ($INPUT{'showclicksfrom'}) { print "\n"; } print ""; print "
\n"; print "\n"; if ($INPUT{'groupstatus'}) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } if ($INPUT{'showclicksfrom'}) { print "\n"; } print ""; print "
\n"; &Footer; } sub monthlystats { $AccountName = $INPUT{'advert'}; &CheckName; &ConfirmUserPassword; open (DISPLAY, "<$ADVadverts_dir/$subdir/$AccountName.log") || &Error_NoStats; @lines = ; close (DISPLAY); chomp (@lines); foreach $line (@lines) { next if (length($line) < 10); ($acc,$logstring) = ($line =~ /^(\d\d\d\d\d\d\d\d\d\d) \d\d (\d\d \d\d\d\d \w)$/); $accesses{$logstring} += int($acc); ($mon,$year,$type) = ($logstring =~ /^(\d+) (\d+) (\w)/); if ($type eq "E") { $beingshown = 1; $TotalE += int($acc); } elsif ($type eq "C") { $beingshown = 1; $TotalC += int($acc); } elsif ($type eq "S") { $bannex = 1; $TotalS += int($acc); } elsif ($type eq "X") { $bannex = 1; $TotalX += int($acc); } else { next; } unless ($startyear) { $startyear = $year; $startmon = $mon; } } $endyear = $year; $endmon = $mon; &Header("$text{'1000'}","$text{'1001'}"); print "

$text{'2230'} "; print "$AccountName $text{'2231'}"; print ":\n"; print "

\n"; print ""; print ""; if ($bannex) { print ""; print ""; if ($INPUT{'showclicksfrom'}) { print ""; print ""; } } if ($beingshown) { print ""; print ""; print ""; print ""; } foreach $year ($startyear..$endyear) { if ($year == $startyear) { $firstmon = $startmon; } else { $firstmon = "01"; } if ($year == $endyear) { $lastmon = $endmon; } else { $lastmon = 12; } foreach $month ($firstmon..$lastmon) { $TestS = "$month $year S"; $TestX = "$month $year X"; $TestE = "$month $year E"; $TestC = "$month $year C"; if ($accesses{$TestS} > $MaxS) { $MaxS = $accesses{$TestS}; } if ($accesses{$TestX} > $MaxX) { $MaxX = $accesses{$TestX}; } if ($accesses{$TestE} > $MaxE) { $MaxE = $accesses{$TestE}; } if ($accesses{$TestC} > $MaxC) { $MaxC = $accesses{$TestC}; } $monthcounter++; } } if ($TotalE) { $MultE = ((49.5/($MaxE/$TotalE))/$monthcounter); } if ($TotalC) { $MultC = ((49.5/($MaxC/$TotalC))/$monthcounter); } if ($TotalS) { $MultS = ((49.5/($MaxS/$TotalS))/$monthcounter); } if ($TotalX) { $MultX = ((49.5/($MaxX/$TotalX))/$monthcounter); } foreach $year ($startyear..$endyear) { if ($year == $startyear) { $firstmon = $startmon; } else { $firstmon = "01"; } if ($year == $endyear) { $lastmon = $endmon; } else { $lastmon = 12; } foreach $month ($firstmon..$lastmon) { print ""; print ""; unless (length($month) == 2) { $month = "0".$month; } $banners = "$month $year S"; $clicksfrom = "$month $year X"; $exposures = "$month $year E"; $clicks = "$month $year C"; $banners = $accesses{$banners}; if (($TotalS == 0) || ($banners==$TotalS)) { $bannerspercent = 0; } else { $bannerspercent=int((($banners/$TotalS)*($monthcounter*$MultS))+.5); } $clicksfrom = $accesses{$clicksfrom}; if (($TotalX == 0) || ($clicksfrom==$TotalX)) { $clicksfrompercent = 0; } else { $clicksfrompercent=int((($clicksfrom/$TotalX)*($monthcounter*$MultX))+.5); } $exposures = $accesses{$exposures}; if (($TotalE == 0) || ($exposures==$TotalE)) { $exposurespercent = 0; } else { $exposurespercent=int((($exposures/$TotalE)*($monthcounter*$MultE))+.5); } $clicks = $accesses{$clicks}; if (($TotalC == 0) || ($clicks==$TotalC)) { $clickspercent = 0; } else { $clickspercent=int((($clicks/$TotalC)*($monthcounter*$MultC))+.5); } if ($banners < 1) { $banners = "0"; } if ($clicksfrom < 1) { $clicksfrom = "0"; } if ($exposures < 1) { $exposures = "0"; } if ($clicks < 1) { $clicks = "0"; } if ($bannex) { print ""; print ""; if ($bannerspercent==0) { print ""; } else { print ""; } if ($INPUT{'showclicksfrom'}) { print ""; if ($clicksfrompercent==0) { print ""; } else { print ""; } if ($banners == 0) { $perc = "-"; } elsif ($clicksfrom == 0) { $perc = "-"; } else { $perc = ((100*($clicksfrom/$banners))+.05001); } unless ($perc eq "-") { $perc =~ s/(\d+\.\d).*/$1/; $perc = $perc."%"; } print ""; } } if ($beingshown) { print ""; print ""; if ($exposurespercent==0) { print ""; } else { print ""; } print ""; if ($clickspercent==0) { print ""; } else { print ""; } if ($exposures == 0) { $perc = "-"; } elsif ($clicks == 0) { $perc = "-"; } else { $perc = ((100*($clicks/$exposures))+.05001); } unless ($perc eq "-") { $perc =~ s/(\d+\.\d).*/$1/; $perc = $perc."%"; } print ""; print "\n"; } } } print "
$text{'2232'}

         $text{'2040'}"; print "

$text{'2041'}"; print "

$text{'2018'}

         $text{'2030'}"; print "

$text{'2031'}"; print "

$text{'2018'}

$months[$month-1] $year  ",&commas($banners)," 
 ",&commas($clicksfrom)," 
 $perc  ",&commas($exposures)," 
 ",&commas($clicks)," 
 $perc
\n"; print "

\n"; print "\n"; if ($LogByZone) { print "\n"; } print "\n"; if ($ADVLogIP) { print "\n"; } print "
\n"; print "\n"; if ($cryptword) { print "\n"; } print "\n"; print " "; print "
\n"; print "\n"; if ($INPUT{'groupstatus'}) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } if ($clicksratio || $cryptword || $ShowClicksFrom) { print "\n"; } print ""; print "
\n"; print "\n"; if ($INPUT{'groupstatus'}) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } if ($INPUT{'showclicksfrom'}) { print "\n"; } print ""; print "
\n"; print "\n"; if ($INPUT{'groupstatus'}) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } if ($INPUT{'showclicksfrom'}) { print "\n"; } print ""; print "
\n"; &Footer; } sub iplog { $AccountName = $INPUT{'advert'}; &CheckName; &ConfirmUserPassword; &Header("$text{'1000'}","$text{'1001'}"); print "

$text{'2240'} ", "$AccountName $text{'2241'}:\n", "

$text{'2242'}\n", "

";
	($mday,$mon) = (localtime($time-86400+($ADVHourOffset*3600)))[3,4];
	if ($mday < 10) { $mday = "0".$mday; }
	$mon++;
	if ($mon < 10) { $mon = "0".$mon; }
	open (DISPLAY, "$ADVadverts_dir/$subdir/$AccountName.$mon$mday.log");
	&ShowIPs;
	close (DISPLAY);
	($mday,$mon) = (localtime($time+($ADVHourOffset*3600)))[3,4];
	if ($mday < 10) { $mday = "0".$mday; }
	$mon++;
	if ($mon < 10) { $mon = "0".$mon; }
	open (DISPLAY, "$ADVadverts_dir/$subdir/$AccountName.$mon$mday.log");
	&ShowIPs;
	close (DISPLAY);
	print "
\n"; print "

$text{'2243'}: ",&commas($ExposureCount),"\n"; print "
$text{'2244'}: ",&commas($ClickCount),"\n"; print "
$text{'2245'}: ",&commas($IPCount),"\n"; if ($IPCount<1) { $AverageEntries = 0; } else { $AverageEntries = (($ExposureCount+$ClickCount)/$IPCount)+.05; } if ($AverageEntries < 10) { $AverageEntries =~ s/(...).*/$1/; } else { $AverageEntries =~ s/(....).*/$1/; } print "

$text{'2246'}: ${AverageEntries}\n"; print "

\n"; print "\n"; if ($LogByZone) { print "\n"; } print "\n"; print "\n"; print "
\n"; print "\n"; if ($cryptword) { print "\n"; } print "\n"; print " "; print "
\n"; print "\n"; if ($INPUT{'groupstatus'}) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } if ($clicksratio || $cryptword || $ShowClicksFrom) { print "\n"; } print ""; print "
\n"; print "\n"; if ($INPUT{'groupstatus'}) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } if ($INPUT{'showclicksfrom'}) { print "\n"; } print ""; print "
\n"; print "\n"; if ($INPUT{'groupstatus'}) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } if ($INPUT{'showclicksfrom'}) { print "\n"; } print ""; print "
\n"; &Footer; } sub ShowIPs { if ($IPLog) { dbmopen(%Resolved,"$IPLog",0666); } while () { next if (length($_) < 5); if (/([^\s]* E) ([^\s]*)\n/) { $ExposureCount ++; $ThisTime = $1; $ThisIP = $2; } elsif (/([^\s]* C) ([^\s]*)\n/) { $ClickCount ++; $ThisTime = $1; $ThisIP = $2; } $ThisTrimmedIP = $ThisIP; if ($ThisTrimmedIP =~ /\d+\.\d+\.\d+\.\d+/) { $ThisTrimmedIP =~ s/(\d+\.\d+\.\d+)\.\d+/$1\.XXX/; if ($Resolved{$ThisTrimmedIP} && ($Resolved{$ThisTrimmedIP} ne "unresolved")) { foreach $key (8..15) { if (length($ThisIP)<$key) { $ThisIP .= " "; } } $ThisIP .= " $Resolved{$ThisTrimmedIP}"; } } unless ($NoPrintIPs) { print "$mon/$mday $ThisTime $ThisIP\n"; } $IPCount{$ThisIP} ++; if ($IPCount{$ThisIP} == 1) { $IPCount ++; } } if ($IPLog) { dbmclose(%Resolved); } } sub masteriplog { &ConfirmAdminPassword(1); &Header("$text{'1000'}","$text{'1001'}"); print "

", "Master IP Address Report\n", "

The following report details the IP addresses which ", "have seen or clicked on banners in the rotation ", "in the last $MasterIPLogDays days.\n"; $NoPrintIPs = 1; foreach $key (a..z,0..9) { opendir (FILES,"$ADVadverts_dir/$key"); @files = readdir(FILES); closedir (FILES); foreach $file (@files) { next unless (-d "$ADVadverts_dir/$key/$file"); opendir (SUBFILES,"$ADVadverts_dir/$key/$file"); @subfiles = readdir(SUBFILES); closedir (SUBFILES); foreach $subfile (@subfiles) { next unless ($subfile=~/\d\d\d\d\.log/); open (DISPLAY, "$ADVadverts_dir/$key/$file/$subfile"); &ShowIPs; close (DISPLAY); } } } print "

Total exposures logged: ",&commas($ExposureCount),"\n"; print "
Total clicks logged: ",&commas($ClickCount),"\n"; print "
Total IP addresses logged: ",&commas($IPCount),"\n"; if ($IPCount<1) { $AverageEntries = 0; } else { $AverageEntries = (($ExposureCount+$ClickCount)/$IPCount)+.05; } if ($AverageEntries < 10) { $AverageEntries =~ s/(...).*/$1/; } else { $AverageEntries =~ s/(....).*/$1/; } print "

Average log entries per IP address: ${AverageEntries}\n"; print "

The Top 50 Most Active IP Addresses:\n"; print "

\n";
	foreach $key (sort ByCount keys(%IPCount)) {
		last if ($Counter > 49);
		$ip = $key;
		printf "%10s%-s\n",&commas($IPCount{$key}),"       $ip";
		$Counter++;
	}
	print "
\n"; &LinkBack; &Footer; } sub ByCount { $IPCount{$b}<=>$IPCount{$a}; } sub cheatercheck { &ConfirmAdminPassword(1); &Header("$text{'1000'}","$text{'1001'}"); print "

", ""Cheater Check" Report\n", "

The following report lists the number of banners shown on, ", "and the number of click-thrus from, each exchange member site ", "which "earns" exposures. Any sites with unusually ", "high or low click-thru ratios may be trying to "cheat" ", "the system by artificially inflating one or the other of those ", "counts.\n"; open (LIST, "<$ADVadverts_dir/adlist.txt"); @advertisements = ; close (LIST); chomp (@advertisements); @sortedadverts = sort (@advertisements); &ADVLockOpen (DBMLIST, "dbmlist.txt"); if ($ADVlockerror) { &Error_DBM; } else { &ADVDBMOpen; if ($ADVdbmerror) { &Error_DBM; } else { print "

\n", "", "", "", "", "", "\n"; foreach $advertiser (@sortedadverts) { $name = $advertiser; next if (length($advertiser) < 1); ($max,$shown,$visits,$image,$start,$weight, $zone,$raw,$displayratio,$clicksfrom) = split(/\t/,$DBMList{$name}); ($displayratio,$displaycount) = split(/\|/, $displayratio); ($clicksfrom,$clicksratio) = split(/\|/, $clicksfrom); next unless (($displayratio > 0) || ($displaycount > 0) || ($clicksfrom > 0) || ($clicksratio > 0)); if (($displaycount == 0) || ($clicksfrom == 0)) { $perc = "$text{'2020'}"; $ratio = "$text{'2020'}"; } else { $perc = ((100*($clicksfrom/$displaycount))+.05001); $ratio = (($displaycount/$clicksfrom)+.5001); } unless ($perc eq "$text{'2020'}") { $perc =~ s/(\d+\.\d).*/$1/; $perc = $perc."%"; } unless ($ratio eq "$text{'2020'}") { $ratio =~ s/(\d+)\.\d.*/$1/; $ratio = $ratio.":1"; } print "\n", "\n"; print ""; print ""; print "\n"; } &ADVDBMClose; print "
Account

Banners Shown
on Your Site


Clicks From
Your Site


%

Ratio

$advertiser",&commas($displaycount),"",&commas($clicksfrom),"$perc$ratio
\n"; } } print "


"; &ADVLockClose (DBMLIST, "dbmlist.txt"); &LinkBack; &Footer; } sub ShowAdvert { @image = split(/\|/,$image); $url =~ s//$time/g; if ($raw || $image) { print "

"; } if ($raw) { $realraw = $raw; $realraw =~ s//\n/g; $realraw =~ s//$time/g; $realraw =~ s///g; print ""; } elsif ($image) { print ""; } if ($raw || $image) { print "
$realraw"; foreach $image (@image) { $img = $image; $img =~ s//$time/g; if ($NotFirst) { print "

"; } else { $NotFirst=1; } if ($text && ($texttype eq "T")) { print "$text
"; } if ($url) { print ""; } print "\"$alt\"";"; if ($url) { print ""; } if ($text && ($texttype eq "B")) { print "
$text"; } print "\n"; } print "

\n"; } if ($url) { $printurl = $url; $printurl =~ s/%7c/\|/g; print "

Destination: "; print "$printurl\n"; } if ($username || $email) { if ($url) { print "
"; } else { print "

"; } print "Account Holder: "; if ($email) { print ""; } if ($username) { print "$username"; } else { print "$email"; } if ($email) { print ""; } print "\n"; } } sub resetadminlog { &ConfirmAdminPassword(1); unlink "$ADVadverts_dir/adminlog.txt"; if ($AdminDisplaySetup) { &defineview; } else { $INPUT{'whichtype'} = "pending established groups"; $INPUT{'whichtime'} = "active expired disabled"; $INPUT{'whichzone'} = ""; &reviewall; } } sub adminlog { &ConfirmAdminPassword(1); &Header("$text{'1000'}","$text{'1001'}"); print "

", "Admin Accesses Report\n", "

The following report lists the IP addresses ", "which have accessed administrative functions.\n"; print "

\n";
	open (ADMINLOG,"$ADVadverts_dir/adminlog.txt");
	while () { print "$_"; }
	close (ADMINLOG);
	print "
\n"; print "
\n", "

\n", "\n", "

\n", "

\n"; &LinkBack; &Footer; } sub RenameAccount { &ConfirmAdminPassword(1); &ADVLockOpen (DBMLIST, "dbmlist.txt"); if ($ADVlockerror) { &Error_DBM; } else { &ADVDBMOpen; if ($ADVdbmerror) { &Error_DBM; } else { $AccountName = $INPUT{'oldname'}; &CheckName; $oldname = $AccountName; $oldsubdir = $subdir; unless ($DBMList{$oldname}) { &Header("$text{'9000'}","Rename Error!"); print "

No account "$oldname" exists!\n"; &ADVDBMClose; &ADVLockClose (DBMLIST, "dbmlist.txt"); &Footer; } $AccountName = $INPUT{'newname'}; &CheckName; $newname = $AccountName; $newsubdir = $subdir; if ($DBMList{$newname}) { &Header("$text{'9000'}","Rename Error!"); print "

Account name "$newname" is already in use!\n"; &ADVDBMClose; &ADVLockClose (DBMLIST, "dbmlist.txt"); &Footer; } unless (-d "$ADVadverts_dir/$newsubdir") { mkdir ("$ADVadverts_dir/$newsubdir",0777); chmod 0777,"$ADVadverts_dir/$newsubdir"; } opendir (FILES,"$ADVadverts_dir/$oldsubdir"); @files = readdir(FILES); closedir (FILES); foreach $file (@files) { next if ($file =~ /^\./); $_ = $file; /^(.+)$/; $file = $1; $newfile = $file; $newfile =~ s/$oldname/$newname/; rename ("$ADVadverts_dir/$oldsubdir/$file","$ADVadverts_dir/$newsubdir/$newfile"); } rmdir ("$ADVadverts_dir/$oldsubdir"); if ($UserUploadDir) { rename ("$UserUploadDir/$oldname\.gif","$UserUploadDir/$newname\.gif"); rename ("$UserUploadDir/$oldname\.jpg","$UserUploadDir/$newname\.jpg"); &ADVLockOpen (COUNT, "$newsubdir/$newname.txt"); @lines = ; chomp (@lines); seek (COUNT,0,0); foreach $line (@lines) { $line =~ s/$oldname\.gif/$newname\.gif/; $line =~ s/$oldname\.jpg/$newname\.jpg/; print COUNT "$line\n"; } truncate (COUNT, tell(COUNT)); &ADVLockClose (COUNT,"$newsubdir/$newname.txt"); } if (-s "$ADVadverts_dir/adlist.txt") { &ADVLockOpen (COUNT, "adlist.txt"); @lines = ; chomp (@lines); seek (COUNT,0,0); foreach $line (@lines) { if ($line eq $oldname) { print COUNT "$newname\n"; } else { print COUNT "$line\n"; } } truncate (COUNT, tell(COUNT)); &ADVLockClose (COUNT,"adlist.txt"); } if (-s "$ADVadverts_dir/adnew.txt") { &ADVLockOpen (COUNT, "adnew.txt"); @lines = ; chomp (@lines); seek (COUNT,0,0); foreach $line (@lines) { if ($line eq $oldname) { print COUNT "$newname\n"; } else { print COUNT "$line\n"; } } truncate (COUNT, tell(COUNT)); &ADVLockClose (COUNT,"adnew.txt"); } $DBMList{$newname} = $DBMList{$oldname}; delete ($DBMList{$oldname}); &ADVDBMClose; } } &ADVLockClose (DBMLIST, "dbmlist.txt"); &Header("$text{'1000'}","$text{'1001'}"); print "

Account Renamed\n", "

The "$oldname" account has been renamed "$newname."\n"; &LinkBack; &Footer; } sub edit { &ConfirmAdminPassword(1); if ($INPUT{'reviewone'} && !($INPUT{'editad'})) { $INPUT{'editad'} = $INPUT{'reviewone'}; } if ($INPUT{'basedon'}) { $AccountName = $INPUT{'basedonad'}; &CheckName; if (-s "$ADVadverts_dir/$subdir/$AccountName.txt") { &Header("$text{'9000'}","Name Error!"); print "

Account name "$AccountName" is already in use!\n"; &ADVDBMClose; &ADVLockClose (DBMLIST, "dbmlist.txt"); &Footer; } $AccountName = $INPUT{'basedonsource'}; } else { $AccountName = $INPUT{'editad'}; } &CheckName; if (-s "$ADVadverts_dir/$subdir/$AccountName.txt") { open (DISPLAY, "<$ADVadverts_dir/$subdir/$AccountName.dat"); @lines = ; close (DISPLAY); chomp (@lines); foreach $line (@lines) { $line =~ s/&/&/g; $line =~ s/>/>/g; $line =~ s/; close (DISPLAY); chomp (@lines); foreach $line (@lines) { $line =~ s/&/&/g; $line =~ s/>/>/g; $line =~ s/ $time) { $start = $time; } $displaycount = 0; $clicksfrom = 0; } unless ($weight) { if ($maxtype) { $weight = "0"; } else { $weight = $DefaultWeight; } } unless ($border) { if ($maxtype) { $border = "0"; } else { $border = $DefaultBorder; } } unless ($displayratio) { if ($maxtype) { $displayratio = "0"; } else { $displayratio = $DefaultDisplayRatio; } } unless ($clicksratio) { if ($maxtype) { $clicksratio = "0"; } else { $clicksratio = $DefaultClicksRatio; } } unless ($target) { if ($maxtype) { $target = ""; } else { $target = $DefaultLinkAttribute; } } if ($target eq "_top") { $target = "TARGET="_top""; } unless ($maxtype) { $maxtype = "E"; } unless ($texttype) { $texttype = "B"; } unless ($url) { $url = "http://"; } $image =~ s/\|/\n/g; unless ($image) { $image = "http://"; } &Header("$text{'1000'}","$text{'1001'}"); print "

\n"; print "

Info for the ", "$AccountName Account:", "\n", "

\n", "\n", "\n", "\n", "\n", "\n"; print "\n"; print ""; print "\n", "\n", "\n", "\n"; if (@zones) { print "\n"; print "\n"; } else { print "\n"; } $url =~ s/%7c/\|/g; $image =~ s/%7c/\|/g; print "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "

", "I. General Information: ", "The following is general "background" ", "information. The purpose of the "Name" and "E-Mail" ", "fields should of course be obvious; the "Password" field records ", "the password the account holder will use to view his stats. The ", ""Comments" field can be used for whatever other information ", "you deem important. (It will be seen only by you, and never by the ", "account holder, so you may be as candid as you like.) The other ", "fields help to determine how, where, and how often the account's banner ", "will be shown.
Name:
E-Mail:
Comments:
Start Day:"; if ($start) { ($mday,$mon,$year) = (localtime($start+($ADVHourOffset*3600)))[3,4,5]; } else { ($mday,$mon,$year) = (localtime($time+($ADVHourOffset*3600)))[3,4,5]; } $year += 1900; print " "; print " "; print ""; print "
(Input the date ", "on which the account should start running, or leave unaltered ", "to start the run immediately.)", "
Expiration: Never Expires
Expires on Date: "; if ($max && ($maxtype eq "D")) { ($mday,$mon,$year) = (localtime($max+($ADVHourOffset*3600)))[3,4,5]; $max = "0"; } else { ($mday,$mon,$year) = (localtime($time+($ADVHourOffset*3600)))[3,4,5]; } $year += 1900; print " "; print " "; print "
"; unless ($max) { $max = "0"; } print "
Expires After: "; print ""; print " Exposures Clicks\n"; print "
(Input the date on which the run will end, or the maximum number ", "of exposures or click-thrus to be allowed for the run.)", "
Display Ratio: displays earn 1 exposure", "
1 click earns
exposures", "
(If this account is to "earn" exposures by ", "showing other banners, input the appropriate details here.)", "
", "Note that while either an expiration or a display ", "ratio must be set, it is not necessary to set both. ", "If you're running a "banner exchange," ", "the display ratio will define the rate at which banner exposures ", "are earned, based upon displays and/or click-thrus generated by ", "the member. In that case, generally, you'll want to leave the ", "expiration set either to "0 Exposures" or "Never Expires." ", "If, on the other hand, you're running straight advertisements, leave the ", "display ratios set to 0 (or undefined), and simply set the appropriate ", "expiration criteria instead. Define both only if you're running ", "an exchange in which the member is to get extra ", ""bonus" exposures; in that case, define the bonus number ", "in the "expiration" slot.", "
Weight (Wt.):", "
(Define how often this banner will be eligible for display. 0 = never, 1 = every cycle through the list, ", "2 = every other cycle, 3 = every third cycle, etc.)", "
Zone(s):"; foreach $setzone (sort (@zones)) { print "$setzone\n
"; } print "(Select above, the zones -- or "target categories" -- "; print "in which this banner should be displayed.)"; print "
"; $displayzone = "\+".$displayzone."\+"; foreach $setzone (sort (@zones)) { print "$setzone\n
"; } print "(If this account holder is an exchange member, "; print "select above, the category or categories of banners which should be displayed on "; print "his pages.)"; print "
Zone(s):"; print "
(List the zones -- or "target categories" -- "; print "in which this banner should be displayed.)"; print "
Password:

", "II. Banner Details: ", "The following information will be used to generate ", "the account's banner links.
Site URL:
Banner URL(s):", "", "
(Input more than one banner URL only if you don't want ", "distinct performance data for each banner. If you do want to know ", "individually how each banner performs, create a distinct ", "account for each one.)", "
Link Attributes:", "
(Select TARGET or other attributes -- example: TARGET="_blank" -- that should be included ", "in the banner's link code.)", "
Banner Width: pixels
Banner Height: pixels
Border:
ALT Text:
Link Text:", "
Above Banner Below Banner

", "III. "Raw Mode" Information: ", "If you so choose, you can specify below exactly ", "how a banner is to appear on your pages. Only use this option if you're sure ", "you know what you're doing! Anything input here will appear on your pages exactly ", "as you enter it here; ", "the information in section II will only be used if this information cannot be displayed ", "(usually because a banner was called from an IMG tag rather than from an SSI, IFRAME or JavaScript tag).
"Raw" HTML:", "

\n", "

\n", "\n", "\n", "Check here to reset account exposures & clicks: ", ""; if ($mailprog && (-s "$ADVadverts_dir/welcome.txt")) { print "
Check here to send a welcome letter: ", ""; } if ($cryptword) { print "\n"; } print "

\n"; if (-s "$ADVadverts_dir/$subdir/$AccountName.txt") { if ($mailprog && (-s "$ADVadverts_dir/reject.txt") && $email) { print "

Check here to send a rejection letter: ", ""; } print "

"; print "\n"; } print "

\n"; &Footer; } sub UserEdit { $AccountName = $INPUT{'reviewone'}; &CheckName; if (-s "$ADVadverts_dir/$subdir/$AccountName.txt") { open (DISPLAY, "<$ADVadverts_dir/$subdir/$AccountName.dat"); @lines = ; close (DISPLAY); chomp (@lines); foreach $line (@lines) { $line =~ s/&/&/g; $line =~ s/>/>/g; $line =~ s/; close (DISPLAY); chomp (@lines); foreach $line (@lines) { $line =~ s/&/&/g; $line =~ s/>/>/g; $line =~ s/\n", "

$text{'5000'} ", "$AccountName $text{'5001'}:", "\n", "

\n", "\n", "\n", "\n"; unless ($NoBanners) { print "\n"; unless ($UserUploadDir && $RequireUpload && !$cryptword) { print "\n"; } if (@zones) { print ""; unless ($NoBanners) { print "\n"; print ""; } print "\n"; } print "\n", "

$text{'5100'}:
$text{'5101'}:
$text{'5102'}:
$text{'5103'}:", ""; if ($UserUploadDir && !(-s "$ADVadverts_dir/$subdir/$AccountName.txt")) { print "
$text{'5200'}"; } } else { print "
$text{'5201'}"; } print "
$text{'5104'}:"; foreach $setzone (sort (@zones)) { print "$setzone\n
"; } print "$text{'5300'}"; print "
"; $displayzone = "\+".$displayzone."\+"; foreach $setzone (sort (@zones)) { print "$setzone\n
"; } print "$text{'5301'}"; print "

\n", "

\n", "\n", "\n"; if ($AllowUserEdit && $INPUT{'newuser'}) { print "\n"; } if ($cryptword) { print "\n"; } print "

\n"; if (-s "$ADVadverts_dir/$subdir/$AccountName.txt") { print "

"; print "\n"; } print "

\n"; print "


$text{'5400'}\n"; print "

\n", "

$text{'5401'}: \n", "

\n", "\n"; if ($cryptword) { print "\n"; } print "

\n"; &Footer; } sub NewUserPassword { $AccountName = $INPUT{'reviewone'}; &CheckName; if (-s "$ADVadverts_dir/$subdir/$AccountName.txt") { open (DISPLAY, "<$ADVadverts_dir/$subdir/$AccountName.dat"); @lines = ; close (DISPLAY); chomp (@lines); ($pass) = $lines[0]; unless ($INPUT{'password'} eq $pass) { &ConfirmAdminPassword(2); } } else { &Header("$text{'9000'}","$text{'9050'}"); print "

$text{'9051'} "; print ""$AccountName" $text{'9052'}\n"; &Footer; } $lines[0] = $INPUT{'pass'}; $INPUT{'password'} = $INPUT{'pass'}; &ADVLockOpen (DISPLAY, "$subdir/$AccountName.dat","x"); seek (DISPLAY,0,0); foreach $key (0..3) { print DISPLAY "$lines[$key]\n"; } truncate (DISPLAY,tell(DISPLAY)); &ADVLockClose (DISPLAY, "$AccountName.dat"); &reviewone; } sub UploadBannerForm { $AccountName = $INPUT{'reviewone'}; &CheckName; if ($UserUploadDir && (-s "$ADVadverts_dir/$subdir/$AccountName.txt")) { open (DISPLAY, "<$ADVadverts_dir/$subdir/$AccountName.dat"); @lines = ; close (DISPLAY); chomp (@lines); foreach $line (@lines) { $line =~ s/&/&/g; $line =~ s/>/>/g; $line =~ s/$text{'5500'}\n"; print "

\n", "

$text{'5501'}: ", "

\n", "\n"; if ($cryptword) { print "\n"; } print "

\n"; &Footer; } else { &Header("$text{'9000'}","Upload Error!"); print "

Either uploading of banners isn't allowed, "; print "or the account name provided is invalid!\n"; &ADVDBMClose; &ADVLockClose (DBMLIST, "dbmlist.txt"); &Footer; } } sub UploadBanner { $AccountName = $INPUT{'reviewone'}; &CheckName; if (-s "$ADVadverts_dir/$subdir/$AccountName.txt") { open (DISPLAY, "<$ADVadverts_dir/$subdir/$AccountName.dat"); @lines = ; close (DISPLAY); chomp (@lines); $pass = $lines[0]; unless ($INPUT{'password'} eq $pass) { &ConfirmAdminPassword(2); } open (DISPLAY, "<$ADVadverts_dir/$subdir/$AccountName.txt"); @lines = ; close (DISPLAY); chomp (@lines); $image = $lines[4]; } else { &Header("$text{'9000'}","$text{'9050'}"); print "

$text{'9051'} "; print ""$AccountName" $text{'9052'}\n"; &Footer; } if ($BannerType eq "GIF") { $bannername = "$AccountName.gif"; } elsif ($BannerType eq "JPG") { $bannername = "$AccountName.jpg"; } else { &Header("$text{'9000'}","$text{'9060'}"); print "

$text{'9061'}\n"; &Footer; } if (length($INPUT{'BannerFile'}) > ($MaxBannerSize*1024)) { &Header("$text{'9000'}","$text{'9070'}"); print "

$text{'9071'} "; print "$MaxBannerSize $text{'9072'} "; print int((length($INPUT{'BannerFile'})/1024)+.5)," $text{'9073'}\n"; &Footer; } unless (open (BANNER,">$UserUploadDir/$bannername")) { &Header("$text{'9000'}","$text{'9080'}"); print "

$text{'9081'}\n"; &Footer; } binmode BANNER; print BANNER $INPUT{'BannerFile'}; close (BANNER); $image = "$UserUploadURL/$bannername"; &ADVLockOpen (DISPLAY, "$subdir/$AccountName.txt","x"); seek (DISPLAY,0,0); $lines[4] = $image; foreach $key (0..20) { print DISPLAY "$lines[$key]\n"; } truncate (DISPLAY,tell(DISPLAY)); &ADVLockClose (DISPLAY, "$AccountName.txt"); $PresenceCheck = 0; unless ($cryptword || !($RequireAdminApproval)) { &ADVLockOpen (COUNT, "adlist.txt"); @lines = ; chomp (@lines); seek(COUNT, 0, 0); foreach $line (@lines) { if ($line eq $AccountName) { $PresenceCheck = 1; } unless (($line eq $AccountName) || (length($line) < 1)) { print COUNT "$line\n"; } } truncate (COUNT, tell(COUNT)); &ADVLockClose (COUNT, "adlist.txt"); } if ($PresenceCheck) { $PresenceCheck = 0; &ADVLockOpen (COUNT, "adnew.txt"); @lines = ; chomp (@lines); seek(COUNT, 0, 0); foreach $line (@lines) { if ($line eq $AccountName) { $PresenceCheck = 1; } unless (($line eq $AccountName) || (length($line) < 1)) { print COUNT "$line\n"; } } unless ($PresenceCheck) { print COUNT "$AccountName\n"; &SendMail($email_address,"admin"); } truncate (COUNT, tell(COUNT)); &ADVLockClose (COUNT, "adnew.txt"); } &reviewone; } sub editgroup { &ConfirmAdminPassword(1); $AccountName = $INPUT{'editgroup'}; &CheckName; if (-s "$ADVadverts_dir/$AccountName.grp") { open (DISPLAY, "<$ADVadverts_dir/$AccountName.grp"); @lines = ; close (DISPLAY); chomp (@lines); $grouppassword = $lines[0]; $adverts = join(' ',@lines); } &Header("$text{'1000'}","$text{'1001'}"); print "

\n"; print "

Info for the "; print "$AccountName Group:"; print "\n"; print "

Select the adverts to be included in this group:\n"; open (COUNT, "<$ADVadverts_dir/adlist.txt"); @lines = ; close (COUNT); chomp (@lines); @sortedlines = sort (@lines); $size = @lines; if ($size > 10) { $size = 10; } print "

\n"; print "

Password: \n"; print "

\n"; print "\n"; print "\n"; if (-s "$ADVadverts_dir/$AccountName.grp") { print "

"; print "\n"; } print "

\n"; &Footer; } sub del { $AccountName = $INPUT{'delad'}; &CheckName; unless (-s "$ADVadverts_dir/$subdir/$AccountName.txt") { &Header("$text{'9000'}","$text{'9050'}"); print "

$text{'9051'} "; print ""$AccountName" $text{'9052'}\n"; &Footer; } &ConfirmUserPassword; &Header("$text{'1000'}","$text{'1001'}"); print "

\n"; print "\n"; print "

Are you sure you want to delete the "; print "$AccountName account?\n"; print "\n"; if ($INPUT{'rejectionletter'}) { print "\n"; } if ($cryptword) { print "\n"; } print "\n"; print "
\n"; &Footer; } sub delgroup { $AccountName = $INPUT{'delgroupname'}; &CheckName; unless (-s "$ADVadverts_dir/$AccountName.grp") { &Header("$text{'9000'}","$text{'9050'}"); print "

$text{'9051'} "; print ""$AccountName" $text{'9052'}\n"; &Footer; } &ConfirmAdminPassword(1); &Header("$text{'1000'}","$text{'1001'}"); print "

\n"; print "

Are you sure you want to delete the "; print "$AccountName group? "; print "\n"; print "\n"; print "\n"; print "
\n"; print "

(Please note that deleting the group will "; print "not delete or otherwise affect the adverts "; print "themselves. Only the ability to view all their stats "; print "on a single page will be gone!)\n"; &Footer; } sub newpass { unless ($INPUT{'passad'} && ($INPUT{'passad'} eq $INPUT{'passad2'})) { &Header("$text{'9000'}","$text{'9024'}"); print "

$text{'9025'}\n"; &Footer; } open (PASSWORD, "<$ADVadverts_dir/adpassword.txt"); $password = ; close (PASSWORD); chomp ($password); if ($password) { if ($INPUT{'password'}) { $newpassword = crypt($INPUT{'password'}, "aa"); } else { &Header("$text{'9000'}","$text{'9020'}"); print "

$text{'9021'}\n"; &Footer; } unless ($newpassword eq $password) { &Header("$text{'9000'}","$text{'9022'}"); print "

$text{'9023'}\n"; &Footer; } } $newpassword = crypt($INPUT{'passad'}, "aa"); &ADVLockOpen (PASSWORD, "adpassword.txt"); seek (PASSWORD,0,0); print PASSWORD "$newpassword"; truncate (PASSWORD,tell(PASSWORD)); &ADVLockClose (PASSWORD,"adpassword.txt"); &Header("$text{'1000'}","$text{'1001'}"); print "

Your administrative password "; print "has been set.\n"; $INPUT{'password'} = $INPUT{'passad'}; &LinkBack; &Footer; } sub resetcount { &ConfirmAdminPassword(1); &ADVLockOpen (DBMLIST, "dbmlist.txt"); if ($ADVlockerror) { &Error_DBM; } else { &ADVDBMOpen; if ($ADVdbmerror) { &Error_DBM; } else { $DBMList{'adcount.txt'} = "1\n0\n$time"; &ADVDBMClose; } } &ADVLockClose (DBMLIST, "dbmlist.txt"); if ($AdminDisplaySetup) { &defineview; } else { $INPUT{'whichtype'} = "pending established groups"; $INPUT{'whichtime'} = "active expired disabled"; $INPUT{'whichzone'} = ""; &reviewall; } } sub editfinal { $AccountName = $INPUT{'editad'}; &CheckName; unless (!(-s "$ADVadverts_dir/$subdir/$AccountName.txt") && $AllowUserEdit && $INPUT{'newuser'}) { &ConfirmUserPassword; } if (-s "$ADVadverts_dir/$subdir/$AccountName.txt") { open (DISPLAY, "<$ADVadverts_dir/$subdir/$AccountName.txt"); @advertlines = ; $image = $advertlines[4]; close (DISPLAY); chomp (@advertlines); if ($cryptword) { ($shown,$visits,$start,$displaycount,$clicksfrom) = @advertlines[1,2,10,16,20]; ($other,$displaycount) = split(/\|/, $displaycount); ($clicksfrom,$other) = split(/\|/, $clicksfrom); $comments = $INPUT{'comments'}; } else { ($max,$shown,$visits,$dmy,$dmy,$height,$width, $alt,$dmy,$text,$start,$weight,$zone, $border,$target,$raw,$displayratio, $dmy,$dmy,$displayzone,$clicksfrom) = @advertlines; ($max,$maxtype) = split(/\|/, $max); ($text,$texttype) = split(/\|/, $text); ($displayratio,$displaycount) = split(/\|/, $displayratio); ($clicksfrom,$clicksratio) = split(/\|/, $clicksfrom); open (DISPLAY, "<$ADVadverts_dir/$subdir/$AccountName.dat"); @advertlines = ; close (DISPLAY); chomp (@advertlines); $comments = $advertlines[3]; } } elsif (!($cryptword)) { $maxtype = "E"; $texttype = "B"; $displayratio = $DefaultDisplayRatio; $clicksratio = $DefaultClicksRatio; $target = $DefaultLinkAttribute; $weight = $DefaultWeight; $border = $DefaultBorder; if ($NoBanners) { $INPUT{'url'} = ""; $INPUT{'image'} = ""; $INPUT{'zone'} = ""; } } $INPUT{'email'} =~ s/\s//g; unless ($INPUT{'email'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|,|;|\// || $INPUT{'email'} !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,6}|[0-9]{1,3})(\]?)$/) { $email = "$INPUT{'email'}"; } $INPUT{'url'} =~ s/\s//g; unless ($INPUT{'url'} =~ /(\.\.)|(^\.)|(\/\/\.)/ || $INPUT{'url'} !~ /(.*\:\/\/.*\..*|mailto:.*@.*)/) { $INPUT{'url'} =~ s/\|/%7c/g; $url = $INPUT{'url'}; } if ($UserUploadDir && $RequireUpload && !$cryptword) { $INPUT{'image'} = ""; } else { $image = ""; } @image = split(/\cM|\n/,$INPUT{'image'}); foreach $fauximage (@image) { $fauximage =~ s/\s//g; unless ($fauximage =~ /(\.\.)|(^\.)|(\/\/\.)/ || $fauximage !~ /.*\:\/\/.*\..*/ || $fauximage =~ /script:/) { $fauximage =~ s/\|/%7c/g; $image = $image.$fauximage."|"; } } chop ($image); $pass = $INPUT{'pass'}; if ($cryptword) { $displayratio = $INPUT{'displayratio'}; if ($displayratio < 1) { $displayratio = 0; } $clicksratio = $INPUT{'clicksratio'}; if ($clicksratio < 1) { $clicksratio = 0; } $weight = int($INPUT{'weight'}); } if ($INPUT{'zone'}) { $zone = $INPUT{'zone'}; $zone =~ s/^\s+//; $zone =~ s/\s+$//; $zone =~ s/\s+/ /g; } if ($INPUT{'displayzone'}) { $displayzone = $INPUT{'displayzone'}; $displayzone =~ s/^\s+//; $displayzone =~ s/\s+$//; $displayzone =~ s/\s+/\+/g; } if ($cryptword) { if ($INPUT{'purchtype'} eq "D") { if ($max) { ($mday,$mon,$year) = (localtime($max+($ADVHourOffset*3600)))[3,4,5]; } else { ($mday,$mon,$year) = (localtime($time+($ADVHourOffset*3600)))[3,4,5]; } $year += 1900; unless ($INPUT{'EndDateA'}) { $INPUT{'EndDateA'} = $mday; $INPUT{'EndDateB'} = $mon; } if ($INPUT{'EndDateC'} < 1990) { $INPUT{'EndDateC'} = $year; } $max = &rangedate($INPUT{'EndDateB'}+1,$INPUT{'EndDateA'}+1,$INPUT{'EndDateC'}-1900); $max -= 1; } else { $INPUT{'purch'} =~ s/[^-\d]//g; $max = $INPUT{'purch'}; } $maxtype = $INPUT{'purchtype'}; if (($max < 0) && ($maxtype ne "E")) { $max = 0; } if ($start) { ($mday,$mon,$year) = (localtime($start+($ADVHourOffset*3600)))[3,4,5]; } else { ($mday,$mon,$year) = (localtime($time+($ADVHourOffset*3600)))[3,4,5]; } $year += 1900; unless ($INPUT{'StartDateA'}) { $INPUT{'StartDateA'} = $mday; $INPUT{'StartDateB'} = $mon; } if ($INPUT{'StartDateC'} < 1990) { $INPUT{'StartDateC'} = $year; } $start = &rangedate($INPUT{'StartDateB'}+1,$INPUT{'StartDateA'},$INPUT{'StartDateC'}-1900); $height = int($INPUT{'height'}); $width = int($INPUT{'width'}); $alt = $INPUT{'alt'}; $INPUT{'text'} =~ s/^\s+//; $INPUT{'text'} =~ s/\s+$//; $INPUT{'text'} =~ s/\s+/ /g; $text = $INPUT{'text'}; $texttype = $INPUT{'texttype'}; $border = int($INPUT{'border'}); $target = $INPUT{'target'}; $INPUT{'raw'} =~ s/(\cM|\n)+//g; $raw = $INPUT{'raw'}; } unless ($pass) { &Header("$text{'9000'}","$text{'9100'}"); print "

$text{'9101'}\n"; &Footer; } if ((($maxtype eq "C") || ($maxtype eq "D")) && ($displayratio || $clicksratio)) { &Header("$text{'9000'}","$text{'9110'}"); print "

$text{'9111'}\n"; &Footer; } $PresenceCheck = 0; if (-s "$ADVadverts_dir/adnew.txt") { &ADVLockOpen (COUNT, "adnew.txt"); @lines = ; chomp (@lines); seek(COUNT, 0, 0); foreach $line (@lines) { if ($line eq $AccountName) { $PresenceCheck = 1; } unless (($line eq $AccountName) || (length($line) < 1)) { print COUNT "$line\n"; } } truncate (COUNT, tell(COUNT)); &ADVLockClose (COUNT, "adnew.txt"); } if (-s "$ADVadverts_dir/adlist.txt") { &ADVLockOpen (COUNT, "adlist.txt"); @lines = ; chomp (@lines); seek(COUNT, 0, 0); foreach $line (@lines) { if ($line eq $AccountName) { $PresenceCheck = 1; } unless (($line eq $AccountName) || (length($line) < 1)) { print COUNT "$line\n"; } } truncate (COUNT, tell(COUNT)); &ADVLockClose (COUNT, "adlist.txt"); } if ($INPUT{'resetadvert'} || (!$PresenceCheck && !$shown)) { $shown = 0; $visits = 0; unless ($start > $time) { $start = $time; } $displaycount = 0; $clicksfrom = 0; unlink ("$ADVadverts_dir/$subdir/$AccountName.log"); } if ($maxtype eq "N") { $max = 0; } &ADVLockOpen (DISPLAY, "$subdir/$AccountName.txt","x"); seek (DISPLAY,0,0); print DISPLAY "$max|$maxtype\n"; print DISPLAY "$shown\n"; print DISPLAY "$visits\n"; print DISPLAY "$url\n"; print DISPLAY "$image\n"; print DISPLAY "$height\n"; print DISPLAY "$width\n"; print DISPLAY "$alt\n\n"; print DISPLAY "$text|$texttype\n"; print DISPLAY "$start\n"; print DISPLAY "$weight\n"; print DISPLAY " $zone \n"; print DISPLAY "$border\n"; print DISPLAY "$target\n"; print DISPLAY "$raw\n"; print DISPLAY "$displayratio|$displaycount\n\n\n"; print DISPLAY "$displayzone\n"; print DISPLAY "$clicksfrom|$clicksratio\n"; if ((@advertlines > 21) && !($INPUT{'resetadvert'})) { foreach $key (21..(@advertlines-1)) { print DISPLAY "$advertlines[$key]\n"; } } truncate (DISPLAY,tell(DISPLAY)); &ADVLockClose (DISPLAY, "AccountName.txt"); &ADVLockOpen (DISPLAY, "$subdir/$AccountName.dat","x"); seek (DISPLAY,0,0); print DISPLAY "$pass\n"; print DISPLAY "$INPUT{'username'}\n"; print DISPLAY "$email\n"; print DISPLAY "$comments\n"; truncate (DISPLAY,tell(DISPLAY)); &ADVLockClose (DISPLAY, "AccountName.dat"); &ADVLockOpen (DBMLIST, "dbmlist.txt"); if ($ADVlockerror) { &Error_DBM; } else { &ADVDBMOpen; if ($ADVdbmerror) { &Error_DBM; } else { if ($image) { $image = "X"; } if ($raw =~ /