#!/usr/bin/perl # The following variables should be set to define the locations # and URLs of various files, as explained in the documentation, # and to "tailer" the functioning of the script. $adverts_dir = "/home/chevalwe/www/old/webadverts_files/"; $admin_cgi = "/old/webadverts_files/ads_admin.pl"; $nonssi_cgi = "/old/webadverts_files/ads.pl"; # %nonssi_cgis = ( # 'Zone1','http://cheval-web.net/webadverts_files/ads_1.pl', # 'Zone2','http://cheval-web.net/webadverts_files/ads_2.pl', # 'Zone3','http://cheval-web.net/webadverts_files/ads_3.pl', # ); $UseLocking = 1; $LogIP = 1; $AdminDisplaySetup = 0; $AllowUserEdit = 0; $RequireAdminApproval = 1; $LogAdminAccesses = 1; $IgnoredIPs = ""; $UserUploadDir = "/home/chevalwe/www/old/webadverts_files/"; $UserUploadURL = "http://localhost/webadverts_files/"; $MaxBannerSize = 20; $DefaultDisplayRatio = 2; $DefaultWeight = 1; $DefaultBorder = 0; $IFRAMEexchange = 1; $JavaScriptExchange = 1; $DefaultLinkAttribute = "target="_blank""; $bodyspec = "background=\"../francais/images/papier.jpg\" bgproperties=\"fixed\" text=\"#400000\" link=\"#057A3A\" vlink=\"#400000\" alink=\"#FF6600\""; $fontspec = "FACE=\"Arial\""; $MetaFile = ""; $header_file = ""; $footer_file = "Copyright © 2000 La Planète du Cheval. Tous droits réservés.
Révision : 25 Octobre 2000 .

Département Conception et réalisation 
Mdi Informatique

"; $SSIRootDir = ""; $ExchangeName = "WebScripts Advertisers"; $ExchangeURL = ""; $ExchangeLogo = ""; $ExchangeLogoWidth = 60; $ExchangeLogoHeight = 60; $ExchangeLogoPosition = ""; $ExchangeBannerWidth = 468; $ExchangeBannerHeight = 60; $admin_name = "Administrateur"; $email_address = "webmaster\@cheval-web.com"; $mailprog = '/usr/sbin/sendmail'; $WEB_SERVER = ""; $SMTP_SERVER = ""; # use Socket; # use Net::SMTP; # NOTHING BELOW THIS LINE NEEDS TO BE ALTERED! @months = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec); $version = "2.15"; $cryptword = 0; $time = time; $_ = $adverts_dir; /^(.+)$/; $adverts_dir = $1; print "Content-type: text/html\n\n"; unless ($UseLocking) { &MasterLockOpen; } 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,3}|[0-9]{1,3})$/) { $resolvedip = ""; } if ($resolvedip) { $ENV{'REMOTE_HOST'} = $resolvedip; } } unless ($ENV{'REMOTE_HOST'}) { $ENV{'REMOTE_HOST'} = $ENV{'REMOTE_ADDR'}; } if ($IgnoredIPs) { @ignoredips = split(/ /,$IgnoredIPs); foreach $ignoredip (@ignoredips) { if (($ENV{'REMOTE_HOST'} =~ /$ignoredip/i) || ($ENV{'REMOTE_ADDR'} =~ /$ignoredip/i)) { &Header("Une erreur est survenue !","Access Denied!"); print "

Désolé, "; print "mais vous n'avez pas le droit au fonctions d administrations.\n"; &Footer("Access Denied"); } } } 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; } $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; } } } unless (-s "$adverts_dir/adcount.txt") { open (COUNT, ">$adverts_dir/adcount.txt"); $lines[0] = 1; $lines[1] = "0"; $lines[2] = $time; seek(COUNT, 0, 0); foreach $line (@lines) { print COUNT "$line\n"; } truncate (COUNT, tell(COUNT)); close (COUNT); } if (!(-e "$adverts_dir/adlist.txt")) { &UpdateAdList; } if ($ENV{'QUERY_STRING'} =~ /reginfo/i) { ®info; } elsif ($ENV{'QUERY_STRING'} =~ /admin/i) { &adminintro; } elsif ($INPUT{'getpass'}) { &GetPassword; } elsif ($INPUT{'register'}) { ®ister; } elsif ($INPUT{'edit'}) { &edit; } elsif ($INPUT{'newuserpassword'}) { &NewUserPassword; } elsif ($INPUT{'UserEdit'}) { &UserEdit; } elsif ($INPUT{'uploadbanner'}) { &UploadBanner; } elsif ($INPUT{'groupedit'}) { &groupedit; } elsif ($INPUT{'del'}) { &del; } elsif ($INPUT{'delgroup'}) { &delgroup; } elsif ($INPUT{'newpass'}) { &newpass; } elsif ($INPUT{'resetcount'}) { &resetcount; } elsif ($INPUT{'editfinal'}) { &editfinal; } elsif ($INPUT{'editgroupfinal'}) { &editgroupfinal; } 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 "Acces a tout les Comptes") { &reviewall; } elsif ($INPUT{'reviewone'}) { &reviewone; } elsif ($INPUT{'dailystats'}) { &dailystats; } elsif ($INPUT{'monthlystats'}) { &monthlystats; } elsif ($INPUT{'masteriplog'}) { &masteriplog; } elsif ($INPUT{'iplog'}) { &iplog; } elsif ($INPUT{'adminlog'}) { &adminlog; } elsif ($INPUT{'listemail'}) { &ListEmail; } else { &userintro; } sub userintro { &Header("Campagne de Publicité","Acces a la gestion des Bannieres"); print "

Pour voir les statistiques de votre compte personnel ", "
Veuillez entrer votre nom de compte et votre mot de passe :\n", "

\n", "

Nom de votre compte : ", "\n", "
Votre mot de passe : ", "\n", "

\n", "

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


Pour créer un compte d'echange de bannieres,\n", "
entrez le nom du compte desiré et le mot de passe que vous voulez utiliser:\n", "

\n", "

Nom de votre compte : ", "\n", "
Votre mot de passe: ", "\n", "\n", "

\n", "

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


Si vous avez oublié votre mot de passe,\n", "
entrez le nom de votre compte et votre mot de passe vous sera envoyé\n", "
dans votre boite au lettres E-mail\n", "

\n", "

Nom de votre compte : ", "\n", "

\n", "

\n"; } &Footer; } sub adminintro { open (PASSWORD, "<$adverts_dir/adpassword.txt"); $password = ; close (PASSWORD); chop ($password) if ($password =~ /\n$/); if (!$password) { &InitializePassword; } &Header("Campagne de Publicité","Acces administrateurs "); print "

Pour voir les statistiques de tous les comptes ", "et avoir acces au fonctions d'administrations,\n", "
entrez le mot de passe administrateur :\n", "

\n", "

Password: ", "\n", "\n", "

", "

\n"; &Footer; } sub InitializePassword { &Header("Campagne de Publicité","Entrez un mot de passe administrateur!"); print "

Avant toutes choses, ", "vous avez besoin pour utiliser ce systeme de gestion de bannieres, ", "de choisir un mot de passe pour avoir acces aux fonctions d'administrations.", "Cette espace va vous permettre de consulter les statistiques détaillés", "de chaque annonceurs et de chaque comptes établis", "Merci de bien vouloir inscrire ce mot de passe maintenant", "(Entrez le ci-dessous)\n", "

\n", " ", "

", " ", "\n", "
\n"; &Footer; } sub ConfirmAdminPassword { local($which_admin) = @_; if ($INPUT{'password'}) { $newpassword = crypt($INPUT{'password'}, "aa"); } else { &Header("Une Erreur est survenue","Il n'y a pas de mot de passe !"); print "

You must "; print "Veuillez entrer un mot de passe !\n"; &Footer; } open (PASSWORD, "<$adverts_dir/adpassword.txt"); $password = ; close (PASSWORD); chop ($password) if ($password =~ /\n$/); unless ($password && ($newpassword eq $password)) { if ($AllowUserEdit && $INPUT{'newuser'} && ($which_admin == 2)) { &Header("Une erreur est survenue","Ce nom est deja en utilisation !"); print "

"; print "Le nom du compte que vous avez saisi "; print "est deja en utilisation !\n"; &Footer; } else { &Header("Une erreur est survenue","Mot de passe invalide!"); print "

"; print "Le mot de passe que vous avez saisi est incorrecte!\n"; &Footer; } } $cryptword = 1; } sub ConfirmUserPassword { unless ($INPUT{'password'}) { &Header("Une erreur est survenue","Vous n'avez pas saisi de mot de passe !"); print "

