$book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
$us=mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
$magic=mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
$mag_def="`type` = '203'";
$md_arr=array("204","205",
"206","207","208",
"209","210","211",
"212","213","214");
foreach($md_arras$mdi)
$mag_def.=" OR `type` = '".$mdi."'";
$effect=mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на себя заклятие </font></b>'.$log_text.' <BR>');