PDA

View Full Version : Wondering..


Felix
8th March 2003, 16:25
Anyone know how to have a "users online" thing for a website. Such as, "There are 14 users online." PM me or post here if you know.

Machiko
8th March 2003, 16:41
I think thats only with message boards. PHP and MySQL.
in the MySQL console youd enter something like:

create database siteStats;
use siteStats;

create table usersOnline

id int auto_increment not null,
userip varchar(20) not null,
dateadded timestamp,
primary key(id),
unique id(id)
);

i think, wooolf will correct me if i'm wrong i'm sure heh then you gotta make a PHP script

Felix
8th March 2003, 16:42
Lol, ok. Im sure woooLF will correct you if its the case.

Machiko
8th March 2003, 16:47
i had a forum awhile back but that MySQL i'm pretty sure is correct cuz the Gaming clan I'm in now, I was setting some stuff up kinda better then what we have now (hope the don't read this, it's a suprise but we need a better host) but ya it works... i don't remember off hand exactly, think its close. I forgot something maybe small there.

Felix
8th March 2003, 16:58
Ok, I not looking for a forum, but Im just looking for something that says how many people are online.

Machiko
8th March 2003, 17:03
i dont know if theres a "there is 13 users browsing your Webpage" option. might be a javascript for that but why don't you just add a counter to your page and tie it to some hits demographic thing? Like you have say 4 sections on your webpage. 1. Games 2. About me 3. pics of naked and 4. Links. Then you got a page set that shows how many users hit the naked pictures link over the about me one , you know just a wide comparison of what parts people check out more often then others. Someone I knew when I had my page, did that for me for eahc of my pictures I had up. So I saw certain pictures were getting viewed tons more then others. Just a simple javascript i think. Do searches for the stuff i'm talking about here on google. I'm sure things will come up for you.

Felix
8th March 2003, 17:08
Lol, I know. I was thinking about that. But I also want to know how many people visit it at a time. I guess its just a qualm or whatever.

Machiko
8th March 2003, 17:16
actually check this Users Online PerlScript (http://www.perlonline.com/usersonline/)

sign up as a member then download it.

gotta buy it here real cheap too
users online (http://www.widexl.com/scripts/visitors-online/index.html)


or do a search for something similar but freeware. i'm sure someone put it out for free somewhere.

Machiko
8th March 2003, 17:21
here try this one its shareware -
I think it's exactly what you want.

Display a text count of visitors to your web pages. Includes: zero padding, file locking, linking the count, displaying begin date and counting multiple pages

Felix
8th March 2003, 19:15
Thanks, Im looking at it now.

dhm44
18th March 2003, 01:00
php --> .txt file is much more suitable for this sort of simple thing, and doesnt require a DB (although less secure).

Its easy to count the hits your getting, but harder to subtract the value of how many people are leaving the site ( if you know what i mean) there are several solutions:

- using a timeout of the user, like 500 seconds. every time the page is accessed, if a particular user joined the site 500 seconds ago, his/her data would be removed (theres also an MySQL function to do this automatically :))

- using session variables

- using a Javascript - when the browser goes somewhere else, like off your site, it initiates a popup which tells the php file to decrease the number by one. this isnt foolproof, however, and some browsers dont support this.

- using a socket server (my favorite option if you have a friendly site provider / your site on your own PC) - use client side flash (like moock.org) or java to connect to a server, with realtime connections. Obviously allows for much more than just a counter, but a little excessive for what your doing.

on second thoughts, it may be better to use a DB, if its fast and reliable, with php. I made one for my old site which used Flash client side, and logged the ip, hosts of each user per day (the visitors to the site could also view this). it could also send small messages along the top of the screen, which was cool. ill dig it out if your interested. it used php/mysql