PHP gevorderde |
|
Hallo,
dit script telt het aantal bezoekers dat omline is, doormiddelvan sessie. Maar
$user =mysql_num_rows($result); komt niet hoger als 1, wat is er mis?
<?PHP
$timeoutseconds = 600; // tijd hoelang iemand op je pagina zit in seconds
$timestamp=time();
$timeout=$timestamp-$timeoutseconds;
mysql_connect($server, $db_user, $db_pass) or die ("Useronline Database CONNECT Error");
mysql_db_query($database, "INSERT INTO useronline VALUES ('$timestamp','$REMOTE_ADDR','$PHP_SELF')") or die("Useronline Database INSERT Error");
mysql_db_query($database, "DELETE FROM useronline WHERE timestamp<$timeout") or die("Useronline Database DELETE Error");
$result=mysql_db_query($database, "SELECT DISTINCT ip FROM useronline WHERE file='$PHP_SELF'") or die("Useronline Database SELECT Error");
$user =mysql_num_rows($result);
mysql_close();
?>
<?PHP $timeoutseconds = 600; // tijd hoelang iemand op je pagina zit in seconds $timeout=$timestamp-$timeoutseconds; mysql_connect($server, $db_user, $db_pass) or die ("Useronline Database CONNECT Error"); mysql_db_query($database, "INSERT INTO useronline VALUES ('$timestamp','$REMOTE_ADDR','$PHP_SELF')") or die("Useronline Database INSERT Error"); mysql_db_query($database, "DELETE FROM useronline WHERE timestamp<$timeout") or die("Useronline Database DELETE Error"); $result=mysql_db_query($database, "SELECT DISTINCT ip FROM useronline WHERE file='$PHP_SELF'") or die("Useronline Database SELECT Error"); ?>
|