php.de

Zurück   php.de > Webentwicklung > PHP-Fortgeschrittene

PHP-Fortgeschrittene Arbeiten mit PHP ohne Einschränkungen

Antwort
 
LinkBack Themen-Optionen Thema bewerten
Alt 03.09.2005, 16:58  
Gast
 
Beiträge: n/a
Standard Hit-Counter zählt Doppelt

Hi,
ich habe auf folgender Seite ein Problem mit meinem Hit-Counter:
www.michis-homepage.net
Dieser Counter zählt immer die Hits doppelt, ist aber nicht doppelt eingebunden!
Wo kann der Fehler liegen?
Hier das Script:

PHP-Code:
<?php
######################################################################### 
# PHP-TextCounter von murb # 
# php_txtcounter v. 2.4 # 
# All rights by murb ([url]www.murb.com[/url]) # 
#-----------------------------------------------------------------------# 
# Info: [email]webmaster@murb.com[/email] # 
# I-Net: [url]http://www.murb.com[/url] # 
# # 
# Dieses Script ist Freeware # 
# Dateien dürfen NUR auf murb.com zum Download angeboten werden. # 
######################################################################### 
// Dieses Copyright darf NICHT entfernt werden! 

$ipsperre "yes"// IP-Sperre 
$ipstore "50"// IP-Adressen-Anzahl (Besucherzähler) 
$iptime "86400"// IP-Adressen-Zeitbegrenzung 
$onlineipstore "50"// IP-Adressen-Anzahl (Onlinezähler) 
$onlinetime "300"// Online-Zeit für einen Besucher 
$path "counter/"// Ordner in der sich der Counter befindet 
$countdatat "counts.inc"// Totalcounter-Datei 
$countdata "today.inc"// Heutecounter-Datei 
$countdatay "yesterday.inc"// Vortagcouter-Datei 
$recorddata "record.inc"// Rekordcounter-Datei 
$onlinedata "online.inc"// IP-Adressen der "Online-Besucher" 
$hitdata "hit.inc"
$ipdata "ips.inc"// IP-Datei 
$visiblet "yes"// (Un)Sichtbarkeit des Totalcounters 
$visibled "yes"// (Un)Sichtbarkeit des Heutecounters 
$visibley "yes"// (Un)Sichtbarkeit des Vortagcounters 
$visibler "yes"// (Un)Sichtbarkeit des Rekordcounters 
$visibleo "yes"// (Un)Sichtbarkeit des Onlinecounters 
$instdate "31.07.2005"// Installationsdatum 
$splitting "
"
// Statistiktrennung 
$txtonline "Online: "// Text vor der aktiven Besucheranzahl 
$txthit "Hits: "// Text vor der Hitanzahl 
$txttoday "Heute: "// Text vor der Besucheranzahl des heutigen Tages 
$txtyesterday "Vortag: "// Text vor der Besucheranzahl des Vortages 
$txtrecord "Tagesrekord: "// Text vor dem Tagesrekord 
$txttotal "Gesamt: "// Text vor der Gesamtbesucheranzahl 
$boldnumbers "yes"// Fette/Normale Schriftart der Zahlen 
$zeitzone "no"// Zeitzone aktivieren 
$zeitzonentyp "MET-1METDST"// Zeitzone 

######################################################################### 
// Editiere nur, wenn du weißt was du tust !!! 


if ($_GET[action] != "show" || !isset($_GET[action])) 

#### Hit-Counter Anfang #### 
$loadhit fopen($path.$hitdata"r"); 
$counthit fread($loadhitfilesize($path.$hitdata)); 
fclose($loadhit); 

$counthit += 1

$storehit fopen($path.$hitdata"w"); 
fwrite($storehit$counthit); 
fclose($storehit); 
#### Hit-Counter Ende #### 

