473,804 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Count visitors on my website

Hi I've seen this a few places - The site lists off the number of
people (not logged in) currently browsing the site. How can I do this
with php / mySQL please?

Jul 13 '07
32 4286
..oO(noidtluom)
>Well, I was simply trying to give a practical solution that can be
used. I myself have never done this sort of thing, but off the top of
my head that is what I'll do. Anyway, I'm certain people have made
script about this sort of thing. Just google one up and see how they
did it. Or you can look into scripts such as PHPBB or IPB.
Why should I? I know that such scripts exist, but I also know that they
can never be accurate. Period.

It's like all these amateurish scripts that try to prevent website users
from clicking the right mouse button - there are tons of them available,
but not a single one will ever work, simply because it's impossible (not
to mention the usability problems in this particular case).

EOD for me
Micha
Jul 16 '07 #31
At the risk of exposing myself to this flamefest:

Let's redefine the problem a bit: If one wanted to broadcast some
number that has some tenuous tie to reality, and the purpose of that
number was to to be a cool marketing thing that give some fuzzy
indicator of the popularity of a website, one could code a solution.
I would go about it like this: send a cookie and log pageloads
associated with that cookie. Calculate some number based on the
number of browsers (cookies) that have loaded pages in the last x
time. If you wanted to make it a little more tightly tied to reality,
you could even look at the the distributions of visit per cookie over
time, so see how many page loads are generally associated with a
cookie for a short period of time, and refine your x time
accordingly. Is this the same as "currently online"? No. Do some
people think a number a like this is nifty? Yes. If one required
users to be logged in (say, in a bulletin board system) one could very
easily and truthfully broadcast a number that says "currently logged
in users". Also, just a nifty little number and some people think is
cool.
Best Regards,
Aerik

Jul 16 '07 #32
<comp.lang.ph p>
<Michael Fesser>
<Mon, 16 Jul 2007 05:35:39 +0200>
<nf************ *************** *****@4ax.com>
Using the IP to "identify" a user is even more unreliable than anything
else
Not everybody is looking 100% accuracy .

$klock being set a value in the config file .
<?php

$rambo=$_SERVER['REMOTE_ADDR']; $rambo=str_repl ace(".","_",$ra mbo);

$demo=$_SERVER['HTTP_USER_AGEN T']; $wsx=strtolower ($demo); $witt="zz";

$qaz=strpos($ws x,"windows"); if ($qaz==true) {$witt="ie";}
$qaz=strpos($ws x,"firefox"); if ($qaz==true) {$witt="ff";}
$qaz=strpos($ws x,"safari"); if ($qaz==true) {$witt="sf";}
$qaz=strpos($ws x,"opera"); if ($qaz==true) {$witt="op";}
$qaz=strpos($ws x,"mac"); if ($qaz==true) {$witt="mc";}

$wsx=$rambo . "_" . $witt; $rambo=$wsx;

$wsx=time()+$kl ock;

$filenamecu="de mo/$rambo.php"; $fpcu=fopen($fi lenamecu,"w");
fwrite ($fpcu,$rambo); fwrite ($fpcu,"\n");
fwrite ($fpcu,$wsx); fwrite ($fpcu,"\n");
fclose ($fpcu);

?>
Jul 21 '07 #33

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
2185
by: deko | last post by:
Below are the contents file that has the IP address and time of visit of visitors to a website. 68.122.69.241|1089822686 68.122.69.241|1089823630 68.122.69.241|1089823638
5
3629
by: cc | last post by:
From the popular website At this link: http://www.w3schools.com/asp/asp_globalasa.asp I got this code, but it does not work on my server... I can open three IE browsers and watch the count go to three. Upon closing two, each having separate sessions (and session ID's of course), the count remains at three! I'm not looking for alternative ways of doing this: I'm interested in knowing why the application variable does not get reduced...
0
3231
by: lkrubner | last post by:
The idea I'm trying to get at is that I want the tag info for the tag "photography", and I want the date, and I want a count of any comments a tag may have. This following query gets back all the info I want, provided the tag has at least one comment. If It doesn't have any comments, it doesn't show up in the return. But if it has a count of zero, I just want it to come back with a count of zero, I don't want it to disappear from the...
1
2340
by: drexcol | last post by:
I am a php newbie and am trying to write a script that will direct visitors to specific pages on my website based on which of several url’s they have entered (all are aliases of the main website). While all visitosr will be directed to the same website, I want them to start at specific pages based on their interests, rather than having to drill down from various menus. For example, let us call the main doman abc.com. I have the following...
0
1612
by: ashutoshkataruka | last post by:
Is your website getting very less no. of visitors .If so, then post your website to http://goodtolove.com to get unlimited visitors for lifetime...No need to pay a penny.
6
1444
by: tenxian | last post by:
It is said as for code, developing a website that can stand 10,000 concurrent visitors is much different from developing a website that can stand 1,000 concurrent visitors, is it true?
1
3070
by: dez5000 | last post by:
I'm trying to get a report by location that would list the number of visits to the location for the month but also count the number of unique visitors to that location. I have a table of data with Location, VisitorId, and DateOfVisit. I then have a query to filter by a single month and then base my report on that query. In my report I have a group header for the location and I can do a count of the VistorId or DateOfVisit fields to get a...
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10354
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10359
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9177
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7643
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6870
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4314
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3005
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.