Vous devez saisir un mot de passe !\n"; &Footer; } $INPUT{'advert'} =~ s/[^\w_-]//g; $INPUT{'advert'} =~ tr/A-Z/a-z/; if ($INPUT{'admincheck'}) { &ConfirmAdminPassword(2); } open (DISPLAY, "<$adverts_dir/$INPUT{'advert'}.txt"); @lines = ; close (DISPLAY); foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); } $pass = $lines[8]; unless ($INPUT{'password'} eq $pass) { if ($INPUT{'groupstatus'}) { open (DISPLAY, "<$adverts_dir/$INPUT{'groupstatus'}.grp"); @grpck = ; close (DISPLAY); foreach $grpln (@grpck) { chop ($grpln) if ($grpln =~ /\n$/); } } unless ($grpck[0] && ($INPUT{'password'} eq $grpck[0])) { &ConfirmAdminPassword(2); } } } sub GetPassword { open (DISPLAY, "<$adverts_dir/$INPUT{'getpass'}.txt"); @lines = ; close (DISPLAY); foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); } ($pass,$email) = @lines[8,18]; unless ($email) { &Header("Une erreur est survenue","Il n'y a pas d'adresse E-Mail!"); print "

Ce n'est pas l'adresse e-mail associée "; print "avec le compte suivant :$INPUT{'getpass'}\n"; &Footer; } &SendMail($email,"getpass"); &Header("Campagne de Publicité","Mot de passe envoyé"); print "

Le mot de passe pour le compte $INPUT{'getpass'} "; print "à ete envoyer a $email!\n"; &Footer; } sub defineview { &ConfirmAdminPassword(1); &Header("Campagne de Publicité","WebAdverts Administrative Display"); unless (-e "$adverts_dir/register.txt") { print "

Gestion de Bannieres "; print "Cliquer ici "; print "pour les infos d'enregistrement


\n"; } print "

Selectionnez le compte ", "que vous voulez voir:\n", "

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

