05-25-2000, 02:45 AM
Hi,
i've found a nice little script what displays active users by logging the ip into a mySQL-Database - take a look:
<?
/////////////////////////
// Online - User //
/////////////////////////
$IP=$REMOTE_ADDR;
$HOST= gethostbyaddr($IP);
$time= explode( " ", microtime());
$userusec= (double)$time[0];
$usersec= (double)$time[1];
$database= "userlog";
$table= "userlog";
$sqlhost= "localhost";
$sqluser= "root";
$sqlpass= "";
mysql_connect($sqlhost,$sqluser,$sqlpass) OR DIE( "Couldn't connect to MySQL server!");
mysql_select_db($database) OR DIE( "Couldn't select database!");
$deleteuser= mysql_query( "delete from userlog where DATE < $usersec -300");
$userlog= mysql_fetch_row(MYSQL_QUERY( "SELECT * FROM userlog where IP like '$IP'"));
$User_ID=md5(str_replace(".","",$REMOTE_ADDR) + mt_rand(10000,999999));
if($userlog == false)
{
$ok= @mysql_query( "insert INTO userlog (ID,IP,NAME,DATE) VALUES('$User_Id','$IP','$HOST','$usersec')")or die( "Unable to query db!");
}
$resultlogtab = mysql_query( "SELECT Count(*) as total FROM userlog");
$numberlogtab = mysql_fetch_array($resultlogtab);
print "<b><p align=\"left\"><font size=\"2\" face=\"Verdana\" color=\"#000000\">$numberlogtab[total] User online!</font></p></b>";
?>
Would be nice if we could add this in the area of $fivelinks and using the same database as vB ... what do you think?
i've found a nice little script what displays active users by logging the ip into a mySQL-Database - take a look:
<?
/////////////////////////
// Online - User //
/////////////////////////
$IP=$REMOTE_ADDR;
$HOST= gethostbyaddr($IP);
$time= explode( " ", microtime());
$userusec= (double)$time[0];
$usersec= (double)$time[1];
$database= "userlog";
$table= "userlog";
$sqlhost= "localhost";
$sqluser= "root";
$sqlpass= "";
mysql_connect($sqlhost,$sqluser,$sqlpass) OR DIE( "Couldn't connect to MySQL server!");
mysql_select_db($database) OR DIE( "Couldn't select database!");
$deleteuser= mysql_query( "delete from userlog where DATE < $usersec -300");
$userlog= mysql_fetch_row(MYSQL_QUERY( "SELECT * FROM userlog where IP like '$IP'"));
$User_ID=md5(str_replace(".","",$REMOTE_ADDR) + mt_rand(10000,999999));
if($userlog == false)
{
$ok= @mysql_query( "insert INTO userlog (ID,IP,NAME,DATE) VALUES('$User_Id','$IP','$HOST','$usersec')")or die( "Unable to query db!");
}
$resultlogtab = mysql_query( "SELECT Count(*) as total FROM userlog");
$numberlogtab = mysql_fetch_array($resultlogtab);
print "<b><p align=\"left\"><font size=\"2\" face=\"Verdana\" color=\"#000000\">$numberlogtab[total] User online!</font></p></b>";
?>
Would be nice if we could add this in the area of $fivelinks and using the same database as vB ... what do you think?