#!/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
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",
"
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",
"
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",
"
Pour voir les statistiques de tous les comptes ",
"et avoir acces au fonctions d'administrations,\n",
"
entrez le mot de passe administrateur :\n",
"
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"; &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 = ";
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 = 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 Selectionnez le compte ",
"que vous voulez voir:\n",
" ";
print "Unregistered copy. ";
print "Click here ";
print "for registration info. ";
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 " [ File Error: ";
print "adcount.txt ]\n";
&Footer;
}
open (LIST, "<$adverts_dir/adlist.txt");
while (defined($list = ";
($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 " ";
print "Le compte suivant est en attente ";
print "de validaton du dossier :";
print " ";
print "Le Groupe suivant a bien ete defini:";
print "\n";
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 = (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 = Principales fonctions:",
"\n",
" 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 = Statistiques courants ";
print "$name Comptes :\n";
open (COUNT, "$adverts_dir/adnew.txt");
@lines = (Ce compte est en attente d'une confirmation de dossier.)";
last;
}
}
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 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 " Statistiques journaliers sur le compte";
print "$INPUT{'advert'}";
if ($ShortenedList) {
print " Statistiques du mois pour ";
print "$INPUT{'advert'} compte";
print ":\n";
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",
" Total des affichages enregistrés: ",&commas($ExposureCount),"\n";
print " Moyenne des entrées par adresses IP: ${AverageEntries}\n";
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 " Moyenne des adresses IP Enregistrés: ${AverageEntries}\n";
print " Le Top des 25 Adresses IP enregistrés:\n";
print " "; }
else { $NotFirst=1; }
if ($url) {
print "";
}
print " Destination: ";
print "$url\n";
}
if ($username || $email) {
if ($url) { 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 " Si vous voulez changer votre mot de passe, ";
print "entrer le ici.\n";
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 " 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 = 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 script ne peut pas ouvrir le fichier afin";
print "d'enregistrer votre banniere. 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 = 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 " 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 " (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 = 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 = 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 = 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 = ";
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 = 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 " Sorry, but the registration code ";
print "you entered is incorrect!\n";
&Footer;
}
open (REGISTER, ">$adverts_dir/register.txt");
print REGISTER "frtytw";
close (REGISTER);
&Header("WebAdverts","Thanks For Registering!");
print " Your support is appreciated!\n";
&Footer;
}
sub reginfo {
&Header("WebAdverts","Registration Information");
print " WebAdverts is distributed as shareware. While you ",
"are free to modify and use it as you see fit, any usage ",
"should be registered. The registration fee is just \$50 ",
"(US). Payment should be sent via check or money order ",
"to Darryl C. Burgdorf, Affordable Web Space ",
"Design, 3524 Pacific Street, Omaha NE 68105.\n",
" (If you happen to live in a country other than the ",
"United States, you can write a check in your local ",
"currency for the equivalent of \$57.50. That will cover ",
"the \$50 registration fee and the \$7.50 ",
"service fee which my bank charges. Please do ",
"not write me a check ",
"in US funds drawn on a non-US bank; the service charge ",
"for those can be anywhere from \$10 to \$25!)\n",
" Thank you for your support!\n",
" The server encountered an error while trying ";
print "to send out e-mail. This most likely means that ";
print "the e-mail program has been incorrectly defined ";
print "in the program's configuration.\n";
&Footer;
}
sub Error_File {
&Header("WebAdverts Error!","File Permission Error!");
print " The server encountered an error while trying ";
print "to access $_[0]!\n";
print " The most likely cause of the problem is a permissions ";
print "error in your adverts directory ($adverts_dir). Make ";
print "sure that the directory exists and that it is set ";
print "world-writable.\n";
&Footer;
}
sub Error_NoStats {
&Header("WebAdverts Error!","No Daily Stats!");
print " ";
print "Sorry, but it seems ";
print "there is no daily log file available ";
print "for the $INPUT{'advert'} account!\n";
&Footer;
}
sub UpdateAdList {
&LockOpen (COUNT, "adcount.txt");
@lines =
\n";
}
print "
\n";
}
unless ($INPUT{'whichtype'}) { $INPUT{'whichtype'} = "established"; }
unless ($INPUT{'whichtime'}) { $INPUT{'whichtime'} = "active"; }
if ($INPUT{'whichtype'} =~ /established/) {
print "
(Zones Inclus: ";
print "$INPUT{'whichzone'})\n";
}
}
print "\n",
"
",
" \n";
open (COUNT, "<$adverts_dir/adcount.txt");
@lines = Comptes ",
"Debut ",
"Fin ",
"Zone(s) ",
"Poid. ",
"Affichages ",
"Exp./Jours ",
"Cliques ",
"% ",
"Proportions )) {
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 =
";
print " \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 .= "";
print "[ File Error: ";
print "$advertiser.txt ] $mday $months[$mon] $year";
unless ($max > $time) {
$expired = 1 ;
$expirationstatus .=
" ";
}
elsif (($maxtype eq "N") && ($max < 1)) {
if ($displayratio > 1) {
$expirationstatus .= "
EXPIRE!";
}
$expirationstatus .= "0 affichages ";
}
else {
$expirationstatus .= "
(non-expiré!)(non-expiré!) ";
}
}
else {
$expirationstatus .= "".&commas($max);
if ($maxtype eq "C") {
$expirationstatus .= " cliques";
if (($average == 0) || ($shown == 0) || ($visits == 0)) {
$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 "
(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 .= "\n",
"\n";
$runtime = 0;
if ($start) {
($sec,$min,$hour,$mday,$mon,$year,
$wday,$yday,$isdst) = localtime($start);
$year += 1900;
print " \n";
}
print "\n";
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
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 =
";
}
if ((-s "$adverts_dir/groups.txt") && ($INPUT{'whichtype'} =~ /groups/)) {
undef @grouplines;
open (COUNT, "<$adverts_dir/groups.txt");
@grouplines = \n";
@sortedgroups = sort (@grouplines);
foreach $group (@sortedgroups) {
chop ($group) if ($group =~ /\n$/);
next if (length($group) < 1);
open (DISPLAY, "<$adverts_dir/$group.grp");
@members =
",
"\n",
" \n";
}
print "";
foreach $member (@members) {
unless ($member eq $grppassword) {
chop ($member)
if ($member =~ /\n$/);
print " $member";
}
}
print "
";
}
print "\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 =
\n";
&reviewadvert;
}
print "\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 "Affichagess ",
"Cliques ",
"% ",
"Proportion ";
print " \n";
print "",&commas($TotalShown)," ";
print "",&commas($TotalVisits)," ";
print "$perc $ratio \n";
print "
\n";
print "";
print " \n";
print "Début ";
if ($displayratio) {
print "Bannières affichées ";
print "
";
print "sur Votre SiteCliques sur ";
print "
";
print "Votre Site% ";
print "Rapport ";
if ($start) {
($sec,$min,$hour,$mday,$mon,$year,
$wday,$yday,$isdst) = localtime($start);
$year += 1900;
print " \n";
print "$mday $months[$mon] $year ";
$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 " ",&commas($displaycount)," ";
print "",&commas($clicksfrom)," ";
print "$foreignperc ";
print "$foreignratio \n";
print "
";
}
else {
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 "End ";
}
if ($image || $raw || $shown || $visits) {
print "Vos Bannieres ";
print "
";
print "AffichagesAff/Jour ";
print "Cliques sur ";
print "
";
print "Votre Bannieres% ";
print "Rapport ";
}
print "";
$runtime = 0;
if ($start) {
($sec,$min,$hour,$mday,$mon,$year,
$wday,$yday,$isdst) = localtime($start);
$year += 1900;
unless ($displayratio) {
print " $mday $months[$mon] $year ";
}
$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 " $mday $months[$mon] $year";
unless ($max > $time) {
$expired = 1;
print " ";
}
elsif (($maxtype eq "N") && ($max < 1)) {
if ($displayratio > 1) {
print "
EXPIRE !";
}
print "0 affichages ";
}
else {
print "
(non-expiré!)(non-expiré!) ";
}
}
else {
print "",&commas($max);
if ($maxtype eq "C") {
print " clicks";
if (($average == 0) || ($shown == 0) || ($visits == 0)) {
print " ";
}
}
if ($image || $raw || $shown || $visits) {
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)," ";
if ($expired || ($weight < 1)) {
print "-- ";
}
elsif ($average > 0) {
print "",&commas($average)," ";
}
else {
print "N/A ";
}
print "",&commas($visits)," ";
print "$perc $ratio ";
}
print "";
if ($IFRAMEexchange) { $DefaultBorder = 0; }
$HTMLCode = "";
if ($ExchangeName) {
$HTMLCode = "<!-- Begin $ExchangeName Code -->\n
\n";
unless ($JavaScriptExchange) {
print "
";
}
$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";
print "\n";
print "\n";
if ($LogIP) {
print "\n";
}
print "
//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 =
(Les 5 dernier jours seulement)";
}
elsif ($INPUT{'FullDailyList'}) {
print "
(Full List)";
}
print ":\n";
print "\n";
print "
";
print " \n";
$ColCount += 10;
}
$daycounter = (($endday-$startday)+1);
foreach $daycount ($startday..$endday) {
print "Date ";
$ColCount = 1;
if ($bannex) {
print "Bannières affichés ";
print "
";
print "sur votre siteCliques venant ";
$ColCount += 6;
}
if ($beingshown) {
print "
";
print "de Votre SiteVos Bannieres ";
print "
";
print "AffichésCliques sur ";
print "
";
print "Votre Banniere% ";
print "Rapport ";
if (($daycount > $startday)
&& ($daycount-(int($daycount/7)*7)==3)) {
print " \n";
print "
";
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 " \n";
}
}
print "$perp_day $months[$perp_mon-1] $perp_year ";
$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 "",&commas($banners)," ";
if ($bannerspercent==0) { print ""; }
else { print " "; }
print "",&commas($clicksfrom)," ";
if ($clicksfrompercent==0) { print ""; }
else { print " "; }
}
if ($beingshown) {
print "",&commas($exposures)," ";
if ($exposurespercent==0) { print ""; }
else { print " "; }
print "",&commas($clicks)," ";
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 "$perc ";
print "$ratio ";
if ($perc > 0) {
$perc = int($perc*15);
print " ";
}
else { print ""; }
print " \n";
print "\n";
print "\n";
if ($LogIP) {
print "\n";
}
print " \n";
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 "Mois ";
if ($bannex) {
print "Banniéres affichés ";
print "
";
print "sur votre siteCliques Venant ";
}
if ($beingshown) {
print "
";
print "de votre siteVos affichages de bannieres ";
print "
";
print "sur le siteClique sur ";
print "
";
print "votre Banniere% ";
print "Rapport ";
print " \n";
}
}
}
print "$months[$month-1] $year ";
$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 "",&commas($banners)," ";
if ($bannerspercent==0) { print ""; }
else { print " "; }
print "",&commas($clicksfrom)," ";
if ($clicksfrompercent==0) { print ""; }
else { print " "; }
}
if ($beingshown) {
print "",&commas($exposures)," ";
if ($exposurespercent==0) { print ""; }
else { print " "; }
print "",&commas($clicks)," ";
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 "$perc ";
print "$ratio ";
if ($perc > 0) {
$perc = int($perc*15);
print " ";
}
else { print ""; }
print " \n";
print "\n";
print "\n";
if ($LogIP) {
print "\n";
}
print " ";
($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 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 "\n";
print "\n";
print "\n";
print "\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 "\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/ ";
if ($url) { print ""; }
print "\n";
}
}
if ($raw || $image) {
print "
"; }
else { print "\n";
open (ADMINLOG,"$adverts_dir/adminlog.txt");
while (
\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 =
(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 "
(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 = $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 "
\n";
open (FOOTER,"<$footer_file");
@footer =