Les comptes en attente (attendant "; print "l'aprobation par la planete du cheval), Les comptes établis,\n"; print "
et/ou Les groupes définis ("ensemble" "; print "de comptes ):
\n
"; if (-s "$adverts_dir/adnew.txt") { print "Comptes en attente "; } print "Comptes établis"; if (-s "$adverts_dir/groups.txt") { print " Groupes définis"; } print "\n"; print "
(Si aucune selection n'est faite, "; print "seul les comptes établis et actifs seront affichés.)\n"; print "

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

Comptes actifs, Comptes expirés,\n", "
et/ou Comptes suprimmés (ceux dont les poids ", "ont été temporairement fixé à 0):
\n", "
Comptes actifs ", "Comptes expirés ", "Comptes suprimmés\n", "
(Si aucune selection n'est faite, ", "seul les comptes établis et actifs seront affichés.)\n"; if (%nonssi_cgis) { print "

Comptes affichés dasn la Zone(s):\n
"; foreach $setzone (sort (keys %nonssi_cgis)) { print "$setzone "; } print "\n"; print "
(Si aucune selection n'est faite, "; print "les comptes de toutes les zones seront affichés.)\n"; } print "\n"; print "

"; print "

\n"; &Footer; } sub reviewall { &ConfirmAdminPassword(1); &Header("Gestion de bannieres","Systeme de statistique"); unless (-e "$adverts_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 "Les comptes suivants : "; print "ont été établis:\n"; if ($AdminDisplaySetup) { print "

"; print "(Comptes inclus: "; print "$INPUT{'whichtime'})\n"; if ($INPUT{'whichzone'}) { @whichzones = split(/\s+/,$INPUT{'whichzone'}); print "
(Zones Inclus: "; print "$INPUT{'whichzone'})\n"; } } print "

\n", "", "", "", "", "", "", "", "", "", "", "\n"; open (COUNT, "<$adverts_dir/adcount.txt"); @lines = ; close (COUNT); if (@lines < 2) { print "
Comptes

Debut

Fin

Zone(s)

Poid.

Affichages

Exp./Jours

Cliques

%

Proportions

\n"; print "

[ File Error: "; print "adcount.txt ]\n"; &Footer; } open (LIST, "<$adverts_dir/adlist.txt"); while (defined($list = )) { push (@lines,$list); } close (LIST); foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); } $max = @lines - 1; $exposures = $lines[1]; ($exposures,$other) = split (/\|/, $exposures); $starttime = $lines[2]; @advertisements = @lines[3..$max]; @sortedadverts = sort (@advertisements); foreach $advertiser (@sortedadverts) { $expired = 0; $name = $advertiser; next if (length($advertiser) < 1); open (DISPLAY, "<$adverts_dir/$advertiser.txt"); @lines = ; close (DISPLAY); foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); } ($max,$shown,$visits,$url,$image,$height,$width, $alt,$pass,$text,$start,$weight,$zone, $border,$target,$raw,$displayratio,$username,$email, $displayzone,$clicksfrom) = @lines; unless ($max || $displayratio) { print ""; print ""; print "[ File Error: "; print "$advertiser.txt ]\n"; next; } if ($INPUT{'whichzone'} && (length($zone)>2)) { $zoneok = 0; foreach $whichzones (@whichzones) { if ($zone =~ /$whichzones/) { $zoneok = 1; } } next unless ($zoneok); } ($max,$maxtype) = split (/\|/, $max); unless ($maxtype) { $maxtype = "E"; } ($text,$texttype) = split (/\|/, $text); unless ($texttype) { $texttype = "B"; } ($displayratio,$displaycount) = split (/\|/, $displayratio); if (($maxtype eq "N") && ($displayratio > 0)) { $max = int($displaycount/$displayratio); } if (($maxtype eq "E") && ($displayratio > 0)) { $max = $max+int($displaycount/$displayratio); } if ($max < 1) { $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); $year += 1900; $expirationstatus .= "$mday $months[$mon] $year"; unless ($max > $time) { $expired = 1 ; $expirationstatus .= "
EXPIRE!"; } $expirationstatus .= "
"; } elsif (($maxtype eq "N") && ($max < 1)) { if ($displayratio > 1) { $expirationstatus .= "0 affichages
(non-expiré!)
"; } else { $expirationstatus .= "(non-expiré!)"; } } else { $expirationstatus .= "".&commas($max); if ($maxtype eq "C") { $expirationstatus .= " cliques"; if (($average == 0) || ($shown == 0) || ($visits == 0)) { $expirationstatus .= "
(date inconnue)"; } elsif ($max > $visits) { $daystogo = (($max-$visits)/($average*($visits/$shown))); $calculatedend = $time+($daystogo*86400); ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime($calculatedend); $year += 1900; $expirationstatus .= "
(~ $mday $months[$mon] $year)"; } else { $expired = 1; $expirationstatus .= "
EXPIRE!"; } } else { $expirationstatus .= " affichages"; if ($displayratio > 0) { $expirationstatus .= "
(non-expiré!)"; } elsif ($average == 0) { $expirationstatus .= "
(date inconnue)"; } elsif ($max > $shown) { $daystogo = (($max-$shown)/$average); $calculatedend = $time+($daystogo*86400); ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime($calculatedend); $year += 1900; $expirationstatus .= "
(~ $mday $months[$mon] $year)"; } else { $expired = 1; $expirationstatus .= "
EXPIRE!"; } } $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 = "N/A"; $ratio = "N/A"; } else { $perc = ((100*($visits/$shown))+.05001); $ratio = (($shown/$visits)+.5001); } unless ($perc eq "N/A") { $perc =~ s/(\d+\.\d).*/$1/; $perc = $perc."%"; } unless ($ratio eq "N/A") { $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); $year += 1900; print "$mday $months[$mon] $year"; } else { print ""; } print "$expirationstatus"; print "$zone"; print "$weight"; print "",&commas($shown),""; if ($expired || ($weight < 1)) { print "--"; } elsif ($average > 0) { print "",&commas($average),""; } else { print "N/A"; } print "",&commas($visits),""; print "$perc$ratio\n"; } print "\n"; print "

"; ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime($time); if ($hour < 10) { $hour = "0".$hour; } if ($min < 10) { $min = "0".$min; } $year += 1900; print "(Ces statistiques ont ete mi a jour le "; print "$mday $months[$mon] $year à $hour:$min."; ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime($starttime); if ($hour < 10) { $hour = "0".$hour; } if ($min < 10) { $min = "0".$min; } $year += 1900; print "
Depuis le $mday $months[$mon] $year à $hour:$min, "; print "Il y a eu au Total ",&commas($exposures); print " bannieres d'affichés"; $time = $time - $starttime + 1; if ($time > 86400) { $average = int(($exposures/($time/86400))+.5); print ",
Pour une moyenne de ",&commas($average); print " affichages par jour"; } print ".)\n


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

"; print "Le compte suivant est en attente "; print "de validaton du dossier :"; print "

\n"; @sortednewlines = sort (@newlines); foreach $newad (@sortednewlines) { chop ($newad) if ($newad =~ /\n$/); next if (length($newad) < 1); open (DISPLAY, "<$adverts_dir/$newad.txt"); @lines = ; close (DISPLAY); foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); } ($max,$shown,$visits,$url,$image,$height,$width, $alt,$pass,$text,$start,$weight,$zone, $border,$target,$raw,$displayratio,$username,$email, $displayzone,$clicksfrom) = @lines; print "

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


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

"; print "Le Groupe suivant a bien ete defini:"; print "\n"; print "

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


"; } print "
\n", "

Les options suivantes ", "sont disponibles:\n", "\n", "

Ajouter/Editer/Suprimmer un Compte: ", " ", "\n", "

Ajouter/Editer/Suprimmer un Groupe: ", " ", "\n", "

Changer le mot de passe administrateur: ", " ", " ", "\n"; if ($LogIP) { print "

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

\n"; } print "

\n", "

\n", "

\n"; &LinkBack; &Footer; } sub ListEmail { &ConfirmAdminPassword(1); open (LIST, "<$adverts_dir/adlist.txt"); @advertlist = ; close (LIST); foreach $advertiser (@advertlist) { chop ($advertiser) if ($advertiser =~ /\n$/); open (DISPLAY, "<$adverts_dir/$advertiser.txt"); @lines = ; close (DISPLAY); foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); } unless ($lines[18]) { next; } push (@emails,""$lines[17]" <$lines[18]>"); } @sortedemails = sort (@emails); &Header("Campagne de Publicité","Comptes E-Mails"); print "

"; print "Compte détenteurs d' E-Mail Addresses:"; print "\n"; print "

"; foreach $email (@sortedemails) { if ($email eq $lastemail) { next; } if ($lastemail) { print ", "; } print "$email"; $lastemail = $email; } print "\n"; &LinkBack; &Footer; } sub reviewgroup { $groupstatus = "$INPUT{'reviewone'}"; unless (-s "$adverts_dir/$INPUT{'reviewone'}.grp") { if ($AllowUserEdit && $INPUT{'newuser'}) { &UserEdit; } &Header("Une erreur est survenue !","Nom Invalide !"); print "

Il n'existe pas "; print "de comptes ou de groupes avec ce nom la ! "; print ""$INPUT{'reviewone'}"!\n"; print "

(Tous ces noms "; print "doiventrespecter les Majuscules/Minuscules !)\n"; &Footer; } open (DISPLAY, "<$adverts_dir/$INPUT{'reviewone'}.grp"); @adverts = ; close (DISPLAY); foreach $line (@adverts) { chop ($line) if ($line =~ /\n$/); } unless ($cryptword) { unless ($INPUT{'password'} eq $adverts[0]) { &ConfirmAdminPassword(2); } } &Header("WebAdverts","WebAdverts Administrative Display"); print "

(Accounts in the "; print "$INPUT{'reviewone'} Group)\n"; foreach $advert (@adverts) { $name = $advert; next unless (-s "$adverts_dir/$advert.txt"); open (DISPLAY, "<$adverts_dir/$advert.txt"); @lines = ; close (DISPLAY); foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); } ($max,$shown,$visits,$url,$image,$height,$width, $alt,$pass,$text,$start,$weight,$zone, $border,$target,$raw,$displayratio,$username,$email, $displayzone,$clicksfrom) = @lines; ($max,$maxtype) = split (/\|/, $max); unless ($maxtype) { $maxtype = "E"; } ($text,$texttype) = split (/\|/, $text); unless ($texttype) { $texttype = "B"; } ($displayratio,$displaycount) = split (/\|/, $displayratio); if (($maxtype eq "E") && ($displayratio > 0)) { $max = $max+int($displaycount/$displayratio); } $TotalShown += $shown; $TotalVisits += $visits; print "


\n"; &reviewadvert; } print "


Principales fonctions:", "\n", "

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

Cliques

%

Proportion

",&commas($TotalShown),"",&commas($TotalVisits),"$perc$ratio
\n"; &Footer("Groupe: $INPUT{'reviewone'}"); } sub reviewone { unless ($INPUT{'password'}) { &Header("Une erreur est survenue !","Il n'y a pas de mot de passe !"); print "

Vous devez entrer un mot de passe !\n"; &Footer; } $INPUT{'reviewone'} =~ s/[^\w_-]//g; $INPUT{'reviewone'} =~ tr/A-Z/a-z/; if ($INPUT{'admincheck'}) { &ConfirmAdminPassword(2); } unless (-s "$adverts_dir/$INPUT{'reviewone'}.txt") { &reviewgroup; } $name = $INPUT{'reviewone'}; open (DISPLAY, "<$adverts_dir/$INPUT{'reviewone'}.txt"); @lines = ; close (DISPLAY); foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); } ($max,$shown,$visits,$url,$image,$height,$width, $alt,$pass,$text,$start,$weight,$zone, $border,$target,$raw,$displayratio,$username,$email, $displayzone,$clicksfrom) = @lines; ($max,$maxtype) = split (/\|/, $max); unless ($maxtype) { $maxtype = "E"; } ($text,$texttype) = split (/\|/, $text); unless ($texttype) { $texttype = "B"; } ($displayratio,$displaycount) = split (/\|/, $displayratio); if (($maxtype eq "N") && ($displayratio > 0)) { $max = int($displaycount/$displayratio); } if (($maxtype eq "E") && ($displayratio > 0)) { $max = $max+int($displaycount/$displayratio); } if ($max < 1) { $max = "0"; } unless ($cryptword) { unless ($INPUT{'password'} eq $pass) { &ConfirmAdminPassword(2); } } &Header("WebAdverts","WebAdverts Administrative Display"); &reviewadvert; if ($cryptword) { &LinkBack; } &Footer("Account: $INPUT{'reviewone'}"); } sub reviewadvert { $expired = 0; print "

Statistiques courants "; print "$name Comptes :\n"; open (COUNT, "$adverts_dir/adnew.txt"); @lines = ; close (COUNT); foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); if ($line eq $name) { print "

(Ce compte est en attente d'une confirmation de dossier.)"; last; } } print "

\n"; print "

\n"; print ""; print ""; if ($displayratio) { print ""; print ""; print ""; print "\n"; print ""; if ($start) { ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime($start); $year += 1900; print ""; $runtime = $time - $start + 1; } else { print ""; } if (($displaycount == 0) || ($clicksfrom == 0)) { $foreignperc = "N/A"; $foreignratio = "N/A"; } else { $foreignperc = ((100*($clicksfrom/$displaycount))+.05001); $foreignratio = (($displaycount/$clicksfrom)+.5001); } unless ($foreignperc eq "N/A") { $foreignperc =~ s/(\d+\.\d).*/$1/; $foreignperc = $foreignperc."%"; } unless ($foreignratio eq "N/A") { $foreignratio =~ s/(\d+)\.\d.*/$1/; $foreignratio = $foreignratio.":1"; } print ""; print ""; print ""; print "\n"; print "
Début

Bannières affichées
"; print "sur Votre Site


Cliques sur
"; print "Votre Site


%

Rapport

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

Vos Bannieres
"; print "Affichages


Aff/Jour

Cliques sur
"; print "Votre Bannieres


%

Rapport

$mday $months[$mon] $year$mday $months[$mon] $year"; unless ($max > $time) { $expired = 1; print "
EXPIRE !"; } print "
0 affichages
(non-expiré!)
(non-expiré!)",&commas($max); if ($maxtype eq "C") { print " clicks"; if (($average == 0) || ($shown == 0) || ($visits == 0)) { print "
(date inconnue)"; } elsif ($max > $visits) { $daystogo = (($max-$visits)/($average*($visits/$shown))); $calculatedend = $time+($daystogo*86400); ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime($calculatedend); $year += 1900; print "
(~ $mday $months[$mon] $year)"; } else { $expired = 1; print "
EXPIRE!"; } } else { print " exposures"; if ($displayratio > 0) { print "
(non-expiré!)"; } elsif ($average == 0) { print "
(date inconnue!)"; } elsif ($max > $shown) { $daystogo = (($max-$shown)/$average); $calculatedend = $time+($daystogo*86400); ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$isdst) = localtime($calculatedend); $year += 1900; print "
(~ $mday $months[$mon] $year)"; } else { $expired = 1; print "
EXPIRE!"; } } print "
",&commas($shown),"--",&commas($average),"N/A",&commas($visits),"$perc$ratio

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

Votre compte ne possede actuellement aucunes Bannieres.\n"; } if ($displayratio || $displaycount) { if ($displaycount<1) { $displaycount = "0"; } print "

A cette date, vous avez affichés "; print &commas($displaycount)," bannierres "; print "sur votre site"; if ($displayratio > 0) { $earnings = int($displaycount/$displayratio); print ", earning(benefice de) "; print &commas($earnings)," affichages "; print "pour votre propre banniere sur d'autre sites. "; print "(You earn an exposure for each "; print "$displayratio display"; if ($displayratio > 1) { print "s"; } print ".)"; } else { print "."; } if ($max > $earnings) { print " Votre comptes supplémentaire a été nomé "; print &commas($max-$earnings); print " "bonus" exposures, as well."; } print "\n

Ce code HTML doit etre absolument inseré "; print "ou vou voulez voir apparaitre la banniere.\n"; print "

"; if ($IFRAMEexchange) { $DefaultBorder = 0; } $HTMLCode = ""; if ($ExchangeName) { $HTMLCode = "<!-- Begin $ExchangeName Code -->\n
"; } $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="$DefaultBorder>""; if ($ExchangeURL) { $HTMLCode .= "</a>"; } if ($ExchangeLogoPosition =~ /^t/i) { $HTMLCode .= "<br />"; } } if (%nonssi_cgis) { foreach $setzone (keys %nonssi_cgis) { if ($displayzone eq $setzone) { $nonssi_cgi = $nonssi_cgis{$setzone}; last; } } } if ($IFRAMEexchange) { $HTMLCode .= "<IFRAME SRC="$nonssi_cgi?"; $HTMLCode .= "iframe;member=$name""; $HTMLCode .= " MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0"; $HTMLCode .= " FRAMEBORDER=0 SCROLLING=NO"; if ($ExchangeBannerHeight && $ExchangeBannerWidth) { $HTMLCode .= " WIDTH=$ExchangeBannerWidth"; $HTMLCode .= " HEIGHT=$ExchangeBannerHeight"; } $HTMLCode .= ">"; } if ($JavaScriptExchange) { $HTMLCode .= "<SCRIPT LANGUAGE="JavaScript"><!--\n"; $HTMLCode .= "
random = parseInt(Math.random()*1000)\n"; $HTMLCode .= "
banner = '<A HREF="$nonssi_cgi?member=$name;banner=NonSSI;'\n"; $HTMLCode .= "
banner += 'page=' + random + '" $DefaultLinkAttribute>';\n"; $HTMLCode .= "
banner += '<IMG SRC="$nonssi_cgi?member=$name;'\n"; $HTMLCode .= "
banner += 'page=' + random + '""; if ($ExchangeBannerHeight && $ExchangeBannerWidth) { $HTMLCode .= " WIDTH=$ExchangeBannerWidth"; $HTMLCode .= " HEIGHT=$ExchangeBannerHeight"; } $HTMLCode .= "'\n
banner += ' "; if ($ExchangeName) { $HTMLCode .= "ALT="$ExchangeName" "; } $HTMLCode .= "BORDER=$DefaultBorder></A>'\n"; $HTMLCode .= "
document.write(banner)\n
// --></SCRIPT>"; $HTMLCode .= "<NOSCRIPT>"; } $HTMLCode .= "<A HREF="$nonssi_cgi?"; $HTMLCode .= "member=$name;banner=NonSSI;page=01""; $HTMLCode .= " $DefaultLinkAttribute>"; $HTMLCode .= "<IMG SRC="$nonssi_cgi?"; $HTMLCode .= "member=$name;page=01""; if ($ExchangeBannerHeight && $ExchangeBannerWidth) { $HTMLCode .= " WIDTH=$ExchangeBannerWidth"; $HTMLCode .= " HEIGHT=$ExchangeBannerHeight"; } if ($ExchangeName) { $HTMLCode .= " ALT="$ExchangeName""; } $HTMLCode .= " BORDER=$DefaultBorder></A>"; if ($JavaScriptExchange) { $HTMLCode .= "</NOSCRIPT>"; } if ($IFRAMEexchange) { $HTMLCode .= "</IFRAME>"; } 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=$DefaultBorder>"; 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 "$HTMLCode
\n"; unless ($JavaScriptExchange) { print "

If you want banners to appear on more than one page ", "(or more than once on a single page), ", "simply use a unique "page=" number for each banner ", "call. This will ensure that new banners are loaded (and that new ", "displays are credited to you) on each of your pages. ", "(Note that there are two "page=" designations in the ", "call, and that they must match!)\n"; } } print "

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

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

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

\n"; if ($email && $INPUT{'welcomeletter'}) { open (WELCOME, "<$adverts_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 { open (DISPLAY, "<$adverts_dir/$name.log"); @lines = ; close (DISPLAY); @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 dailystats { &ConfirmUserPassword; open (DISPLAY, "<$adverts_dir/$INPUT{'advert'}.log") || &Error_NoStats; @lines = ; close (DISPLAY); 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); } 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 ($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 = 0; $TotalC = 0; $TotalS = 0; $TotalX = 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}; } } &Header("WebAdverts","WebAdverts Administrative Display"); print "

Statistiques journaliers sur le compte"; print "$INPUT{'advert'}"; if ($ShortenedList) { print "
(Les 5 dernier jours seulement)"; } elsif ($INPUT{'FullDailyList'}) { print "
(Full List)"; } print ":
\n"; print "

\n"; print ""; print ""; $ColCount = 1; if ($bannex) { print ""; print ""; $ColCount += 6; } if ($beingshown) { print ""; print ""; print ""; print "\n"; $ColCount += 10; } $daycounter = (($endday-$startday)+1); foreach $daycount ($startday..$endday) { print ""; if (($daycount > $startday) && ($daycount-(int($daycount/7)*7)==3)) { 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) { $bannerspercent = 0; } else { $bannerspercent=int((($banners/$TotalS)*($daycounter*30))+.5); } $clicksfrom = $accesses{$clicksfrom}; if ($TotalX == 0) { $clicksfrompercent = 0; } else { $clicksfrompercent=int((($clicksfrom/$TotalX)*($daycounter*15))+.5); } $exposures = $accesses{$exposures}; if ($TotalE == 0) { $exposurespercent = 0; } else { $exposurespercent=int((($exposures/$TotalE)*($daycounter*30))+.5); } $clicks = $accesses{$clicks}; if ($TotalC == 0) { $clickspercent = 0; } else { $clickspercent=int((($clicks/$TotalC)*($daycounter*15))+.5); } if ($banners < 1) { $banners = "0"; } if ($clicksfrom < 1) { $clicksfrom = "0"; } if ($exposures < 1) { $exposures = "0"; } if ($clicks < 1) { $clicks = "0"; } if ($bannex) { print ""; if ($bannerspercent==0) { print ""; } else { print ""; } print ""; if ($clicksfrompercent==0) { print ""; } else { print ""; } } if ($beingshown) { print ""; if ($exposurespercent==0) { print ""; } else { print ""; } print ""; if ($clickspercent==0) { print ""; } else { print ""; } if ($exposures == 0) { $perc = "-"; $ratio = "-"; } elsif ($clicks == 0) { $perc = "-"; $ratio = "-"; } else { $perc = ((100*($clicks/$exposures))+.05001); $ratio = (($exposures/$clicks)+.5001); } unless ($perc eq "-") { $perc =~ s/(\d+\.\d).*/$1/; $perc = $perc."%"; } unless ($ratio eq "-") { $ratio =~ s/(\d+)\.\d.*/$1/; $ratio = $ratio.":1"; } print ""; print ""; if ($perc > 0) { $perc = int($perc*15); print ""; } else { print ""; } print "\n"; } } print "
Date

Bannières affichés
"; print "sur votre site


Cliques venant
"; print "de Votre Site


Vos Bannieres
"; print "Affichés


Cliques sur
"; print "Votre Banniere


%

Rapport


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

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

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

\n"; print "\n"; print "\n"; if ($LogIP) { print "\n"; } print "
\n"; print "\n"; if ($cryptword) { print "\n"; } print "\n"; print " "; print "
\n"; print "\n"; if ($groupstatus) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } print ""; print "
\n"; print "\n"; if ($INPUT{'groupstatus'}) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } print ""; print "
\n"; &Footer; } sub monthlystats { &ConfirmUserPassword; open (DISPLAY, "<$adverts_dir/$INPUT{'advert'}.log") || &Error_NoStats; @lines = ; close (DISPLAY); 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("WebAdverts","WebAdverts Administrative Display"); print "

Statistiques du mois pour "; print "$INPUT{'advert'} compte"; print ":\n"; print "

\n"; print ""; print ""; if ($bannex) { print ""; print ""; } if ($beingshown) { print ""; print ""; print ""; print "\n"; } foreach $year ($startyear..$endyear) { if ($year == $startyear) { $firstmon = $startmon; } else { $firstmon = "01"; } if ($year == $endyear) { $lastmon = $endmon; } else { $lastmon = 12; } foreach $month ($firstmon..$lastmon) { $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 ""; $banners = "$month $year S"; $clicksfrom = "$month $year X"; $exposures = "$month $year E"; $clicks = "$month $year C"; $banners = $accesses{$banners}; if ($TotalS == 0) { $bannerspercent = 0; } else { $bannerspercent=int((($banners/$TotalS)*($monthcounter*30))+.5); } $clicksfrom = $accesses{$clicksfrom}; if ($TotalX == 0) { $clicksfrompercent = 0; } else { $clicksfrompercent=int((($clicksfrom/$TotalX)*($monthcounter*15))+.5); } $exposures = $accesses{$exposures}; if ($TotalE == 0) { $exposurespercent = 0; } else { $exposurespercent=int((($exposures/$TotalE)*($monthcounter*30))+.5); } $clicks = $accesses{$clicks}; if ($TotalC == 0) { $clickspercent = 0; } else { $clickspercent=int((($clicks/$TotalC)*($monthcounter*15))+.5); } if ($banners < 1) { $banners = "0"; } if ($clicksfrom < 1) { $clicksfrom = "0"; } if ($exposures < 1) { $exposures = "0"; } if ($clicks < 1) { $clicks = "0"; } if ($bannex) { print ""; if ($bannerspercent==0) { print ""; } else { print ""; } print ""; if ($clicksfrompercent==0) { print ""; } else { print ""; } } if ($beingshown) { print ""; if ($exposurespercent==0) { print ""; } else { print ""; } print ""; if ($clickspercent==0) { print ""; } else { print ""; } if ($exposures == 0) { $perc = "-"; $ratio = "-"; } elsif ($clicks == 0) { $perc = "-"; $ratio = "-"; } else { $perc = ((100*($clicks/$exposures))+.05001); $ratio = (($exposures/$clicks)+.5001); } unless ($perc eq "-") { $perc =~ s/(\d+\.\d).*/$1/; $perc = $perc."%"; } unless ($ratio eq "-") { $ratio =~ s/(\d+)\.\d.*/$1/; $ratio = $ratio.":1"; } print ""; print ""; if ($perc > 0) { $perc = int($perc*15); print ""; } else { print ""; } print "\n"; } } } print "
Mois

Banniéres affichés
"; print "sur votre site


Cliques Venant
"; print "de votre site


Vos affichages de bannieres
"; print "sur le site


Clique sur
"; print "votre Banniere


%

Rapport

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

\n"; print "\n"; print "\n"; if ($LogIP) { 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"; } print ""; print "
\n"; print "\n"; if ($INPUT{'groupstatus'}) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } print ""; print "
\n"; &Footer; } sub iplog { &ConfirmUserPassword; &Header("WebAdverts","WebAdverts Administrative Display"); print "

Adresses IP Chargés pour le compte : ", "$INPUT{'advert'}\n", "

La liste d'adresses suivantes sont ", "les adresses individuelles des personnes qui ", "ont regardé ou cliqué sur la banniere de ce compte ", "depuis hier matin. Chaque ", "ligne montre l'heure, et la lettre (E) correspond a une banniere vue", "et la lettre (C) un clique sur la banniere, et ensuite l'adresse IP ", "de la personne concerné.\n", "

";
	($mday,$mon) = (localtime($time-86400))[3,4];
	if ($mday < 10) { $mday = "0".$mday; }
	$mon++;
	if ($mon < 10) { $mon = "0".$mon; }
	open (DISPLAY, "$adverts_dir/$INPUT{'advert'}.$mon$mday.log");
	&ShowIPs;
	close (DISPLAY);
	($mday,$mon) = (localtime($time))[3,4];
	if ($mday < 10) { $mday = "0".$mday; }
	$mon++;
	if ($mon < 10) { $mon = "0".$mon; }
	open (DISPLAY, "$adverts_dir/$INPUT{'advert'}.$mon$mday.log");
	&ShowIPs;
	close (DISPLAY);
	print "
\n"; print "

Total des affichages enregistrés: ",&commas($ExposureCount),"\n"; print "
Total des cliques enregistrés: ",&commas($ClickCount),"\n"; print "
Total des adresses IP enregistrées: ",&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 "

Moyenne des entrées par adresses IP: ${AverageEntries}\n"; print "

\n"; 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"; } print ""; print "
\n"; print "\n"; if ($groupstatus) { print "\n"; } print "\n"; if ($cryptword) { print "\n"; } print ""; print "
\n"; &Footer; } sub ShowIPs { while () { next if (length($_) < 5); unless ($NoPrintIPs) { print "$mon/$mday $_"; } if (/E ([^\s]*)\n/) { $ExposureCount ++; $ThisIP = $1; } elsif (/C ([^\s]*)\n/) { $ClickCount ++; $ThisIP = $1; } $IPCount{$ThisIP} ++; if ($IPCount{$ThisIP} == 1) { $IPCount ++; } } } sub masteriplog { &ConfirmAdminPassword(1); &Header("WebAdverts","WebAdverts Administrative Display"); print "

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

The following report details the IP addresses ", "which have seen or clicked on banners in the rotation ", "since yesterday morning.\n"; $NoPrintIPs = 1; ($mday1,$mon1) = (localtime($time-86400))[3,4]; if ($mday1 < 10) { $mday1 = "0".$mday1; } $mon1++; ($mday2,$mon2) = (localtime($time))[3,4]; if ($mday2 < 10) { $mday2 = "0".$mday2; } $mon2++; opendir (FILES,$adverts_dir); @files = readdir(FILES); closedir (FILES); foreach $file (@files) { next unless (($file=~/$mon1$mday1.log/) || ($file=~/$mon2$mday2.log/)); open (DISPLAY, "$adverts_dir/$file"); &ShowIPs; close (DISPLAY); } print "

Total des affichages enregistrés: ",&commas($ExposureCount),"\n"; print "
Total des cliques enregistrés: ",&commas($ClickCount),"\n"; print "
Total des addresses IP enregistrés: ",&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 "

Moyenne des adresses IP Enregistrés: ${AverageEntries}\n"; print "

Le Top des 25 Adresses IP enregistrés:\n"; print "

\n";
	foreach $key (sort ByCount keys(%IPCount)) {
		last if ($Counter > 24);
		$ip = $key;
		if ($ip =~ /\d+\.\d+\.\d+\.\d+/) {
			@domainbytes = split(/\./,$ip);
			$packaddr = pack("C4",@domainbytes);
			$resolvedip = (gethostbyaddr($packaddr, 2))[0];
			unless ($resolvedip =~
			  /^[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})$/) {
				$resolvedip = "";
			}
			if ($resolvedip) {
				$ip = "$ip ($resolvedip)";
			}
		}
		printf "%10s%-s\n",&commas($IPCount{$key}),"       $ip";
		$Counter++;
	}
	print "
\n"; &LinkBack; &Footer; } sub ByCount { $IPCount{$b}<=>$IPCount{$a}; } sub ShowAdvert { if ($raw || $image) { print "

\n"; } @image = split (/\|/,$image); if ($raw) { srand(); $rand = int(rand(100))+1; $realraw = $raw; $realraw =~ s//\n/g; $realraw =~ s//$rand/g; $realraw =~ s///g; print "$realraw\n"; } else { foreach $image (@image) { if ($NotFirst) { print "

"; } else { $NotFirst=1; } if ($url) { print ""; } print "\"$alt\"";"; if ($url) { print ""; } print "\n"; } } if ($raw || $image) { print "

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

Destination: "; print "$url\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 adminlog { &ConfirmAdminPassword(1); &Header("WebAdverts","WebAdverts Administrative Display"); print "

", "Admin Accesses Report\n", "

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

\n";
	open (ADMINLOG,"$adverts_dir/adminlog.txt");
	while () { print "$_"; }
	close (ADMINLOG);
	print "
\n"; &LinkBack; &Footer; } sub edit { &ConfirmAdminPassword(1); if ($INPUT{'reviewone'} && !($INPUT{'editad'})) { $INPUT{'editad'} = $INPUT{'reviewone'}; } $INPUT{'editad'} =~ s/[^\w_-]//g; $INPUT{'editad'} =~ tr/A-Z/a-z/; &CheckName($INPUT{'editad'}); if (-s "$adverts_dir/$INPUT{'editad'}.txt") { open (DISPLAY, "<$adverts_dir/$INPUT{'editad'}.txt"); @lines = ; close (DISPLAY); foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); $line =~ s/&/&/g; $line =~ s/>/>/g; $line =~ s/\n"; print "

Information de ", "$INPUT{'editad'} Compte:", "\n", "

\n", "\n", "\n", "\n", "\n"; if ($start > $time) { $startday = int((($start-$time)/86400)+.5); } print "\n"; if ($maxtype eq "D") { $max = int((($max-$time)/86400)+.5); if ($max < 0) { $max = 0; } } print "\n", "\n", "\n", "\n", "\n"; if (%nonssi_cgis) { print "\n"; print "\n"; } else { print "\n"; } print "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "

", "I. General Information: ", "The following information is needed for each account, ", "no matter how you're setting things up. 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 how many banner displays ", "earn one exposure. If you're running straight adverts, ", "leave it set to 0, and simply set the appropriate ", "expiration criteria instead. (If you're running ", "an exchange, but want a member to get extra ", ""bonus" exposures, set that bonus number ", "in the "expiration" slot.)
Nom:
E-Mail:
Commencement:", "
(Nonbre de jours ", "dans lequel le compte ", "va commencer, ou laisser le champ vide", "pour commencer immediatement.)", "
Expiration:"; print ""; print "
Pas d'expiration Affichages Clicks Jours\n"; print "
(Entrer le nombre maximal d'affichages, ", " de cliques ou de jours pendant lesquels le compte sera actif.)", "
Proportion d'affichage:", "
Site URL:
URL(s) de la/les Bannieres:", "
Quantité (Wt.):", "
(0 = jamais; 1 = toujours; ", "autres nombres = moins souvent)", "
Zone(s):"; foreach $setzone (sort (keys %nonssi_cgis)) { print "$setzone\n
"; } print "(Selectioner une catégorie de pages "; print "ou cette banniere doit apparaitre.)"; print "
"; print "
(Si ce compte est un echange de bannieres, "; print "selectionner une catégorie ou la banniere apparaitra sur "; print "sa ou ses pages.)"; print "
Zone(s):
Mot de passe:

", "II. SSI Account Information: ", "The following information is used to define or modify ", "the "appearance" of an account banner when ", "called via an SSI tag. None of it is necessary ", "(or even useful) if the banner is called only via IMG ", "tags.
Attributions du lien:
Longeur de la banniere: pixels
Auteur de la banniere: pixels
Bordure:
Texte au survol de la souris:
Texte du lien:", "
Au dessus de la banniere En dessous de la banniere

", "III. "Raw Mode" Informations: ", "Si vous le pouvez vous pouvez spécifier exactement dans la balise ", "ce qui doit apparaitre sur vos pages. (Mais ", "bien sure, ce n'est possible qu'en mode SSI; ", ""raw mode" et un affichage non-SSI sont ", "incompatibles.) N'utilitisez cette option que Seulement si", "vous etes sure de pouvoir le faire; anything input here will ", "override just about everything above!
"Raw" HTML:", "

\n", "

\n", "\n", "\n", "Cocher cette case si vous voulez remettre a Zero vos Affichages & Cliques: ", ""; if (-s "$adverts_dir/welcome.txt") { print "
Cliquer ici pour envoyer une lettre de bienvenue: ", ""; } if ($cryptword) { print "\n"; } print "

\n"; if (-s "$adverts_dir/$INPUT{'editad'}.txt") { if ((-s "$adverts_dir/reject.txt") && $email) { print "

Cliquer ici pour envoyer une lettre de non-acceptation du dossier: ", ""; } print "

"; print "\n"; } print "

\n"; &Footer; } sub UserEdit { $INPUT{'reviewone'} =~ s/[^\w_-]//g; $INPUT{'reviewone'} =~ tr/A-Z/a-z/; &CheckName($INPUT{'reviewone'}); if (-s "$adverts_dir/$INPUT{'reviewone'}.txt") { open (DISPLAY, "<$adverts_dir/$INPUT{'reviewone'}.txt"); @lines = ; close (DISPLAY); foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); $line =~ s/&/&/g; $line =~ s/>/>/g; $line =~ s/\n", "

Informations pour ", "$INPUT{'reviewone'} Compte:", "\n", "

\n", "\n", "\n", "\n", "\n", "\n"; if (%nonssi_cgis) { print "\n"; print "\n"; } print "\n", "

Nom:
E-Mail:
URL du site:
URL(s) de la/les bannieres:", ""; if ($UserUploadDir && !(-s "$adverts_dir/$INPUT{'reviewone'}.txt")) { print "
(You may leave this blank; once your account has been created, "; print "you'll have the option of uploading a banner from your computer. "; print "Just return to the edit screen to do so.)"; } print "
Zone(s):"; foreach $setzone (sort (keys %nonssi_cgis)) { print "$setzone\n
"; } print "(Selectionner une catégorie de pages "; print " ou cette banniere doit apparaitre.)"; print "
"; print "
(Selectionner une catégorie de Bannieres "; print "qui doivent etre affichés sur votre propre page.)"; print "

\n", "

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

\n"; if (-s "$adverts_dir/$INPUT{'reviewone'}.txt") { print "

"; print "\n"; } print "

\n"; print "


Si vous voulez changer votre mot de passe, "; print "entrer le ici.\n"; print "

\n", "

Nouveau Mot de passe: \n", "

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

\n"; if ($UserUploadDir && (-s "$adverts_dir/$INPUT{'reviewone'}.txt")) { print "


If you'd like to upload a new banner for your account, "; print "you may do so from here. (Note that you must be using either "; print "Netscape Navigator version 2 or higher, or Microsoft Internet Explorer "; print "version 4 or higher.)\n"; print "

\n", "

Fichier a Uploader: ", "

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

\n"; } &Footer; } sub NewUserPassword { $INPUT{'reviewone'} =~ s/[^\w_-]//g; $INPUT{'reviewone'} =~ tr/A-Z/a-z/; if (-s "$adverts_dir/$INPUT{'reviewone'}.txt") { open (DISPLAY, "<$adverts_dir/$INPUT{'reviewone'}.txt"); @lines = ; close (DISPLAY); foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); } ($pass) = @lines[8]; unless ($INPUT{'password'} eq $pass) { &ConfirmAdminPassword(2); } } else { &Header("Une erreur est survenue!","Nom de Compte Invalide!"); print "

Il n'y a pas de compte avec ce nom la "; print ""$INPUT{'reviewone'}" "; print "sur cette liste!\n"; print "

(Les noms de comptes doivent "; print "respecterles lettres Minuscules/Majuscules !)\n"; &Footer; } @lines[8] = $INPUT{'pass'}; $INPUT{'password'} = $INPUT{'pass'}; &LockOpen (DISPLAY, "$INPUT{'reviewone'}.txt"); seek (DISPLAY,0,0); foreach $key (0..20) { print DISPLAY "$lines[$key]\n"; } truncate (DISPLAY,tell(DISPLAY)); &LockClose (DISPLAY, "$INPUT{'reviewone'}.txt"); &reviewone; } sub UploadBanner { $INPUT{'reviewone'} =~ s/[^\w_-]//g; $INPUT{'reviewone'} =~ tr/A-Z/a-z/; if (-s "$adverts_dir/$INPUT{'reviewone'}.txt") { open (DISPLAY, "<$adverts_dir/$INPUT{'reviewone'}.txt"); @lines = ; close (DISPLAY); foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); } ($image,$pass) = @lines[4,8]; unless ($INPUT{'password'} eq $pass) { &ConfirmAdminPassword(2); } } else { &Header("Une erreur est survenue!","Nom de Compte Invalide!"); print "

Il n'y a pas de compte avec ce nom la "; print ""$INPUT{'reviewone'}" "; print "sur cette liste!\n"; print "

(Les noms de comptes doivent "; print "respecterles lettres Minuscules/Majuscules!)\n"; &Footer; } if ($BannerType eq "GIF") { $bannername = "$INPUT{'reviewone'}.gif"; } elsif ($BannerType eq "JPG") { $bannername = "$INPUT{'reviewone'}.jpg"; } else { &Header("Une erreur est survenue!","Format de Banniere Invalide!"); print "

Votre banniere doit etre enGIF (.gif) "; print "ou JPEG (.jpg or .jpeg) format!\n"; &Footer; } if (length($INPUT{'BannerFile'}) > ($MaxBannerSize*1024)) { &Header("Une erreur est survenue!","Banniere trop grosse!"); print "

Votre Banniere est trop grosse! Elle doit etre "; print "Obligatoirement inferieur a $MaxBannerSize "; print "kilobytes.
(Le fichier que vous essayez d'enregistrer est de "; print int((length($INPUT{'BannerFile'})/1024)+.5)," kilobytes.)\n"; &Footer; } unless (open (BANNER,">$UserUploadDir/$bannername")) { &Header("Une erreur est survenue!","Impossible d'ouvrir le fichier!"); print "

Le script ne peut pas ouvrir le fichier afin"; print "d'enregistrer votre banniere.
(This most likely indicates "; print "a permissions error on the upload directory.)\n"; &Footer; } binmode BANNER; print BANNER $INPUT{'BannerFile'}; close (BANNER); $image = "$UserUploadURL/$bannername"; &LockOpen (DISPLAY, "$INPUT{'reviewone'}.txt"); seek (DISPLAY,0,0); $lines[4] = $image; foreach $key (0..20) { print DISPLAY "$lines[$key]\n"; } truncate (DISPLAY,tell(DISPLAY)); &LockClose (DISPLAY, "$INPUT{'reviewone'}.txt"); $PresenceCheck = 0; unless ($cryptword || !($RequireAdminApproval)) { &LockOpen (COUNT, "adlist.txt"); @lines = ; foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); } seek(COUNT, 0, 0); foreach $line (@lines) { if ($line eq $INPUT{'reviewone'}) { $PresenceCheck = 1; } unless (($line eq $INPUT{'reviewone'}) || (length($line) < 1)) { print COUNT "$line\n"; } } truncate (COUNT, tell(COUNT)); &LockClose (COUNT, "adlist.txt"); } if ($PresenceCheck) { $PresenceCheck = 0; &LockOpen (COUNT, "adnew.txt"); @lines = ; foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); } seek(COUNT, 0, 0); foreach $line (@lines) { if ($line eq $INPUT{'reviewone'}) { $PresenceCheck = 1; } unless (($line eq $INPUT{'reviewone'}) || (length($line) < 1)) { print COUNT "$line\n"; } } unless ($PresenceCheck) { print COUNT "$INPUT{'reviewone'}\n"; $editad = $INPUT{'reviewone'}; &SendMail($email_address,"admin"); } truncate (COUNT, tell(COUNT)); &LockClose (COUNT, "adnew.txt"); } &reviewone; } sub CheckName { local($namecheck) = @_; if (($namecheck eq "adcount") || ($namecheck eq "adlist") || ($namecheck eq "adnew") || ($namecheck eq "adpassword") || ($namecheck eq "groups") || ($namecheck eq "register") || ($namecheck eq "welcome") || ($namecheck eq "reject") || ($namecheck eq "adminlog") || ($namecheck =~ /ads_/)) { &Header("Une erreur est survenue!","Nom de Compte Illegal!"); print "

Le nom de compte que vous avez selectionné n'est pas possible. "; print "Merci d'en selectionner un autre !\n"; &Footer; } } sub groupedit { &ConfirmAdminPassword(1); $INPUT{'editgroup'} =~ s/[^\w_-]//g; $INPUT{'editgroup'} =~ tr/A-Z/a-z/; &CheckName($INPUT{'editgroup'}); if (-s "$adverts_dir/$INPUT{'editgroup'}.grp") { open (DISPLAY, "<$adverts_dir/$INPUT{'editgroup'}.grp"); @lines = ; close (DISPLAY); $grouppassword = $lines[0]; $adverts = join(' ',@lines); } &Header("WebAdverts","Ajouter/Editer/Supprimer un Groupe"); print "

\n"; print "

Informations pour"; print "$INPUT{'editgroup'} Groupe:"; print "\n"; print "

Selectionner les annonceurs qui doivent etre dans ce groupe:\n"; open (COUNT, "<$adverts_dir/adlist.txt"); @lines = ; close (COUNT); foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); } @sortedlines = sort (@lines); $size = @lines; if ($size > 10) { $size = 10; } print "

\n"; print "

Password: \n"; print "

\n"; print "\n"; print "\n"; if (-s "$adverts_dir/$INPUT{'editgroup'}.grp") { print "

"; print "\n"; } print "

\n"; &Footer; } sub del { $INPUT{'delad'} =~ s/[^\w_-]//g; $INPUT{'delad'} =~ tr/A-Z/a-z/; &CheckName($INPUT{'delad'}); unless (-s "$adverts_dir/$INPUT{'delad'}.txt") { &Header("Une erreur est survenue!","Nom de Compte Invalide!"); print "

Il n'y a pas de Compte avec ce nom "; print ""$INPUT{'delad'}" "; print "sur la liste!\n"; print "

(les noms de Comptes doivent"; print "respecter les lettres Majuscules/Minuscules!)\n"; &Footer; } $INPUT{'advert'} = $INPUT{'delad'}; &ConfirmUserPassword; &Header("WebAdverts",""Delete" Formulaire de Confirmation"); print "

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

Etes voussure Voulez vou effacer "; print "$INPUT{'delad'} Compte ?\n"; print "\n"; if ($INPUT{'rejectionletter'}) { print "\n"; } if ($cryptword) { print "\n"; } print "\n"; print "
\n"; &Footer; } sub delgroup { $INPUT{'delgroupname'} =~ s/[^\w_-]//g; $INPUT{'delgroupname'} =~ tr/A-Z/a-z/; &CheckName($INPUT{'delgroupname'}); unless (-s "$adverts_dir/$INPUT{'delgroupname'}.grp") { &Header("WebAdverts Error!","Invalid Group Name!"); print "

There is no group "; print "on the list defined with the name "; print ""$INPUT{'delgroupname'}"!\n"; print "

(Note that group names "; print "are case sensitive!)\n"; &Footer; } &ConfirmAdminPassword(1); &Header("WebAdverts",""Delete" Request Confirmation"); print "

\n"; print "

Are you sure you want to delete the "; print "$INPUT{'delgroupname'} 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("WebAdverts Error!","Password Mismatch!"); print "

Your administrative password was "; print "not set, as the two entries were different!\n"; &Footer; } open (PASSWORD, "<$adverts_dir/adpassword.txt"); $password = ; close (PASSWORD); chop ($password) if ($password =~ /\n$/); if ($password) { if ($INPUT{'password'}) { $newpassword = crypt($INPUT{'password'}, "aa"); } else { &Header("WebAdverts Error!","No Password!"); print "

You must "; print "enter a password!\n"; &Footer; } unless ($newpassword eq $password) { &Header("WebAdverts Error!","Invalid Password!"); print "

"; print "The password you entered is incorrect!\n"; &Footer; } } $newpassword = crypt($INPUT{'passad'}, "aa"); &LockOpen (PASSWORD, "adpassword.txt"); seek (PASSWORD,0,0); print PASSWORD "$newpassword"; truncate (PASSWORD,tell(PASSWORD)); &LockClose (PASSWORD,"adpassword.txt"); &Header("WebAdverts","Password Set"); print "

Your administrative password "; print "has been set.\n"; $INPUT{'password'} = $INPUT{'passad'}; &LinkBack; &Footer; } sub resetcount { &ConfirmAdminPassword(1); &LockOpen (COUNT, "adcount.txt"); seek(COUNT, 0, 0); print COUNT "1\n"; print COUNT "0\n"; print COUNT "$time\n"; truncate (COUNT, tell(COUNT)); &LockClose (COUNT, "adcount.txt"); if ($AdminDisplaySetup) { &defineview; } else { $INPUT{'whichtype'} = "pending established groups"; $INPUT{'whichtime'} = "active expired disabled"; $INPUT{'whichzone'} = ""; &reviewall; } } sub editfinal { $INPUT{'editad'} =~ s/[^\w_-]//g; $INPUT{'editad'} =~ tr/A-Z/a-z/; $INPUT{'advert'} = $INPUT{'editad'}; $editad = $INPUT{'editad'}; &CheckName($INPUT{'advert'}); unless (!(-s "$adverts_dir/$editad.txt") && $AllowUserEdit && $INPUT{'newuser'}) { &ConfirmUserPassword; } if (-s "$adverts_dir/$editad.txt") { open (DISPLAY, "<$adverts_dir/$editad.txt"); @lines = ; close (DISPLAY); foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); } if ($cryptword) { ($shown,$visits,$start,$displaycount,$clicksfrom) = @lines[1,2,10,16,20]; ($other,$displaycount) = split (/\|/, $displaycount); } else { ($max,$shown,$visits,$dmy,$dmy,$height,$width, $alt,$dmy,$text,$start,$weight,$zone, $border,$target,$raw,$displayratio, $dmy,$dmy,$displayzone,$clicksfrom) = @lines; ($max,$maxtype) = split (/\|/, $max); ($text,$texttype) = split (/\|/, $text); ($displayratio,$displaycount) = split (/\|/, $displayratio); } } elsif (!($cryptword)) { $maxtype = "E"; $texttype = "B"; $displayratio = $DefaultDisplayRatio; $weight = $DefaultWeight; $border = $DefaultBorder; } $INPUT{'email'} =~ s/\s//g; unless ($INPUT{'email'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|,|;/ || $INPUT{'email'} !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) { $email = "$INPUT{'email'}"; } $INPUT{'url'} =~ s/\s//g; unless ($INPUT{'url'} =~ /\*|(\.\.)|(^\.)|(\/\/\.)/ || $INPUT{'url'} !~ /(.*\:\/\/.*\..*|mailto:.*@.*)/) { $url = $INPUT{'url'}; } @image = split (/\cM|\n/,$INPUT{'image'}); foreach $fauximage (@image) { $fauximage =~ s/\s//g; unless ($fauximage =~ /\*|(\.\.)|(^\.)|(\/\/\.)/ || $fauximage !~ /.*\:\/\/.*\..*/) { $image = $image.$fauximage."|"; } } chop $image; $pass = $INPUT{'pass'}; if ($cryptword) { $displayratio = $INPUT{'displayratio'}; $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'}; } if ($cryptword) { if ($INPUT{'purchtype'} eq "D") { $INPUT{'purch'} = $time + ($INPUT{'purch'}*86400); } $INPUT{'purch'} =~ s/[^\d]//g; $max = $INPUT{'purch'}; $maxtype = $INPUT{'purchtype'}; if ($INPUT{'startday'}) { $INPUT{'startday'} = $time + ($INPUT{'startday'}*86400); $start = $INPUT{'startday'} } elsif ($start > $time) { $start = $time; } $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("WebAdverts Error!","Incomplete Entry!"); print "

You didn't provide all of the necessary "; print "information! You must at least "; print "include a password!\n"; &Footer; } if ((($maxtype eq "C") || ($maxtype eq "D")) && ($displayratio)) { &Header("WebAdverts Error!","Invalid Entry!"); print "

You've indicated that this account is to earn exposures by "; print "showing other banners, but have also indicated that it is to "; print "expire based on date or click-thrus. These two designations are "; print "mutually incompatible! Display ratios may only be set for "; print "accounts which are defined as non-expiring, or for which a set "; print "number of "bonus" exposures have been defined.\n"; &Footer; } $PresenceCheck = 0; if (-s "$adverts_dir/adnew.txt") { &LockOpen (COUNT, "adnew.txt"); @lines = ; foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); } seek(COUNT, 0, 0); foreach $line (@lines) { if ($line eq $editad) { $PresenceCheck = 1; } unless (($line eq $editad) || (length($line) < 1)) { print COUNT "$line\n"; } } truncate (COUNT, tell(COUNT)); &LockClose (COUNT, "adnew.txt"); } if (-s "$adverts_dir/adlist.txt") { &LockOpen (COUNT, "adlist.txt"); @lines = ; foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); } seek(COUNT, 0, 0); foreach $line (@lines) { if ($line eq $editad) { $PresenceCheck = 1; } unless (($line eq $editad) || (length($line) < 1)) { print COUNT "$line\n"; } } truncate (COUNT, tell(COUNT)); &LockClose (COUNT, "adlist.txt"); } if ($INPUT{'resetadvert'} || (!$PresenceCheck && !$shown)) { $shown = 0; $visits = 0; unless ($start > $time) { $start = $time; } $displaycount = 0; $clicksfrom = 0; $_ = $editad; /^(.+)$/; $editad = $1; unlink ("$adverts_dir/$editad.log"); unlink ("$adverts_dir/$editad.log.bak"); unlink ("$adverts_dir/$editad.ips"); } if ($maxtype eq "N") { $max = 0; } &LockOpen (DISPLAY, "$editad.txt"); 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"; print DISPLAY "$pass\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"; print DISPLAY "$INPUT{'username'}\n"; print DISPLAY "$email\n"; print DISPLAY "$displayzone\n"; print DISPLAY "$clicksfrom\n"; truncate (DISPLAY,tell(DISPLAY)); &LockClose (DISPLAY, "editad.txt"); if ($cryptword || !($RequireAdminApproval)) { &LockOpen (COUNT, "adlist.txt"); @adlist = ; seek (COUNT,0,0); foreach $adlist (@adlist) { print COUNT "$adlist"; } print COUNT "$editad\n"; truncate (COUNT,tell(COUNT)); &LockClose (COUNT, "adlist.txt"); } else { &LockOpen (COUNT, "adnew.txt"); @adnew = ; seek (COUNT,0,0); foreach $adnew (@adnew) { print COUNT "$adnew"; } print COUNT "$editad\n"; truncate (COUNT,tell(COUNT)); &LockClose (COUNT, "adnew.txt"); &SendMail($email_address,"admin"); } $INPUT{'reviewone'} = $editad; &reviewone; } sub editgroupfinal { &ConfirmAdminPassword(1); $INPUT{'editgroup'} =~ s/[^\w_-]//g; $INPUT{'editgroup'} =~ tr/A-Z/a-z/; &CheckName($INPUT{'editgroup'}); $editgroup = $INPUT{'editgroup'}; $pass = $INPUT{'pass'}; @groupadverts = split(' ',$INPUT{'groupadverts'}); unless ($pass && (@groupadverts > 0)) { &Header("WebAdverts Error!","Incomplete Form!"); print "

You didn't provide all of the necessary "; print "information to allow creation "; print "of the $editgroup "; print "group!\n"; &Footer; } &LockOpen (GROUP, "$editgroup.grp"); seek (GROUP,0,0); print GROUP "$pass\n"; foreach $advert (@groupadverts) { print GROUP "$advert\n"; } truncate (GROUP,tell(GROUP)); &LockClose (GROUP,"$editgroup.grp"); $PresenceCheck = 0; if (-s "$adverts_dir/groups.txt") { open (COUNT, "<$adverts_dir/groups.txt"); @lines = ; close (COUNT); } foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); if ($line eq $editgroup) { $PresenceCheck = 1; } } unless ($PresenceCheck) { &LockOpen (COUNT, "groups.txt"); @groups = ; seek (COUNT,0,0); foreach $group (@groups) { print COUNT "$group"; } print COUNT "$editgroup\n"; truncate (COUNT,tell(COUNT)); &LockClose (COUNT,"groups.txt"); } &Header("WebAdverts","Group Updated!"); print "

"; print "The $editgroup group now includes "; print "the following adverts:\n"; print "

"; foreach $advert (@groupadverts) { chop $advert if ($advert =~ /\n$/); print "$advert "; } print "\n"; &LinkBack; &Footer; } sub delfinal { $INPUT{'delad'} =~ s/[^\w_-]//g; $INPUT{'delad'} =~ tr/A-Z/a-z/; $INPUT{'advert'} = $INPUT{'delad'}; &CheckName($INPUT{'advert'}); &ConfirmUserPassword; $delad = $INPUT{'delad'}; $_ = $delad; /^(.+)$/; $delad = $1; unlink ("$adverts_dir/$delad.txt"); unlink ("$adverts_dir/$delad.txt.bak"); unlink ("$adverts_dir/$delad.log"); unlink ("$adverts_dir/$delad.log.bak"); unlink ("$adverts_dir/$delad.ips"); if ($UserUploadDir) { $_ = $UserUploadDir; /^(.+)$/; $UserUploadDir = $1; unlink ("$UserUploadDir/$delad.gif"); unlink ("$UserUploadDir/$delad.jpg"); } if (-s "$adverts_dir/adlist.txt") { &LockOpen (COUNT, "adlist.txt"); @lines = ; foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); } seek (COUNT,0,0); foreach $line (@lines) { unless (($line eq $delad) || (length($line) < 1)) { print COUNT "$line\n"; } } truncate (COUNT, tell(COUNT)); &LockClose (COUNT,"adlist.txt"); } if (-s "$adverts_dir/adnew.txt") { &LockOpen (COUNT, "adnew.txt"); @lines = ; foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); } seek (COUNT,0,0); foreach $line (@lines) { unless (($line eq $delad) || (length($line) < 1)) { print COUNT "$line\n"; } } truncate (COUNT, tell(COUNT)); &LockClose (COUNT,"adnew.txt"); } if ($INPUT{'rejectionletter'}) { open (REJECT, "<$adverts_dir/reject.txt"); $body = ""; while (defined($line = )) { $body .= $line; } close (REJECT); &SendMail($INPUT{'rejectionletter'},"reject"); } if ($cryptword) { if ($AdminDisplaySetup) { &defineview; } else { $INPUT{'whichtype'} = "pending established groups"; $INPUT{'whichtime'} = "active expired disabled"; $INPUT{'whichzone'} = ""; &reviewall; } } &userintro; } sub delgroupfinal { &ConfirmAdminPassword(1); $INPUT{'delgroupname'} =~ s/[^\w_-]//g; $INPUT{'delgroupname'} =~ tr/A-Z/a-z/; &CheckName($INPUT{'delgroupname'}); $delgroup = $INPUT{'delgroupname'}; $_ = $delgroup; /^(.+)$/; $delgroup = $1; unlink ("$adverts_dir/$delgroup.grp"); if (-s "$adverts_dir/groups.txt") { &LockOpen (COUNT, "groups.txt"); @lines = ; foreach $line (@lines) { chop ($line) if ($line =~ /\n$/); } seek (COUNT,0,0); foreach $line (@lines) { unless (($line eq $delgroup) || (length($line) < 1)) { print COUNT "$line\n"; } } truncate (COUNT, tell(COUNT)); &LockClose (COUNT,"groups.txt"); } if ($AdminDisplaySetup) { &defineview; } else { $INPUT{'whichtype'} = "pending established groups"; $INPUT{'whichtime'} = "active expired disabled"; $INPUT{'whichzone'} = ""; &reviewall; } } sub LinkBack { print "

\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "
\n"; } sub Header { local($title,$header) = @_; if ($ExchangeName) { $title =~ s/WebAdverts/$ExchangeName/g; $header =~ s/WebAdverts/$ExchangeName/g; } print "$title\n"; if ($MetaFile) { open (HEADLN,"$MetaFile"); @headln = ; close (HEADLN); foreach $line (@headln) { print "$line"; } } print "\n"; if ($header_file) { open (HEADER,"<$header_file"); @header =
; close (HEADER); foreach $line (@header) { if ($line =~ //i) { $SSIFile = $SSIRootDir.$2; open (SSIFILE,"<$SSIFile"); while () { print "$_"; } close (SSIFILE); } else { print "$line"; } } } print "


$header


\n"; } sub Footer { local($adminlog) = @_; if ($LogAdminAccesses && (length($adminlog)>7)) { ($min,$hour,$mday,$mon,$year) = (localtime($time))[1,2,3,4,5]; $mon++; if ($mon<10) { $mon = "0".$mon; } if ($mday<10) { $mday = "0".$mday; } if ($year>99) { $year = $year-100; } if ($year<10) { $year = "0".$year; } if ($hour<10) { $hour = "0".$hour; } if ($min<10) { $min = "0".$min; } if (length($adminlog)>25) { $adminlog = substr($adminlog,0,25); } open (ADMINLOG,">>$adverts_dir/adminlog.txt"); print ADMINLOG "$mon/$mday/$year $hour:$min "; printf ADMINLOG "%-25s",$adminlog; print ADMINLOG " $ENV{'REMOTE_ADDR'}"; if ($ENV{'REMOTE_HOST'} ne $ENV{'REMOTE_ADDR'}) { print ADMINLOG " ($ENV{'REMOTE_HOST'})"; } print ADMINLOG "\n"; close (ADMINLOG); } print "

Maintained "; unless ($admin_name) { $admin_name = $email_address; } if ($admin_name) { print "by "; if ($email_address) { print ""; } print "$admin_name"; if ($email_address) { print ""; } print " "; } print "with "; print ""; print "WebAdverts $version.\n"; if ($footer_file) { print "


\n"; open (FOOTER,"<$footer_file"); @footer =