if ($ipsperre == "yes"

if (
getenv('HTTP_X_FORWARDED_FOR')) 

$varip getenv('HTTP_X_FORWARDED_FOR'); 

else 

$varip getenv('REMOTE_ADDR'); 

if (!
file_exists($path.$countdatat) || !file_exists($path.$countdata) || !file_exists($path.$countdatay) || !file_exists($path.$recorddata) || !file_exists($path.$onlinedata) || !file_exists($path.$ipdata)) 

echo 
"Fehler! Dateizugriff nicht möglich."
exit; 

$factorx time(); 
$ipanzahl count(file($path.$onlinedata)); 
$loadips fopen($path.$onlinedata,"r"); 
$allips fread($loadipsfilesize($path.$onlinedata)); 
fclose($loadips); 
$ips explode("||"$allips); 

$i 0
while (
$i $ipanzahl

$sectors explode("::"$ips[$i]); 
if (
preg_match ("/$varip/i"$sectors[0])) 

if (
$onlinetime 0

$strike $factorx $sectors[1]; 
if (
$strike <= $onlinetime

$rauswurf "no"



$i += 1

if (
$rauswurf != "no"

if (
$ipanzahl == 0

$storeip fopen($path.$onlinedata,"a+"); 
fwrite($storeip"$varip::$factorx||"); 
fclose($storeip); 

else 

if (
$ipanzahl >= $onlineipstore

$readips fopen($path.$onlinedata,"r"); 
$cacheips fread($readipsfilesize($path.$onlinedata)); 
fclose($readips); 
$ipcached explode("||"$cacheips); 

for (
$r 1$r $onlineipstore; ++$r

if (
$r == 1

$ipcached[$r] = str_replace("\n"""$ipcached[$r]); 
$ipcached[$r] = str_replace("\r"""$ipcached[$r]); 
$storeip fopen($path.$onlinedata,"w"); 
fwrite($storeip"$ipcached[$r]||"); 
fclose($storeip); 

elseif (
$r == $onlineipstore 1

$storeip fopen($path.$onlinedata,"a+"); 
fwrite($storeip"$ipcached[$r]||\r\n$varip::$factorx||"); 
fclose($storeip); 

else 

$storeip fopen($path.$onlinedata,"a+"); 
fwrite($storeip"$ipcached[$r]||"); 
fclose($storeip); 



else 

$storeip fopen($path.$onlinedata,"a+"); 
fwrite($storeip"\r\n$varip::$factorx||"); 
fclose($storeip); 



$factorx time(); 
$ipsgesamt count(file($path.$onlinedata)); 
$w 0
$useronline 0
while (
$w $ipsgesamt

$sectors explode("::"$ips[$w]); 
if (!isset(
$sectors[1]) || $sectors[1] == ""

$strike 0

else 

$strike $factorx $sectors[1]; 

if (
$strike <= $onlinetime

$useronline += 1

$w += 1


if (
$useronline 1

$useronline 1

$ipanzahl count(file($path.$ipdata)); 

$loadips fopen($path.$ipdata,"r"); 
$allips fread($loadipsfilesize($path.$ipdata)); 
fclose($loadips); 
$ips explode("||"$allips); 
$goon "yes"

$i 0
while (
$i $ipanzahl

$sectors explode("::"$ips[$i]); 
if (
preg_match ("/$varip/i"$sectors[0])) 

if (
$iptime 0

$strike $factorx $sectors[1]; 
if (
$strike <= $iptime

$countit "no"


elseif (
$iptime <= 0

$countit "no"


$i += 1

if (
$countit == "no"

$loadcount fopen($path.$countdata,"r"); 
$counttoday fread($loadcountfilesize($path.$countdata)); 
fclose($loadcount); 

$todaydaten explode("||"$counttoday); 

$loadyesterday fopen($path.$countdatay"r"); 
$countyesterday fread($loadyesterdayfilesize($path.$countdatay)); 
fclose($loadyesterday); 

$loadtotal fopen($path.$countdatat"r"); 
$counttotal fread($loadtotalfilesize($path.$countdatat)); 
fclose($loadtotal); 

$loadrecord fopen($path.$recorddata"r"); 
$record fread($loadrecordfilesize($path.$recorddata)); 
fclose($loadrecord); 

if (
$todaydaten[0] > $record

$storenewrecord fopen($path.$recorddata"w"); 
fwrite($storenewrecord$todaydaten[0]); 
fclose($storenewrecord); 

$record $todaydaten[0]; 

if (
$todaydaten[0] == "0"

$nday date("d"); 
$nmonth date("m"); 
$nyear date("Y"); 
$tanzahl "1"

$storecount fopen($path.$countdata"w"); 
fwrite($storecount"$tanzahl||$nday||$nmonth||$nyear"); 
fclose($storecount); 


if (
$countyesterday == "0" || $countyesterday == ""

$countyesterday "-"


$bv "[b]"
$bh "[/b]"

if (
$visibleo == "yes"

if (
$visibled == "yes" || $visibley == "yes" || $visibler == "yes" || $visiblet == "yes"

if (
$boldnumbers == "yes"

$useronline $bv.$useronline.$bh
$counthit $bv.$counthit.$bh

$writeonlinecounter $txtonline.$useronline.$splitting.$txthit.$counthit.$splitting

else 

if (
$boldnumbers == "yes"

$useronline $bv.$useronline.$bh
$counthit $bv.$counthit.$bh

$writeonlinecounter $txtonline.$useronline.$splitting.$txthit.$counthit


if (
$visibled == "yes"

if (
$visibley == "yes" || $visibler == "yes" || $visiblet == "yes"

if (
$boldnumbers == "yes"

$todaydaten $bv.$todaydaten[0].$bh

else 

$todaydaten $todaydaten[0]; 

$writetodaycounter $txttoday.$todaydaten.$splitting

else 

if (
$boldnumbers == "yes"

$todaydaten $bv.$todaydaten[0].$bh

else 

$todaydaten $todaydaten[0]; 

$writetodaycounter $txttoday.$todaydaten


if (
$visibley == "yes"

if (
$visibler == "yes" || $visiblet == "yes"

if (
$boldnumbers == "yes"

$countyesterday $bv.$countyesterday.$bh

$writeyesterdaycounter $txtyesterday.$countyesterday.$splitting

else 

if (
$boldnumbers == "yes"

$countyesterday $bv.$countyesterday.$bh

$writeyesterdaycounter $txtyesterday.$countyesterday


if (
$visibler == "yes"

if (
$visibler == "yes" || $visiblet == "yes"

if (
$boldnumbers == "yes"

$record $bv.$record.$bh

$writerecordcounter $txtrecord.$record.$splitting

else 

if (
$boldnumbers == "yes"

$record $bv.$record.$bh

$writerecordcounter $txtrecord.$record


if (
$visiblet == "yes"

if (
$boldnumbers == "yes"

$counttotal $bv.$counttotal.$bh

$writetotalcounter $txttotal.$counttotal


echo 
"$writeonlinecounter$writetodaycounter$writeyesterdaycounter$writerecordcounter$writetotalcounter"
$goon "no"


if (
$ipanzahl == 0

$storeip fopen($path.$ipdata,"a+"); 
fwrite($storeip"$varip::$factorx||"); 
fclose($storeip); 

else 

if (
$ipanzahl >= $ipstore

$readips fopen($path.$ipdata,"r"); 
$cacheips fread($readipsfilesize($path.$ipdata)); 
fclose($readips); 
$ipcached explode("||"$cacheips); 

for (
$r 1$r $ipstore; ++$r

if (
$r == 1

$ipcached[$r] = str_replace("\n"""$ipcached[$r]); 
$ipcached[$r] = str_replace("\r"""$ipcached[$r]); 
$storeip fopen($path.$ipdata,"w"); 
fwrite($storeip"$ipcached[$r]||"); 
fclose($storeip); 

elseif (
$r == $ipstore 1

$storeip fopen($path.$ipdata,"a+"); 
fwrite($storeip"$ipcached[$r]||\r\n$varip::$factorx||"); 
fclose($storeip); 

else 

$storeip fopen($path.$ipdata,"a+"); 
fwrite($storeip"$ipcached[$r]||"); 
fclose($storeip); 



else 

$storeip fopen($path.$ipdata,"a+"); 
fwrite($storeip"\r\n$varip::$factorx||"); 
fclose($storeip); 



if (
$goon != "no"

$loadcount fopen($path.$countdata,"r"); 
$counttoday fread($loadcountfilesize($path.$countdata)); 
fclose($loadcount); 

$todaydaten explode("||"$counttoday); 

$tanzahl $todaydaten[0]; 
$tday $todaydaten[1]; 
$tmonth $todaydaten[2]; 
$tyear $todaydaten[3]; 

if (
$zeitzone == "yes"

@
putenv("TZ=$zeitzonentyp"); 

$nday date("d"); 
$nmonth date("m"); 
$nyear date("Y"); 

$newday "no"
$schongez "0"

if (
$nyear $tyear

$newday "yes"
$schongez "1"

if (
$nmonth $tmonth && $schongez == "0"

$newday "yes"
$schongez "1"

if (
$nday $tday && $schongez == "0"

$newday "yes"


if (
$newday == "yes"

$storeyesterday fopen($path.$countdatay"w"); 
fwrite($storeyesterday$tanzahl); 
fclose($storeyesterday); 

$tanzahl 0


$tanzahl += 1

$storecount fopen($path.$countdata"w"); 
fwrite($storecount"$tanzahl||$nday||$nmonth||$nyear"); 
fclose($storecount); 

$loadtotal fopen($path.$countdatat"r"); 
$counttotal fread($loadtotalfilesize($path.$countdatat)); 
fclose($loadtotal); 

$counttotal += 1

$storecount fopen($path.$countdatat"w"); 
fwrite($storecount$counttotal); 
fclose($storecount); 


$loadrecord fopen($path.$recorddata"r"); 
$record fread($loadrecordfilesize($path.$recorddata)); 
fclose($loadrecord); 

if (
$tanzahl $record

$storenewrecord fopen($path.$recorddata"w"); 
fwrite($storenewrecord$tanzahl); 
fclose($storenewrecord); 

$record $tanzahl


if (
$goon != "no"

$loadyesterday fopen($path.$countdatay"r"); 
$countyesterday fread($loadyesterdayfilesize($path.$countdatay)); 
fclose($loadyesterday); 

$loadcount fopen($path.$countdata"r"); 
$counttoday fread($loadcountfilesize($path.$countdata)); 
fclose($loadcount); 

$todaydaten explode("||"$counttoday); 

if (
$countyesterday == "0" || $countyesterday == ""

$countyesterday "-"


$bv "[b]"
$bh "[/b]"

if (
$visibleo == "yes"

if (
$visibled == "yes" || $visibley == "yes" || $visibler == "yes" || $visiblet == "yes"

if (
$boldnumbers == "yes"

$useronline $bv.$useronline.$bh
$counthit $bv.$counthit.$bh

$writeonlinecounter $txtonline.$useronline.$splitting.$txthit.$counthit.$splitting

else 

if (
$boldnumbers == "yes"

$useronline $bv.$useronline.$bh
$counthit $bv.$counthit.$bh

$writeonlinecounter $txtonline.$useronline.$txthit.$counthit


if (
$visibled == "yes"

if (
$visibley == "yes" || $visibler == "yes" || $visiblet == "yes"

if (
$boldnumbers == "yes"

$todaydaten $bv.$todaydaten[0].$bh

else 

$todaydaten $todaydaten[0]; 

$writetodaycounter $txttoday.$todaydaten.$splitting

else 

if (
$boldnumbers == "yes"

$todaydaten $bv.$todaydaten[0].$bh

else 

$todaydaten $todaydaten[0]; 

$writetodaycounter $txttoday.$todaydaten


if (
$visibley == "yes"

if (
$visibler == "yes" || $visiblet == "yes"

if (
$boldnumbers == "yes"

$countyesterday $bv.$countyesterday.$bh

$writeyesterdaycounter $txtyesterday.$countyesterday.$splitting

else 

if (
$boldnumbers == "yes"

$countyesterday $bv.$countyesterday.$bh

$writeyesterdaycounter $txtyesterday.$countyesterday


if (
$visibler == "yes"

if (
$visibler == "yes" || $visiblet == "yes"

if (
$boldnumbers == "yes"

$record $bv.$record.$bh

$writerecordcounter $txtrecord.$record.$splitting

else 

if (
$boldnumbers == "yes"

$record $bv.$record.$bh

$writerecordcounter $txtrecord.$record


if (
$visiblet == "yes"

if (
$boldnumbers == "yes"

$counttotal $bv.$counttotal.$bh

$writetotalcounter $txttotal.$counttotal


echo 
"$writeonlinecounter$writetodaycounter$writeyesterdaycounter$writerecordcounter$writetotalcounter"


elseif (
$_GET[action] == "show"

$ipsize filesize($ipdata); 
if (
$ipsize 1

$ipsize "10000"


$loadips fopen($ipdata"r"); 
$allips fread($loadips$ipsize); 
fclose($loadips); 
$ipcombo explode("||"$allips); 
$ipanzahl count(file($ipdata)); 

$loadtotalcounts fopen($countdatat"r"); 
$totalcounts fread($loadtotalcountsfilesize($countdatat)); 
fclose($loadtotalcounts); 
$totalcounts trim($totalcounts); 

$loadtodaycounts fopen($countdata"r"); 
$todaycounts fread($loadtodaycountsfilesize($countdata)); 
fclose($loadtodaycounts); 
$todaycounts trim($todaycounts); 

$today explode("||"$todaycounts); 

$loadyesterdaycounts fopen($countdatay"r"); 
$yesterdaycounts fread($loadyesterdaycountsfilesize($countdatay)); 
fclose($loadyesterdaycounts); 
$yesterdaycounts trim($yesterdaycounts); 

$loaddayrecord fopen($recorddata"r"); 
$dayrecordcounts fread($loaddayrecordfilesize($recorddata)); 
fclose($loaddayrecord); 
$dayrecordcounts trim($dayrecordcounts); 

echo (
"<html><head><title>PHP-Textcounter - Informationen</title> 
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"> 
</head> 
<body style=\"font-family: arial; font-size: 12px\"> 
<center> 


[b]PHP-TextCounter: Allgemeine Informationen[/b]</p> 


 </p> 
<table width=\"300\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"font-family: arial; font-size: 12px\"> 
<tr> 
<td width=\"60%\" height=\"19\" align=\"left\" valign=\"top\">Heute:
 
Gestern:
 
Tagesrekord:
 
Seit $instdate:</td> 
<td width=\"40%\" align=\"left\" valign=\"top\">$today[0]
$yesterdaycounts
$dayrecordcounts
$totalcounts</td> 
</tr> 
</table> 


 </p> 
<table width=\"300\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"font-family: arial; font-size: 12px\"> 
<tr> 
<td width=\"100%\" align=\"left\" valign=\"top\" style=\"padding-bottom: 5px\">Die letzten $ipstore gespeicherten IP-Adressen sind:</td> 
</tr> 
<tr> 
<td width=\"100%\" align=\"left\" valign=\"top\">"
); 
if (
$allips == ""

echo 
"
Es sind keine IP-Adressen vorhanden."


else 

for (
$w 0$w $ipanzahl; ++$w

$onlyip explode("::"$ipcombo[$w]); 
$onlyip[0] = str_replace("\n"""$onlyip[0]); 
$onlyip[0] = str_replace("\r"""$onlyip[0]); 
echo 
"
$onlyip[0]"



echo (
"</td> 
</tr> 
</table> 
</center> 
</body> 
</html>"
); 

else 

echo 
"Es ist ein Fehler aufgetreten!"


?>
Ich hoffe mir kann jemand helfen!

Vielen Dank im Voraus!

Fireball22

Edit:
Sry, bin neu hier und kannte diese Funktion leider noch nicht!
Jetzt alles OK?
  Mit Zitat antworten
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 03.09.2005, 17:04  
XLB
Erfahrener Benutzer
 
Registriert seit: 31.07.2005
Beiträge: 1.126
PHP-Kenntnisse:
Fortgeschritten
XLB
Standard

Hmm ...

Nach längerem Scrollen bin ich dann unten angekommen ...

Könntest du diesen näckisch kurzen Quelltext bitte in PHP-Tags packen (-> edit) und ein bisserl einrücken ?

Danke !!!

edit:
Und nimm doch bitte die Code-Teile raus, die für die Lösung deines Probs nicht ganz so relevant sind.
XLB ist offline   Mit Zitat antworten
Antwort


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
[Erledigt] Counter Problem Saphira PHP Tipps 2008 3 11.07.2008 19:21
Counter in "selbstgestrickte" Homepage - wie? magro PHP Tipps 2008 11 30.03.2008 16:37
Wiederkehrer bei Counter ruferp PHP Tipps 2007 7 15.02.2007 07:08
ein counter - und berechnungen netti PHP Tipps 2005-2 11 24.10.2005 21:03
bewertungs-und kommentar script tragen alles doppelt ein Matthiasnet PHP Tipps 2005 11 02.04.2005 23:13
Schon wieder-ein funktionierender Counter mit Fehlermeldung PHP Tipps 2005 2 15.03.2005 18:34
Counter funktioniert, aber trotzdem wird Fehler gezeigt ... PHP Tipps 2005 4 07.03.2005 17:56
Suche Counter Script Beitragsarchiv 8 17.01.2005 13:42
Problem mit counter HTML, Usability und Barrierefreiheit 10 12.01.2005 06:04
Counter für registrierte user PHP Tipps 2004-2 3 26.12.2004 11:32
counter verschwindet immer! HILFE! PHP Tipps 2004 2 30.08.2004 11:02
counter PHP Tipps 2004 2 18.08.2004 11:02
counter für gallerie Sclot PHP Tipps 2004 2 05.07.2004 15:36
Problem mit einem Counter JeeZ PHP Tipps 2004 6 18.06.2004 13:36

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
php besucherzähler, counter zählt doppelt, php hit counter, counter 1 zählt doppelt, php visitor counter dat, \php-textcounter von murb\, counter zählt zweimal, visitor counter zählt gäste nicht, besucherzähler php doppelt, wie funktioniert visitor counter, javascript zeit zählt doppelt, php mysql counter zählt doppelt, hit counter zählt doppelt, webcounter php zählt doppelt, php text counter murb not working, $countdatat = \counts.inc\, $_get doppelt, preg_match (\/$varip/i\, php counter der bis 0 zählt, php textcounter

Alle Zeitangaben in WEZ +2. Es ist jetzt 22:13 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum

Creative Commons License
Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.