By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,110 Members | 1,562 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,110 IT Pros & Developers. It's quick & easy.

Problem with conuting users visiting site

P: n/a
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_N UM))
{
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
Aug 11 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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_N UM))
{
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-)
Aug 11 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.