Se her
<----------- user_online.php ------------>
/*
Downloade hos:
www.phpuniverset.dk*/
<?php
print \'<font face=\"helvetica\" size=\"2\" color=\"#000000\">\';
$mysql_host = \"\";
$mysql_db = \"\";
$mysql_user = \"\";
$mysql_password = \"\";
$ip = $REMOTE_ADDR;
mysql_connect($mysql_host,$mysql_user,$mysql_password);
mysql_select_db(\"$mysql_db\");
$time = explode(\" \",microtime());
$array1 = $time[0];
$array2 = $time[1];
$r = mysql_fetch_row( mysql_query(\"SELECT * FROM online_users WHERE ip like \'$ip\'\"));
if ($r == (false)) {
mysql_query(\"INSERT INTO online_users (id,ip,name,date) values (\'\',\'$ip\',\'\',\'$array2\')\");
}
mysql_query(\"DELETE FROM online_users where date < $array2 - 400\");
$res = mysql_query(\"SELECT * FROM online_users\");
$tal = mysql_num_rows($res);
if ($tal == \"1\") {
print \"1 bruger online \";
}
else {
print $tal;
print \" brugere online\";
}
?>
<----------------- MYSQL filen ---------------->
CREATE TABLE online_users (
id tinyint(80) NOT NULL auto_increment,
ip varchar(80),
name varchar(80),
date varchar(80),
PRIMARY KEY (id)
);
<--------------- SLUT --------------->
Sådan?