/*
RunAProg-Counter Main-PHP-Script V1.2 06.11.2005
(c) Jürgen Liebenstein 2004-2005
Dieses Script ist Copyright geschützt und darf nicht verändert werden und nur im Rahmen
der Lizenzbedingungen auf http://online.liebenstein.de genutzt werden
This Script is copyright protected and it is only allowed to use it in order of the
license you see on http://online.liebenstein.de
*/
if ($Counter_Site)
{
if (!$Konfig)
{
$Konfig = "Setting";
}
include $Konfig . ".php";
$Counter_IP = $REMOTE_ADDR;
$Counter_Now = explode(" ", microtime());
$Counter_Now[2] = (double)$Counter_Now[0] + (double)$Counter_Now[1];
$Counter_Now[3] = intval(date("n"));
$Counter_Now[4] = intval(date("Y"));
$Counter_Browser = $HTTP_USER_AGENT;
$Counter_Fueller = str_repeat(" ", 255);
$Counter_Bild_Pfad = $PATH_INFO;
$Counter_Bild_Pos = strrpos($Counter_Bild_Pfad, "/");
$Counter_Bild_Pfad = substr($Counter_Bild_Pfad, 0, $Counter_Bild_Pos + 1);
/*IP laden und prüfen*/
$Counter_IP_Anzahl = 0;
$Counter_Gefunden = -1;
$Counter_Online = 0;
$Counter_Browser_Allow = 0;
if (file_exists("IP.txt"))
{
$Counter_Handle = fopen("IP.txt", "r");
if ($Counter_Handle)
{
while ($Counter_Gelesen = fgets($Counter_Handle, 1000))
{
$Counter_IP_Spalten = explode("|", $Counter_Gelesen);
if (intval($Counter_IP_Spalten[2]) + $Counter_Reloadsperre > $Counter_Now[2])
{
$Counter_Online++;
$Counter_IP_Online[0][$Counter_IP_Anzahl] = $Counter_IP_Spalten[0];
$Counter_IP_Online[1][$Counter_IP_Anzahl] = $Counter_IP_Spalten[1];
$Counter_IP_Online[2][$Counter_IP_Anzahl] = $Counter_IP_Spalten[2];
$Counter_IP_Online[3][$Counter_IP_Anzahl] = substr($Counter_IP_Spalten[3], 0, strlen($Counter_IP_Spalten[3]) - 1);
if ($Counter_IP == $Counter_IP_Spalten[0])
{
if (($Counter_IP_Online[3][$Counter_IP_Anzahl] == "No") || ($Counter_IP_Online[3][$Counter_IP_Anzahl] == "All"))
{
$Counter_Browser_Allow = 2;
}
else
{
$Counter_Browser_Allow = 1;
}
$Counter_IP_Online[2][$Counter_IP_Anzahl] = $Counter_Now[2];
$Counter_Gefunden = $Counter_IP_Anzahl;
}
$Counter_IP_Anzahl++;
}
}
fclose($Counter_Handle);
}
}
/*Neuer Eintrag in IP*/
if ($Counter_Gefunden == -1)
{
$Counter_IP_Name = gethostbyaddr($REMOTE_ADDR);
$Counter_IP_Online[0][$Counter_IP_Anzahl] = $Counter_IP;
$Counter_IP_Online[1][$Counter_IP_Anzahl] = $Counter_IP_Name;
$Counter_IP_Online[2][$Counter_IP_Anzahl] = $Counter_Now[2];
if ($Admin == $Counter_Admin)
{
$Counter_IP_Online[3][$Counter_IP_Anzahl] = "All";
if (file_exists("Admin.txt"))
{
$Counter_Handle = fopen("Admin.txt", "a");
}
else
{
$Counter_Handle = fopen("Admin.txt", "w");
}
if ($Counter_Handle)
{
fputs($Counter_Handle, $Counter_IP . "|" . $Counter_IP_Name . "|" . date("d.m.Y H:i:s", $Counter_Now[2]) . "|\n");
fclose($Counter_Handle);
}
$Counter_Browser_Allow = 2;
}
else
{
if (file_exists("Browser.txt"))
{
$Counter_Handle = fopen("Browser.txt", "r");
if ($Counter_Handle)
{
$Counter_Browser_Allow = 1;
while ($Counter_Gelesen = fgets($Counter_Handle, 1000))
{
if (strpos(" " . $Counter_Browser, substr($Counter_Gelesen, 1, strlen($Counter_Gelesen) - 2)) == 1)
{
if (substr($Counter_Gelesen, 0, 1) == "-")
{
$Counter_Browser_Allow = 0;
}
}
}
fclose($Counter_Handle);
}
else
{
$Counter_Browser_Allow = 1;
}
}
else
{
$Counter_Browser_Allow = 1;
}
}
if ($Counter_Browser_Allow == 0)
{
$Counter_IP_Online[3][$Counter_IP_Anzahl] = "No";
}
if ($Counter_Browser_Allow == 1)
{
$Counter_IP_Online[3][$Counter_IP_Anzahl] = " ";
}
$Counter_Gefunden = $Counter_IP_Anzahl;
$Counter_IP_Anzahl++;
}
/*Seite lesen*/
$Counter_Site_Nr = -1;
$Counter_Site_Nr_Max = 0;
$Counter_Site_Anzahl = 0;
$Counter_Site_Monat_Anzahl = 0;
$Counter_Site_Position = -1;
if (file_exists("Seite.txt"))
{
$Counter_Handle = fopen("Seite.txt", "r");
if ($Counter_Handle)
{
$Counter_Position = 0;
while ($Counter_Gelesen = fgets($Counter_Handle, 5000))
{
if (strlen($Counter_Gelesen) == 18)
{
$Counter_Init_Monat = intval(substr($Counter_Gelesen, 0, 2));
$Counter_Init_Jahr = intval(substr($Counter_Gelesen, 2, 4));
$Counter_Last_Jahr = intval(substr($Counter_Gelesen, 6, 4));
$Counter_Name_Stellen_Akt = intval(substr($Counter_Gelesen, 10, 3));
$Counter_Gesamt_Stellen_Akt = intval(substr($Counter_Gelesen, 13, 2));
$Counter_Monat_Stellen_Akt = intval(substr($Counter_Gelesen, 15, 2));
$Counter_Start_Monat = 12 - $Counter_Init_Monat + 1;
if ($Counter_Init_Jahr == $Counter_Now[4])
{
$Counter_Monat_Pos = $Counter_Now[3] - $Counter_Init_Monat;
}
else
{
$Counter_Monat_Pos = (13 - $Counter_Init_Monat) + ($Counter_Now[4] - $Counter_Init_Jahr - 1) * 12 + $Counter_Now[3] - 1;
}
$Counter_Monat_Anzahl = (13 - $Counter_Init_Monat) + ($Counter_Now[4] - $Counter_Init_Jahr) * 12;
}
else
{
if (strpos($Counter_Gelesen, $Counter_Site . " ") == 10)
{
$Counter_Site_Nr = intval(substr($Counter_Gelesen, 0, 5));
$Counter_Art_Aktuell = intval(substr($Counter_Gelesen, 5, 5));
$Counter_Site_Anzahl = intval(substr($Counter_Gelesen, 10 + $Counter_Name_Stellen, $Counter_Gesamt_Stellen));
$Counter_Site_Monat_Anzahl = intval(substr($Counter_Gelesen, 10 + $Counter_Name_Stellen + $Counter_Gesamt_Stellen + ($Counter_Monat_Pos * $Counter_Monat_Stellen), $Counter_Monat_Stellen));
$Counter_Site_Position = $Counter_Position;
}
else
{
if (($Counter_Site_Nr < intval(substr($Counter_Gelesen, 0, 5))) && ($Counter_Site_Position == -1))
{
$Counter_Site_Nr_Max = intval(substr($Counter_Gelesen, 0, 5));
}
}
}
$Counter_Position = ftell($Counter_Handle);
}
fclose($Counter_Handle);
}
/*Umkopieren*/
if (($Counter_Name_Stellen_Akt != $Counter_Name_Stellen) || ($Counter_Gesamt_Stellen_Akt != $Counter_Gesamt_Stellen) || ($Counter_Monat_Stellen_Akt != $Counter_Monat_Stellen) || (!$Counter_Init_Monat) || ($Counter_Last_Jahr != $Counter_Now[4]) || ($Counter_Init_Monat_Neu) || ($Counter_Init_Jahr_Neu))
{
if (!$Counter_Init_Monat_Neu)
{
$Counter_Init_Monat_Neu = $Counter_Init_Monat;
}
if (!$Counter_Init_Jahr_Neu)
{
$Counter_Init_Jahr_Neu = $Counter_Init_Jahr;
}
include "Change.php";
}
}
else
{
$Counter_Site_Nr = 1;
$Counter_Init_Monat = $Counter_Now[3];
$Counter_Init_Jahr = $Counter_Now[4];
$Counter_Last_Jahr = $Counter_Now[4];
$Counter_Monat_Pos = 0;
$Counter_Handle = fopen("Seite.txt", "w");
if ($Counter_Handle)
{
$Counter_Ausgabe = sprintf("%02d", $Counter_Init_Monat) . sprintf("%04d", $Counter_Init_Jahr) . sprintf("%04d", $Counter_Last_Jahr);
$Counter_Ausgabe = $Counter_Ausgabe . sprintf("%03d", $Counter_Name_Stellen) . sprintf("%02d", $Counter_Gesamt_Stellen) . sprintf("%02d", $Counter_Monat_Stellen);
fputs($Counter_Handle, $Counter_Ausgabe . "\n");
fclose($Counter_Handle);
}
}
if ($Counter_Browser_Allow == 1)
{
if ($Counter_Site_Position == -1)
{
$Counter_Site_Nr_Max++;
$Counter_Site_No = $Counter_Site_Nr_Max;
}
else
{
$Counter_Site_No = $Counter_Site_Nr;
}
if (!strpos("-" . $Counter_IP_Online[3][$Counter_Gefunden], " " . $Counter_Site_Nr . " "))
{
$Counter_Neue_Seite = 1;
$Counter_IP_Online[3][$Counter_Gefunden] = $Counter_IP_Online[3][$Counter_Gefunden] . " " . $Counter_Site_Nr . " ";
$Counter_Site_Anzahl++;
$Counter_Site_Monat_Anzahl++;
}
else
{
$Counter_Neue_Seite = 0;
}
}
/*Pruefe E-Mail-Benachrichtigung für bestimmte IPs*/
$Counter_E_Mail_Anzahl = 0;
for ($Counter_Index = 0; $Counter_Index <= $Counter_Real_Inform_Anzahl; $Counter_Index++)
{
if (strstr($Counter_IP_Name, $Counter_Real_Inform[$Counter_Index]))
{
$Counter_E_Mail[$Counter_E_Mail_Anzahl] = $Counter_Real_Inform[$Counter_Index];
$Counter_E_Mail_Anzahl++;
}
}
/*Schreibe IP-TXT neu*/
$Counter_Handle = fopen("IP.txt", "w");
if ($Counter_Handle)
{
for ($Counter_Index = 0; $Counter_Index < $Counter_IP_Anzahl; $Counter_Index++)
{
fputs($Counter_Handle, $Counter_IP_Online[0][$Counter_Index] . "|" . $Counter_IP_Online[1][$Counter_Index] . "|" . $Counter_IP_Online[2][$Counter_Index] . "|" . $Counter_IP_Online[3][$Counter_Index] . "\n");
}
fclose($Counter_Handle);
}
/*Seite schreiben*/
if ($Counter_Browser_Allow == 1)
{
if ($Counter_Site_Position == -1)
{
$Counter_Handle = fopen("Seite.txt", "a+");
}
else
{
$Counter_Handle = fopen("Seite.txt", "r+");
}
if ($Counter_Handle)
{
if ($Counter_Site_Position == -1)
{
$Counter_Ausgabe = sprintf("%05d", $Counter_Site_Nr_Max) . " 0" . substr($Counter_Site . $Counter_Fueller, 0, $Counter_Name_Stellen) . sprintf("%" . $Counter_Gesamt_Stellen . "d", $Counter_Site_Anzahl);
for ($Counter_Jahr = $Counter_Init_Jahr; $Counter_Jahr <= $Counter_Last_Jahr; $Counter_Jahr++)
{
if ($Counter_Jahr == $Counter_Init_Jahr)
{
$Counter_Start_Monat = $Counter_Init_Monat;
}
else
{
$Counter_Start_Monat = 1;
}
for ($Counter_Index = $Counter_Start_Monat; $Counter_Index <= 12; $Counter_Index++)
{
if (($Counter_Index == $Counter_Now[3]) && ($Counter_Jahr == $Counter_Last_Jahr))
{
$Counter_Ausgabe = $Counter_Ausgabe . sprintf("%" . $Counter_Monat_Stellen . "d", $Counter_Site_Monat_Anzahl);
}
else
{
$Counter_Ausgabe = $Counter_Ausgabe . str_repeat(" ", $Counter_Monat_Stellen - 1) . "0";
}
}
}
$Counter_Ausgabe = $Counter_Ausgabe . date("d.m.Y H:i:s", $Counter_Now[2]);
fputs($Counter_Handle, $Counter_Ausgabe . "\n");
}
else
{
fseek($Counter_Handle, $Counter_Site_Position + 10 + $Counter_Name_Stellen);
fputs($Counter_Handle, sprintf("%" . $Counter_Gesamt_Stellen . "d", $Counter_Site_Anzahl), $Counter_Gesamt_Stellen);
fseek($Counter_Handle, $Counter_Site_Position + 10 + $Counter_Name_Stellen + $Counter_Gesamt_Stellen + $Counter_Monat_Pos * $Counter_Monat_Stellen);
fputs($Counter_Handle, sprintf("%" . $Counter_Monat_Stellen . "d", $Counter_Site_Monat_Anzahl), $Counter_Monat_Stellen);
fseek($Counter_Handle, $Counter_Site_Position + 10 + $Counter_Name_Stellen + $Counter_Gesamt_Stellen + $Counter_Monat_Anzahl * $Counter_Monat_Stellen);
fputs($Counter_Handle, date("d.m.Y H:i:s", $Counter_Now[2]), 19);
}
fclose($Counter_Handle);
}
}
/*Ausgabe für Bildschirm*/
$Counter_Zahl = $Counter_Site_Anzahl;
if ($Art)
{
$Counter_Art_Aktuell = $Art;
}
if (strlen($Counter_Zahl) < $Counter_Art_Stellen[$Counter_Art_Aktuell])
{
$Counter_Zahl = substr(str_repeat(" ", $Counter_Art_Stellen[$Counter_Art_Aktuell] - strlen($Counter_Zahl)) . $Counter_Zahl, 0);
}
$Counter_Ausgabe = "";
switch ($Counter_Art_Ausgabe[$Counter_Art_Aktuell])
{
case 0:
$Counter_Art_Ausgabe = "";
break;
case 1:
for ($Counter_Index = 0; $Counter_Index < strlen($Counter_Zahl); $Counter_Index++)
{
if (substr($Counter_Zahl, $Counter_Index, 1) == " ")
{
$Counter_Ausgabe = $Counter_Ausgabe . "
";
}
else
{
$Counter_Ausgabe = $Counter_Ausgabe . "
";
}
}
break;
case 2:
$Counter_Ausgabe = $Counter_Zahl;
break;
}
echo "document.write('$Counter_Ausgabe');\n";
for ($Counter_Index = 0; $Counter_Index < $Counter_E_Mail_Anzahl; $Counter_Index++)
{
$MailForm_Header = "From: " . $Counter_Mail_Adresse . "\n";
$MailForm_Header = $MailForm_Header . "Reply-To: " . $Counter_Mail_Adresse . "\n";
$MailForm_Header = $MailForm_Header . "Date: " . date("D d M Y H:i:s Z", time()) . "\n";
$MailForm_Header = $MailForm_Header . "X-Sender: <" . $Counter_Mail_Adresse . ">\n";
$MailForm_Header = $MailForm_Header . "X-Mailer: PHP-FormMailer V1.0 (c) Jürgen Liebenstein 2004\n";
$MailForm_Header = $MailForm_Header . "Return_Path: <" . $Counter_Mail_Adresse . ">\n";
$MailForm_Header = $MailForm_Header . "MIME-Version: 1.0\n";
$MailForm_Header = $MailForm_Header . "Content-Type: multipart/mixed;\n boundary=\"----=_trennline\"\n";
$MailForm_Header = $MailForm_Header . "X-Priority: 3\n";
$MailForm_Header = $MailForm_Header . "X-MSMail-Priority: normal \n";
$MailForm_Header = $MailForm_Header . "This is a multi-part message in MIME format.\n\n";
$MailForm_Body = $MailForm_Body . "\n------=_trennline\n";
$MailForm_Body = $MailForm_Body . "Content-Type: text/plain;\n charset=\"iso-8859-1\"\n";
$MailForm_Body = $MailForm_Body . "Content-Transfer-Encoding: 8bit\n\n";
$MailForm_Body = $MailForm_Body . "Die Webseite " . $Counter_Site . " wurde von " . $Counter_E_Mail[$Counter_Index] . " besucht !";
$Counter_Mail = mail($Counter_Real_Inform_EMail, "Webseiten-Benachrichtigung", "", $MailForm_Header . $MailForm_Body);
}
}
else
{
if (file_exists("Fehler.txt"))
{
$Counter_Handle = fopen("Fehler.txt", "a");
}
else
{
$Counter_Handle = fopen("Fehler.txt", "w");
}
if ($Counter_Handle)
{
fputs($Counter_Handle, "No Site|" . $Counter_IP . "|" . $Counter_IP_Name . "|" . $HTTP_REFERER . "|" . $HTTP_USER_AGENT . "|" . date("d.m.Y H:i:s", $Counter_Now[2]) . "|\n");
fclose($Counter_Handle);
}
}
?>