Log in

View Full Version : users online



afe
03-01-2008, 12:57 AM
Does anyone know where I could get a users online script, where it shows the number of visitors surfing the site.

Thanks!!

Nile
03-02-2008, 12:50 AM
I could make one if you would like.
But I would need to know if you wanna use files, or databases.

afe
03-02-2008, 06:40 PM
Which one is better? I'll use the one that's better.

Thanks a lot!

Jas
03-03-2008, 04:05 AM
A database would be waaaay better and easier (or so I think), and you could branch off into other features using it.

afe
03-03-2008, 04:22 AM
Ohh cool, do you know where I could get one?

Thanks!

Jas
03-03-2008, 09:10 PM
Why not build it yourself? It would help you become a better coder. :)
http://www.combined-minds.net/tutorials/18/Number_of_visitors_online_system_in_PHP
It does take some time to get it right, but be patient. You'll be happy and better off when you finally get it.

afe
03-03-2008, 09:26 PM
Thanks!

afe
03-03-2008, 09:30 PM
Ok, I'm already stuck, lol. It says "First we need a way to store the visitor information. The most fast way is a simple MySQL table, so lets create a new table." So where do I create a table? PHPMyAdmin? I can't seem to see anything that says "Create a new table".

Jas
03-03-2008, 09:52 PM
Create a DB in phpmyadmin and then create the table in it. Use the query tab in phpmyadmin.

afesports
03-03-2008, 09:57 PM
Ok, now I get "Error
SQL query:

1CREATE TABLE c_online(

2time bigint( 20 ) NOT NULL default '0', 3ip varchar( 20 ) NOT NULL default ''4
)

MySQL said:

#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '1CREATE TABLE c_online (
2 time bigint(20) NOT NULL default ' " after entering that code...

xLostSoulx
03-03-2008, 10:05 PM
Well, for one, remove the numbers infront of create and time. Second, remove the numbers beside ip and ".

Basically, the numbers go from 1 to 4, remove them and it will probably worked. Unless you put those numbers there yourself.


Also, don't just copy and paste try actually writing the code, yes you'll probably get errors, but it's better than removing the numbers from your code, as you cannot copy and paste without the numbers.

afesports
03-03-2008, 10:06 PM
Thanks, I forgot to remove them.

afesports
03-03-2008, 10:22 PM
Ok, what is the "root" that is stated.

1<?php
2
3$db=mysql_connect("localhost","root","pass") or die(mysql_error());
4mysql_select_db("test_db",$db);
5
6?>

xLostSoulx
03-03-2008, 11:22 PM
Change root to your MySQL database username.