Tuesday, August 3, 2010

hits and useronline in one

hits and useronline in one 
create folder counter
create besucher.txt 
upload useronline.php and guest.php and edit them
add this cod to your main php page

PHP Code:
$szamlalo_File "counter/".date("Ymd").".txt"
 
if (
file_exists($szamlalo_File)) {  $szamlalo_fp fopen($szamlalo_File,"r");  $szamlalo_num fread($szamlalo_fpfilesize($szamlalo_File));  fclose($szamlalo_fp); 

  
$szamlalo_num=$szamlalo_num+1;  $szamlalo_fp fopen($szamlalo_File,"w");  fwrite($szamlalo_fp$szamlalo_num10);  fclose($szamlalo_fp); 
 
  
$counter_array file("counter.dat"); $all $counter_array[0]+1$fp = @fopen("counter.dat","wb");
@
fputs($fp,$all);
@
fclose($fp); 

echo 
"Visit number: $all
Visits today $szamlalo_num
Online $anzahl"
;  
guest.php
PHP Code:
("Content-Type: text/vnd.wap.wml"); header("Cache-control: no-cache, must-revalidate"); echo '    '; print "

"
$xfile = @file("besucher.txt"); $xfile array_reverse($xfile); $p 150; if ($npage == ""){$npage "1";} $first count($xfile) - ($p * ($npage 1)); $second count($xfile) - ($p $npage) + 1; if ($second 1) {$second 1;} $npages = (int)(count($xfile) / $p); if ($news_limiter>((int) ($npages*$p))) $npages $npages+1; if ($npage <= $npages and $npage>1$gline_rew ".($npage-1)."\">prev"; if ($npages and $npage<$npages$gline_next ".($npage+1)."\">next"$line ""; for ($p 1$p <= $npages$p++) { if ($p != $npage) { $line .= " $p |";} if ($p == $npage) { $line .= "| $p |
"
; } } print $line; for ($i $first-1$i >= $second-1$i--) { $ii $i$ii++; $udata explode("&&",$xfile[$i]); print "$udata[1]
"
; } print $gline_rew."".$gline_next." --------
?Back? wapkralj

  "
?>
useronline.php
PHP Code:
$daten="besucher.txt"$time time();
$brow=("$REMOTE_ADDR"); $user explode ('/'$HTTP_USER_AGENT);  $ip = ("Browser: $user[0] IP: $brow");
$ablaufzeit "$time"-"300"//zdes mozhno nastroit wremja kak dolgo ip budet xranitsja w txt fajle $pruefung = @file($daten);
while (list (
$line_num$line) = @each ($pruefung))
{
$zeiten explode("&&",$line);
if(
$zeiten[0] <= $ablaufzeit)
{
$fp fopen"$daten""r" ); $contents fread($fpfilesize($daten)); fclose($fp); $line=quotemeta($line); $string2 ""$replace ereg_replace($line$string2$contents); $fh=fopen($daten"w");
@
flock($fp,2); fputs($fh$replace);
@
flock($fp,3); fclose($fh);}} $ippruefung = @file($daten);
while (list (
$line_num$line) = @each ($ippruefung))
{
$ips explode("&&",$line);
if(
$ips[1] == $ip)
{
$fp fopen"$daten""r" ); $contents fread($fpfilesize($daten)); fclose($fp); $line=quotemeta($line); $string2 ""$replace ereg_replace($line$string2$contents); $fh=fopen($daten"w");
@
flock($fp,2); fputs($fh$replace);
@
flock($fp,3); fclose($fh);}} $fp fopen("$daten""a+"); flock($fp,2); fputs ($fp"$time&&$ip&&\n"); flock($fp,3); fclose ($fp); $anzahldaten file($daten); $anzahl count($anzahldaten); //eto pokazivaet koli4estwo 4elowek na sajte, nado sozdat eshe textfile besucher.txt**i ego chmod777u menja etot script wstawlen tolko w index.php kone4no mozhesh wstawit ego w kazhduju stranicu*/ ?>

No comments:

Post a Comment