Witam mam tai skrypt jak poniżej. On zapisuje dane do pliku a potem je odczytuje. Jest to plik statystyk jednak on zlicza każde odświeżenie jako kolejną odwiedzinę czy da rady przerobić go ta aby 1 ip liczył jako jedną odwiedzinę przez 24h po 24 h odnowa by zaliczył jako kolejną odwiedzinę z góry dzieki za pomoc
<!--/***********************************************************************/
/* see READMEfirst.txt before editing this file! */
/* CENTER BLOCK addon for PHP-Nuke 5.3.1 */
/* user stats and info in a center block on index.php */
/* by: Bobby Apperson (bobby@bobbysays.org) */ /* downloaded from: <a href=\"http://www.bobbysays.org\" target=\"_blank\">http://www.bobbysays.org</a> */
/* */
/* for PHP-NUKE: Web Portal System */
/* version 5.3.1 (may work on other versions not tested - */
/* but please notify me if you have success!) */
/* =========================== */
/* */
/* PHP-Nuke Copyright (c) 2001 */
/* by Francisco Burzi (fbc@mandrakesoft.com) */
/* <a href=\"http://phpnuke.org\" target=\"_blank\">http://phpnuke.org</a> */
/* */
/* Central Bottom Block for phpNuke ver 5.x */
/* <a href=\"http://my-home.gr\" target=\"_blank\">http://my-home.gr</a> */
/* Copyright (c) 2002 Cleo Sakellari (cleo@attiki.net) */
/* <a href=\"http://www.attiki.net\" target=\"_blank\">http://www.attiki.net</a> */
/* */
/* Daily Counter/total hits counter */
/* <a href=\"http://www.proxy2.de/\" target=\"_blank\">http://www.proxy2.de/</a> - Free php and and perl script page */
/* Daily Counter 1.1 */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/* Central Bottom Block*/
/************************************************************************/-->
<?
echo 'userów na stronie:<b> '.$GLOBALS['members'].'</b><br>'; echo 'gości na stronie:<b> '.$GLOBALS['guests'].'</b>';
//open the file handler
$fp=fopen("ip/counter.txt","r");
//Read the previous count
//close the file.
$fw=fopen("ip/counter.txt","w");
//Increment the counter
$cnew=$count+1;
//write the counter back to the log file ie., acc.txt
$countnew=fputs($fw,$count+1
);
//Display VISITOR NUMBER - customize font!
echo " <br><br>Wszystkie wizyty: <b>$cnew</b>";
?> <?php
// Daily Counter 1.1
// Copyright (c)2000 Chi Kien Uong
// URL: <a href=\"http://www.proxy2.de\" target=\"_blank\">http://www.proxy2.de</a>
// - chmod this document to 755! -
$fpt = "ip/daily.txt"; // path to counter log file - chmod it to 666
// optional configuration settings
$lock_ip =0; // IP locking and logging 1=yes 0=no
$ip_lock_timeout =30; // in minutes
$fpt_ip = "ip/ip.txt"; // IP log file - chmod it to 666
// end configuration
function checkIP($rem_addr) {
global $fpt_ip,$ip_lock_timeout; $ip_array = @file($fpt_ip); $reload_dat = fopen($fpt_ip,"w"); for ($i=0; $i<sizeof($ip_array); $i++) {
list
($time_stamp,$ip_addr,$hostname) = split("|",$ip_array[$i]); if ($this_time < ($time_stamp+60*$ip_lock_timeout)) {
if ($ip_addr == $rem_addr) {
$found=1;
}
else {
fwrite($reload_dat,"$time_stamp|$ip_addr|$hostname"); }
}
}
$host = gethostbyaddr($rem_addr);
if (!$host) { $host = $rem_addr; }
fwrite($reload_dat,"$this_time|$rem_addr|$host\n"); return ($found==1) ? 1 : 0;
}
$this_day=(date("D, j F Y")); $count_dat = fopen($fpt,"w+"); $count = 1;
}
else {
$count = $row[1];
if ($this_day == $test) {
if ($lock_ip==0 || ($lock_ip==1 && checkIP($REMOTE_ADDR)==0)) {
$count++;
}
}
else {
$count = 1;
}
$count_dat = fopen($fpt,"w+"); fwrite($count_dat,"$this_day\n"); }
echo "<br>Dzisiaj: <b>$count</b><br><br>";
?>
<?
$browser = getenv( "HTTP_USER_AGENT");
echo "<br>Twoja Przeglądarka: <b><br><br>".$browser; ?>
<script LANGUAGE="JavaScript">
<!-- Begin
var name = navigator.appName
if (name == "Microsoft Internet Explorer")
document.write('<br>');
else;
// End -->
</SCRIPT>
<br>
<script LANGUAGE="JavaScript">
<!-- Begin
if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
var url="http://jportal2.com";
var title="..:: JPORTAL ::..";
document.write('<A HREF="javascript:window.ext');
document.write('ernal.AddFavorite(url,title);" ');
document.write('onMouseOver=" window.status=');
document.write("'..:: Dodaj do Ulubionych!! ::..'; return true ");
document.write('"onMouseOut=" window.status=');
document.write("' '; return true ");
document.write('"><b>Dodaj do Ulubionych</b></a>');
}
else {;
}
// End -->
</SCRIPT>
<br><br><i><b><a href="module.php?op=info">Więcej...</a>
a to drugi skrypt do którego sie odwołuje ten pierwszy
<?
/*****************************************************/
/* jaco.PORTAL - darmowy system portalowy */
/*****************************************************/
/* autor: PaweŚ 'jaco' Jaczewski */
/* email: jaco@4me.pl */
/* www: www.phparea.4me.pl www.jportal.one.pl */
/*****************************************************/
/* Bramka www2gg */
/*****************************************************/
/* autor: Piotr Mach */
/* email: pm@gg.wha.la */
/* www: gg.wha.la */
/*****************************************************/
/* Przystosowanie bramki do jaco.PORTAL'u */
/*****************************************************/
/* autor: Dawid 'Bags Bunny' Humbla */
/* email: bags@kk.com.pl */
/* www: bags.kk.com.pl */
/*****************************************************/
?>
<script>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=no,toolbar=no,scrollbars=no,menubar=no,status=no' );
}
//-->
</SCRIPT>
<?
function module_start() { }
function module_main($cmd) {
main_title_open();
main_title_close();
main_text_open();
?>
<div align="center"><h5>Parę informacji o Tobie....</h5></div>
<table class="uni_01" WIDTH="100%" align=center border=0>
<tr>
<td><b>Server:</b></td>
<td></td>
</tr>
<? $ipaddr = getenv("REMOTE_ADDR"); ?> <tr>
<td>Adres IP:</td>
<td>
<?echo $ipaddr; ?></td>
</tr>
<?
$what = gethostbyaddr($ipaddr);
if ($ipaddr != $what) {
echo ("<tr>\n <td>Host:</td>\n <td>$what</td>\n</tr>\n"); }
?>
<tr>
<td>Zapytanie:</td>
</tr>
<tr>
<td>Server Protokół:</td>
</tr>
<tr>
<td>Przeglądarka:</td>
</tr>
<tr>
<td>Język:</td>
<td>
<?echo getenv("HTTP_ACCEPT_LANGUAGE"); ?></td>
</tr>
<tr>
<td>Port:</td>
</tr>
<tr>
<td><b>Java Script:</b></td>
<td></td>
</tr>
<tr>
<td>Przeglądarka:</td>
<td><script>document.write(navigator.appName)</script></td>
</tr>
<tr>
<td>System operacyjny:</td>
<td><script>document.write(navigator.platform)</script></td>
</tr>
<tr>
<td>Rozdzielczość:</td>
<td><script>document.write(screen.width + " x " + screen.height)</script></td>
</tr>
<tr>
<td>Kolory:</td>
<td><script>document.write(screen.colorDepth + " bit")</script></td>
</tr>
<tr>
<td>Java włączona?</td>
<td><script language="JavaScript">
if(navigator.javaEnabled()){document.write("Tak")}
else{document.write("Nie")}
</script></td>
</tr>
<script language="JavaScript">
for(i=0; i<navigator.plugins.length; i++){
document.writeln("<tr>");
document.writeln("<td colspan=2>" + navigator.plugins[i].name + "</td>");
document.writeln("</tr>");
}
</script>
</table>
<?
main_text_close();
}
function module_info($co) {
if($co=='title')
return 'Info o Tobie :)';
}
?>
Ten post edytował plusz01 15.11.2007, 15:54:54