<?php
defined('PROTECTOR') OR die('Error: restricted access');
$set = mysql_fetch_assoc(mysql_query("SELECT * FROM `set` WHERE `usr` = '$log' LIMIT 1"));
$time = time();
if($set['vip']=='on' AND $time>=$set['viptime']){
mysql_query("UPDATE `set` SET `vip` = 'off' WHERE `usr` = '$log' LIMIT 1");
$time = date("H:i d.m.y");
$text = "Закончилось время vip-аккаунта";
mysql_query("INSERT INTO `msg_r` SET `user_from` = 'Журнал', `user_to` = '$log', `time` = '$time', `read` = 1, `mail_msg` = '$text'");
}

if($time>=$set['artime'] AND $set['arenainv']==0 AND $set['razb']>0){
mysql_query("UPDATE `set` SET `arenainv` = '$set[invmax]', `artime` = '0'  WHERE `usr` = '$log'");
$time = date("H:i d.m.y");
$text = "Бои в лиге восстановлены!";
mysql_query("INSERT INTO `msg_r` SET `user_from` = 'Журнал', `user_to` = '$log', `time` = '$time', `read` = 1, `mail_msg` = '$text'");
}
?>