Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Users Online, Looking for the best counter script
dylan2xs
post Nov 23 2006, 01:10 AM
Post #1


Newbie [Level 1]
*

Group: Members
Posts: 20
Joined: 19-November 06
Member No.: 33,668



Hi people, I am wondering If do you know a good "users online" I know many remote hosted services for this but I am looking for a counter script to install in my own website, If possible a counter that displays my visitors information , like country or an image(flag) links where they come from etc. something like this: Webpage I would SO appreciate any help! because I want to give to my site a more professional and international look cool.gif
Go to the top of the page
 
+Quote Post
tractor
post Nov 23 2006, 06:51 AM
Post #2


Premium Member
********

Group: Members
Posts: 182
Joined: 28-September 06
Member No.: 30,705



I don't know of any. Maybe look at the source of that website? I really like the idea and if somone knows the answer i might use it too.
Go to the top of the page
 
+Quote Post
hts
post Nov 23 2006, 02:35 PM
Post #3


Advanced Member
*******

Group: Members
Posts: 138
Joined: 30-September 06
From: Iasi, Romania
Member No.: 30,851



check out http://bbclone.de
it`a free counter with quite complex statistics smile.gif..just read on the site for details..
Go to the top of the page
 
+Quote Post
dylan2xs
post Nov 26 2006, 04:55 AM
Post #4


Newbie [Level 1]
*

Group: Members
Posts: 20
Joined: 19-November 06
Member No.: 33,668



QUOTE(tractor @ Nov 23 2006, 06:51 AM) *

I don't know of any. Maybe look at the source of that website? I really like the idea and if somone knows the answer i might use it too.

Unfortunately it's a remote hosted script, so looking the sourse of that web doesn't help much.. but I think they are making some changes to the counter and the map ..I prefered the previous version but they are using flash now... and some features have just gone.. sad.gif or not working correctly ..at least not in my website

This post has been edited by dylan2xs: Nov 26 2006, 04:57 AM
Go to the top of the page
 
+Quote Post
Saint_Michael
post Dec 4 2006, 09:48 AM
Post #5


$p4m 0n j00 $h4m3 m3 0nc3 $p4m 0n m3 $h4m3 m3 7\/\/1c3
*********************

Group: [HOSTED]
Posts: 6,069
Joined: 21-September 04
From: 9r33|\| 399$ 4|\|D 5P4/\/\
Member No.: 1,218
T17 GFX Crew



Here are some useful counter scripts they are easy to put together.

Basic Users online counter
CODE

<?
$remote = $_SERVER["REMOTE_ADDR"];
$file = "usersonline.txt";
$timeoutseconds = 60; //Tells how long the user is considered "on line"
$timestamp = time();
$timeout = ($timestamp-$timeoutseconds);
$fp = fopen("$file", "a+");
$write = $remote."||".$timestamp."\n";
fwrite($fp, $write);
fclose($fp);
$online_array = array();
$file_array = file($file);
foreach($file_array as $newdata){
list($ip, $time) = explode("||", $newdata);
if($time >= $timeout){
array_push($online_array, $ip);
}
}
$online_array = array_unique($online_array);
$online = count($online_array);
if($online == "1"){
echo "Users Online: $online";
}else{
echo "Users Online: $online";
}
?>


Display IP number

CODE

<?php echo $_SERVER["REMOTE_ADDR"]; ?>


Display browser
CODE

<?php echo $_SERVER["HTTP_USER_AGENT"]; ?>


To display a users time when they go to a website you can use one of these set ups.

CODE

<?php
$today0 = date('D F d Y g:i a');                // Wed May 07 2003 1:21 am
$today1 = date('F j, Y, g:i a');                 // March 10, 2001, 5:16 pm
$today2 = date('m.d.y');                         // 03.10.01
$today3 = date('j, n, Y');                       // 10, 3, 2001
$today4 = date('Ymd');                           // 20010310
$today5 = date('h-i-s, j-m-y, it is w Day z');  // 05-16-17, 10-03-01, 1631 1618 6 Fripm01
$today6 = date('\i\t \i\s \t\h\e jS \d\a\y.');   // It is the 10th day.
$today7 = date('D M j G:i:s T Y');               // Sat Mar 10 15:16:08 MST 2001
$today8 = date('H:m:s \m \i\s\ \m\o\n\t\h');     // 17:03:17 m is month
$today9 = date('H:i:s');                         // 17:16:17
echo "

$today1<BR>
$today2<BR>
$today3<BR>
$today4<BR>
$today5<BR>
$today6<BR>
$today7<BR>
$today8<BR>
$today9";
?>  


good place to check out some scripts are at pixel2life.com to get a good idea how to set them up and what not.
Go to the top of the page
 
+Quote Post
tajemranks
post Jan 22 2007, 02:32 AM
Post #6


Newbie [Level 1]
*

Group: Members
Posts: 15
Joined: 20-January 07
Member No.: 37,526



wow...its good add on for my site script...
thanks for share..
Go to the top of the page
 
+Quote Post
Trap FeedBacker
post Mar 29 2008, 11:55 PM
Post #7


Guest Feedbacks
***************

Group: Members
Posts: 2,360
Joined: 21-September 07
Member No.: 50,369



Replying to Saint_Michael

How do I use that script

-reply by marlon
Go to the top of the page
 
+Quote Post
sinisteredd
post Apr 3 2008, 09:52 AM
Post #8


Newbie [Level 1]
*

Group: [HOSTED]
Posts: 14
Joined: 3-April 08
From: Netherlands
Member No.: 60,293



I had the same problem as you, so i will share this script with you.
It works great, so i hope you like it.

In phpMyAdmin, click on your database then click on SQL at the top. Type this(see code below) in the box and click 'Go':
CODE
CREATE TABLE `useronline` (

  `timestamp` int(15) NOT NULL default '0',

  `ip` varchar(40) NOT NULL default '',

  `file` varchar(100) NOT NULL default '',

  PRIMARY KEY  (`timestamp`),

  KEY `ip` (`ip`),

  KEY `file` (`file`)

)

Now just copy this code where you want the stats to appear:
*you could also save this as: online_users.php (or any name you want) and use: <?php include 'online_users.php'; ?> on the
place you want the stat to appear*.
CODE
<?php
//online users

$server = "YOUR HOST"; // usually localhost

$db_user = "USERNAME";

$db_pass = "PASSWORD";

$database = "DATABASE";

$timeoutseconds = 300; // length of gaps in the count

//get time

$timestamp = time();

$timeout = $timestamp-$timeoutseconds;

//connect to database

mysql_connect($server, $db_user, $db_pass);

//insert the values

$insert = mysql_db_query($database, "INSERT INTO useronline VALUES

('$timestamp','$REMOTE_ADDR','$PHP_SELF')");

if(!($insert)) {

     print "";

}

//delete values when they leave

$delete = mysql_db_query($database, "DELETE FROM useronline WHERE timestamp<$timeout");

if(!($delete)) {

    print "";

}

//grab the results

$result = mysql_db_query($database, "SELECT DISTINCT ip FROM useronline WHERE file='$PHP_SELF'");

if(!($result)) {

    print "";

}

//number of rows = the number of people online

$user = mysql_num_rows($result);

if(!($user)) {

print("ERROR: " . mysql_error() . "\n");

}

//spit out the results

mysql_close();

print("$user");

?>


I hope this is what you where looking for.

Good luck
Go to the top of the page
 
+Quote Post
oestergaard
post Apr 10 2008, 05:22 PM
Post #9


Newbie [Level 3]
***

Group: Members
Posts: 44
Joined: 10-April 08
Member No.: 60,626



QUOTE(Saint_Michael @ Dec 4 2006, 09:48 AM) *
Here are some useful counter scripts they are easy to put together.

Basic Users online counter
CODE
<?
$remote = $_SERVER["REMOTE_ADDR"];
$file = "usersonline.txt";
$timeoutseconds = 60; //Tells how long the user is considered "on line"