Parašė Edvinas.· 2009 Rugs. 15 14:09:48
#13
<?php
$db_host = "localhost";
$db_user = "root";
$db_pass = "";
$db_name = "test";
$dbc = mysql_connect($db_host, $db_user, $db_pass);
$dbs = mysql_select_db($db_name);
$tm = time();
$timeout = $tm - (30*60);
if($_SERVER["REMOTE_ADDR"]){$ip=$_SERVER["REMOTE_ADDR"];}
else{$ip=$_SERVER["HTTP_X_FORWARDED_FOR"];}
$brws = explode("(",$_SERVER["HTTP_USER_AGENT"]);
$browser = $brws[0];
mysql_query("DELETE FROM guest WHERE actvtime <'".$timeout."'");
mysql_query("INSERT INTO guest SET time='".$tm."', ip='".$ip."', browser='".$browser."'");
$count = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM guest"));
mysql_close();
echo "<br/><a href=\"online.php\">Users Online($count[0])</a><br/>";
?>
Paziurek jeigu veike ;]]
Redagavo Edvinas.· 2009 Rugs. 15 14:09:20