#!/usr/bin/perl
# Send the mails that have been collected in /cgi-bin/sendmail.nok
require "$ENV{'DOCUMENT_ROOT'}/cgi-bin/adr.pl";
require "$ENV{'DOCUMENT_ROOT'}/banneradrde/stat.cgi";
$sendmailnok = "$ENV{'DOCUMENT_ROOT'}/cgi-bin/sendmail.nok";
$workfile = "$ENV{'DOCUMENT_ROOT'}/cgi-bin/sendmail.n2";
$countfile = "$ENV{'DOCUMENT_ROOT'}/cgi-bin/sendmail.nr";
$lockfile = "$ENV{'DOCUMENT_ROOT'}/cgi-bin/sendmail.lock";
$senddelayedfile = "$ENV{'DOCUMENT_ROOT'}/cgi-bin/sendmail.delay";
# Ergebnisseite
$| = 1;
print "Content-type: text/html\n\n";
# Testen, ob eine Statistik erstellt werden soll
do makeStat();
$info = "";
$doRefresh = 1;
$fileIsLocked = 0;
if (-e $lockfile) {
$fileIsLocked = 1;
$info = "$info File $sendmailnok is in use ($lockfile exists)
\n";
$filetime = -M $lockfile;
$info = "$info FileInfo: $filetime
\n";
if ($filetime >= 0.002) {
$info = "$info File too old. Erase it.
\n";
$fileIsLocked = 0;
}
}
if ($fileIsLocked == 0) {
open (OUT,">$lockfile" );
print OUT ("File in use. This file was created with start1.cgi\n");
close(OUT);
}
# Take the file sendmail.nok
if (($fileIsLocked == 0) && (!-e $workfile)) {
unlink "$countfile";
if (-e $sendmailnok) {
$info = "$info Rename $sendmailnok to $workfile
\n";
rename $sendmailnok,$workfile;
}
}
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
# Check if a file can be used with delayed sending:
if (($fileIsLocked == 0) && (!-e $workfile)) {
$ls = `ls $senddelayedfile.*`;
# $info = "$info ls=$ls
\n";
$take_file = "";
@ls = split(/\s+/,$ls);
foreach $temp_file (@ls) {
if (-T $temp_file) {
$info = "$info temp_file=$temp_file
\n";
$stunde = substr($temp_file,length($temp_file)-2,2);
$stunde = int($stunde);
if ($stunde == $hour) {
$take_file = $temp_file;
}
}
}
if (length($take_file) != 0) {
$info = "$info take_file = $take_file
\n";
rename $take_file,$workfile;
}
}
if (($fileIsLocked == 0) && (!-e $workfile))
{
$info = "$info $workfile nicht vorhanden.
\n";
$doRefresh = 0;
}
print "\n
DGB CDU SPD FDP Bonn Berlin, Bochum Deutschland Computer
\n";
$fill = "$fill Silber. Gold Bronze Domain Name Weiterleitung E-Mail EMail E-Mail
\n";
$fill = "$fill Das Telefon ist ein Handy oder ein Mobiltelefon oder aber auch nur ein Homehandy bzw. ein Hometelefon.
\n";
$fill = "$fill Bereits in der Schule oder der Berufsschule lernt man, daß das Abi nur an einer Gesamtschule oder einem Gymnasium gemacht werden kann.
Warum ich Bier trinke? Weil es schmeckt!
\n";
$fill = "$fill Warum ich Wein trinke? Weil er schmeckt!
\n";
$fill = "$fill Warum ich Cola trinke? Weil sie schmeckt!
\n";
$fill = "$fill Warum ich Limo trinke? Weil sie schmeckt!
\n";
$fill = "$fill Warum ich Whisky trinke? Weil er schmeckt!