Gadgy
07-11-2002, 02:04 PM
I am looking for aa admin script that shows in real-time the visitors that are on apache, as in thier IP or connection details. This must also be viewable from a browser so the standard implementation would be perl?
Can anyone help? Do you use a script like this or know where to get one?
Thankyou.
admin0
07-11-2002, 02:22 PM
on the same topic
can anyone also suggest perhaps via php to show something like:
visitors online:
:homer:
viGeek
07-11-2002, 02:53 PM
MRTG, You can view how many 'open connections' their are.
The Prohacker
07-11-2002, 04:39 PM
Originally posted by admin0
on the same topic
can anyone also suggest perhaps via php to show something like:
visitors online:
:homer:
<?php
/*
Create MySQL Table...
#
# Table structure for table 'useronline'
#
CREATE TABLE useronline (
timestamp int(15) DEFAULT '0' NOT NULL,
ip varchar(40) NOT NULL,
file varchar(100) NOT NULL,
PRIMARY KEY (timestamp),
KEY ip (ip),
KEY file (file)
);
Create Script...
*/
$server = "localhost";
$db_user = "username";
$db_pass = "pass";
$database = "dbname";
$timeoutseconds = 300;
$timestamp = time();
$timeout = $timestamp-$timeoutseconds;
mysql_connect($server, $db_user, $db_pass);
$insert = mysql_db_query($database, "INSERT INTO useronline VALUES ('$timestamp','$REMOTE_ADDR','$PHP_SELF')");
if(!($insert)) {
print "Useronline Insert Failed > ";
}
$delete = mysql_db_query($database, "DELETE FROM useronline WHERE timestamp<$timeout");
if(!($delete)) {
print "Useronline Delete Failed > ";
}
$result = mysql_db_query($database, "SELECT DISTINCT ip FROM useronline WHERE file='$PHP_SELF'");
if(!($result)) {
print "Useronline Select Error > ";
}
$user = mysql_num_rows($result);
mysql_close();
if($user == 1) {
print("<b>$user</b> user online\n");
} else {
print("<b>$user</b> users online\n");
}
?>
Should be pretty self explanitory :D
The Prohacker
07-11-2002, 04:41 PM
Originally posted by Gadgy
I am looking for aa admin script that shows in real-time the visitors that are on apache, as in thier IP or connection details. This must also be viewable from a browser so the standard implementation would be perl?
Can anyone help? Do you use a script like this or know where to get one?
Thankyou.
http://www.phpee.com
But might be a bit more than you need though...
Gadgy
07-11-2002, 05:17 PM
Prohacker, thanks for the link, that looks like a real good peice of work, not what I was after but I am going to try it anyway because it looks good.
If I do find a good perl script I will post it.
Thanks for your replies.
:D
driverdave
07-11-2002, 07:54 PM
Just turn on server status in httpd.conf and you can view all connections, PIDS and script names in realtime via the apache scoreboard. It's built into apache.
apache.org for more info.
Gadgy
07-11-2002, 09:55 PM
WOW! thats exactly what I was after,
many thanks,
:D