View file techno/files/guest.php

File size: 755B
<?php
defined('PROTECTOR') or die('Error: restricted access');

$laikas = 150;
$dabar = time();
$timeout = $dabar - $laikas;
$brauser=htmlspecialchars(stripslashes($_SERVER['HTTP_USER_AGENT']));
$ip=htmlspecialchars(stripslashes($_SERVER['REMOTE_ADDR']));
$brauser = strtok( $brauser , '/' );

mysql_query("DELETE FROM `guest` WHERE `laikas`<$timeout");
$ar_yra = mysql_num_rows(mysql_query("SELECT `ip` FROM `guest` WHERE `ip` = '$ip' and `brauser` = '$brauser' LIMIT 1"));
if ($ar_yra == '0')
{
mysql_query("INSERT INTO `guest` SET `ip` = '$ip', `laikas` = '$dabar',`brauser` = '$brauser'");
}
elseif($ar_yra > '0')
{
mysql_query("UPDATE `guest` SET `laikas` = '$dabar' WHERE `ip` = '$ip' and `brauser` = '$brauser' LIMIT 1");
}
?>