473,386 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Problem with conuting users visiting site

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
1 1206
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Rickard Lindhé | last post by:
Hey. I'm experiencing a problem using a css stylesheet on my homepage (http://w1.193.telia.com/~u19305515/test/testis.html). As you can see, the link works according to the stylesheet when not...
9
by: Theodore A. Jencks | last post by:
Hi All, I have a problem that is two fold. First a little about the enviroment I'm using; I am running Microsoft Windows XP with all security patches applied. I use Mozilla 1.6 for all testing...
102
by: me | last post by:
How do I prevent the save/print/email/mypictures toolbar from popping up when IE users place their cursor over photos at my website? Thank you in advance for your help. Signed, me
1
by: Blue Ball | last post by:
I have setup the global.asax, so that everytime server encounters an error, I will be notified by email. Now, my web site is up and running. However, EVERY TIME I update the "default.aspx" by...
5
by: Bob N | last post by:
I have an ASP.NET web page -- several auto-post back DropDownLists that perform a query against a relatively large database (3 to 4 seconds delay) that repopulate a couple of datagrids, comboboxes...
11
by: designkitt | last post by:
Hello, I am having a problem aligning a cell in a table and have tried everything I can think of to correct this without any luck: It appears that the white area, which is an image in the background...
8
by: Brendon Bezuidenhout | last post by:
Hey all, Newbie question I'm afraid: Is there a way to see/tell how many users are currently logged into a website at all? Thanks Brendon
8
by: Dhananjay | last post by:
hello everyone Do you have any information how to generate a tool using .net which is used to translate the web page contents to html format. Plz reply me asap Thanks in advance Dhananjay
6
by: ddeme | last post by:
Can u please tell me how can i get keywords by which user is visiting my site. I read some where by using Request.ServerVariables we can get keywords. But not sure how can i do that... please help...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.