View file system/online.php

File size: 1.34Kb
<?php
/*
------------------------------
##############################
-       Загруз Центр         -
-         by Kemel           -
##############################
------------------------------
*/
defined('Loads') or die('Error!');
$time = time() - 300; //5 мин
$db -> query("DELETE FROM `online` WHERE `time` < '".$time."'");	//удаляем из онлайна
if ($aut) {
$sql = $db -> query("SELECT `login` FROM `online` WHERE `login` = '".$ya['login']."' LIMIT 1");
if ($sql -> num_rows > 0) {
$db -> query("UPDATE `online` SET `session` = '".SID."', `ip` = '".$ip."', `browser` = '".$browser."', `time` = '".time()."' WHERE `login` = '".$ya['login']."' LIMIT 1");
} else {
$db -> query("DELETE FROM `online` WHERE `session` = '".SID."'");
$db -> query("INSERT INTO `online` SET `login` = '".$ya['login']."', `session` = '".SID."',`ip` = '".$ip."', `browser` = '".$browser."', `time` = '".time()."'");
}
} else {
$sql = $db -> query("SELECT `ip` FROM `online` WHERE `session` = '".SID."' LIMIT 1");
if ($sql -> num_rows > 0) {
$db -> query("UPDATE `online` SET `ip` = '".$ip."',`browser` = '".$browser."', `time` = '".time()."' WHERE `session` = '".SID."' LIMIT 1");
} else {
$db -> query("INSERT INTO `online` SET `session` = '".SID."',`ip` = '".$ip."', `browser` = '".$browser."', `time` = '".time()."'");
}
}
unset($sql);
?>