Файл: vsime.com/system/functions/duel_info.php
Строк: 88
<?
function duel_info ($duel_id)
{
global $user, $dbi, $config, $time;
$duel = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `duels` WHERE `id` = '$duel_id'"));
if (@$duel['id'])
{
$duel_pollen = array();
$duel_pollen['pollen_user_m'] = mysqli_result("SELECT COUNT(*) FROM `duels_pollen` INNER JOIN `anketa` ON `duels_pollen`.`id_user` = `anketa`.`id_user` WHERE `duels_pollen`.`id_duel` = '$duel[id]' AND `duels_pollen`.`man` = '1' AND `anketa`.`pol` = '1'");
$duel_pollen['pollen_user_w'] = mysqli_result("SELECT COUNT(*) FROM `duels_pollen` INNER JOIN `anketa` ON `duels_pollen`.`id_user` = `anketa`.`id_user` WHERE `duels_pollen`.`id_duel` = '$duel[id]' AND `duels_pollen`.`man` = '1' AND `anketa`.`pol` = '0'");
$duel_pollen['pollen_ank_m'] = mysqli_result("SELECT COUNT(*) FROM `duels_pollen` INNER JOIN `anketa` ON `duels_pollen`.`id_user` = `anketa`.`id_user` WHERE `duels_pollen`.`id_duel` = '$duel[id]' AND `duels_pollen`.`man` = '2' AND `anketa`.`pol` = '1'");
$duel_pollen['pollen_ank_w'] = mysqli_result("SELECT COUNT(*) FROM `duels_pollen` INNER JOIN `anketa` ON `duels_pollen`.`id_user` = `anketa`.`id_user` WHERE `duels_pollen`.`id_duel` = '$duel[id]' AND `duels_pollen`.`man` = '2' AND `anketa`.`pol` = '0'");
$duel_pollen['pollen_user'] = $duel_pollen['pollen_user_m'] + $duel_pollen['pollen_user_w'];
$duel_pollen['pollen_ank'] = $duel_pollen['pollen_ank_m'] + $duel_pollen['pollen_ank_w'];
$duel_pollen['pollen_all'] = $duel_pollen['pollen_user_m'] + $duel_pollen['pollen_user_w'] + $duel_pollen['pollen_ank_m'] + $duel_pollen['pollen_ank_w'];
$duel_pollen['pollen'] = mysqli_result("SELECT COUNT(*) FROM `duels_pollen` WHERE `id_user` = '$user[id]' AND `id_duel` = '$duel[id]'");
if ($duel['winer']!=0 || $duel['winer']=='draw')$duel_pollen['active'] = false; else $duel_pollen['active'] = true;
if (!$duel_pollen['active'])$duel_pollen['pollen'] = 1;
return $duel_pollen;
} else return false;
}
?>