|
Posted by IchBin on 08/11/06 19:55
Leszek wrote:
> Hi.
> I've written a litle script that should count how many users visited the
> site each day.
> The problem is that now i can see over hundred different ip number in
> database but on the web site of the counter (istats5)
> i that the site was visited only 55 times today. Can anyone tell me why does
> this happen? Do you think that the script doesn't work properly? Or maybe
> its a case of a few users is visiting the site at the same time?
>
> This is the script (each ip counts only once a day and the data from
> database is deleted after midnight)
> <?php
> $ip = $_SERVER['REMOTE_ADDR'];
> $data=date('Y-m-d');
> $dzis=getdate(strtotime("$data"));
> $_SESSION['statystyka']="nie";
> $zapytanie15="SELECT numer_ip, kiedy,id FROM statystyka";
> $wynik15=mysql_query($zapytanie15);
> if($wynik15){
> while($wiersz15=mysql_fetch_array($wynik15,MYSQL_NUM))
> {
> if (($ip==$wiersz15[0])&&($data==$wiersz15[1])){
>
> $_SESSION['statystyka']="tak";
> }
> if($data!=$wiersz15[1]){
> $kiedy=$wiersz15[1];
> $iledni=getdate(strtotime("$kiedy"));
> $delta=$dzis['yday']-$iledni['yday'];
> if($delta>=1){
> $zapytanie18="DELETE
> FROM statystyka WHERE id='".$wiersz15[2]."'";
> $wynik18=mysql_query($zapytanie18);
> }
>
> }
> }
> }
> if($_SESSION['statystyka']=="nie"){
> echo "<script language=\"javascript\">
> var ipath='www.szachy.biz/istats5'
> document.write('<SCR' + 'IPT LANGUAGE=\"JavaScript\"
> SRC=\"http://'+ ipath +'/istats.js\"><\/SCR' + 'IPT>');
> </script>";
> $zapytanie16="INSERT INTO statystyka (numer_ip, kiedy) VALUES
> ('".$ip."','".$data."')";
> $wynik16=mysql_query($zapytanie16);
> }
> ?>
>
> Thanks. Leszek
>
>
May be that their are search engines or crawlers hitting your site?
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
__________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
[Back to original message]
|