Файл: moduls/duel/myduels.php
Строк: 144
<?
/**
* @package Prime Social
* @link http://primesocial.ru
* @copyright Copyright (C) 2016 Prime Social
* @author BoB | http://primesocial.ru/about
*/
require_once('../../core/start.php');
include_once 'inc.php';
check_auth();
head('Mening duelim');
include_once 'inc.php';
if (isset($_GET['yes'])) {
$yes = intval($_GET['yes']);
if (empty($_GET['yes'])) {
$err = 'Bo`sh ID!';
}
$a = mysql_fetch_array(mysql_query("SELECT * FROM `duel` WHERE `id` = $yes LIMIT 1"));
if (empty($a)) {
$err = 'Bunday duel yo`q';
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `duel` WHERE (`opponent`='$a[opponent]' OR `user`='$a[opponent]') AND `act`='1'"),0) == TRUE) {
$err = 'Ushbu foydalanuvchi, hozir duelda ishtrok etyapti';
} elseif (mysql_result(mysql_query("SELECT COUNT(*) FROM `duel` WHERE (`opponent`='$a[user]' OR `user`='$a[user]') AND `act`='1'"),0) == TRUE) {
$err='Ushbu foydalanuvchi, hozir duelda ishtrok etyapti';
} elseif (mysql_result(mysql_query("SELECT COUNT(*) FROM `duel` WHERE (`opponent`='$user[user_id]' OR `user`='$user[user_id]') AND `act`='1'"),0) == TRUE){
$err='Siz duelda ishtrok etyapsiz, duel tugashini kuting';
}
if (!empty($err)) {
echo DIV_ERROR . $err . CLOSE_DIV;
} else {
$date = (3*60);
mysql_query("UPDATE `duel` SET `act`='1', `time`='".(time()+86400)."' WHERE `id`='".$yes."'");
$msg = "[b]$user[nick][/b] duelga chaqiruvningizni qabul qildi.";
$msg = '<a href="'.HOME.'/id'.$user['user_id'].'">'.$user['nick'].'</a> duelga chaqiruvningizni qabul qildi.';
lenta($msg, $a['user']);
echo DIV_MSG . 'Chaqiruv qabul qilindi' . CLOSE_DIV;
}
}
if (isset($_GET['noy'])) {
$noy = intval($_GET['noy']);
if (empty($_GET['yes'])) {
$err = 'Bo`sh ID!';
}
$a = mysql_fetch_array(mysql_query("SELECT * FROM `duel` WHERE `id` = $noy LIMIT 1"));
if (empty($a)) {
$err = 'Bunday duel yo`q';
} elseif (mysql_result(mysql_query("SELECT COUNT(*) FROM `duel` WHERE (`user`='$a[opponent]' OR `opponent`='$a[opponent]') AND `act`='1' LIMIT 1"),0) == TRUE) {
$err = 'Ushbu foydalanuvchi, hozir duelda ishtrok etyapti';
} elseif (mysql_result(mysql_query("SELECT COUNT(*) FROM `duel` WHERE (`user`='$user[user_id]' OR `opponent`='$user[user_id]') AND `act`='1' LIMIT 1"),0) == TRUE) {
$err = 'Siz duelda ishtrok etyapsiz, duel tugashini kuting';
}
if (!empty($err)) {
echo DIV_ERROR . $err . CLOSE_DIV;
} else {
mysql_query("DELETE FROM `duel` WHERE `opponent`='$user[user_id]' AND `id`='".$noy."' LIMIT 1");
$msg = '<a href="'.HOME.'/id'.$user['user_id'].'">'.$user['nick'].'</a> отклонил(a) Ваш вызов на дуэль.';
lenta($msg, $a['user']);
/* Bildirish qilish */
echo DIV_MSG . 'Chaqiruv qabul qilinmadi' . CLOSE_DIV;
}
}
$num = mysql_result(mysql_query("SELECT COUNT(*) FROM `duel` WHERE `act` = '1' AND (`opponent` = '$user[user_id]' OR `user` = '$user[user_id]')"),0);
if(!empty($num)) {
$post=mysql_fetch_array(mysql_query("SELECT * FROM `duel` WHERE `act` = '1' AND (`opponent` = '$user[user_id]' OR `user` = '$user[user_id]') LIMIT 1"));
$rand = rand(1000,9999);
if($post['rubric'] == 1) $cat = 'Kim chiroyli?';
if($post['rubric'] == 2) $cat = 'Kim kuchli?';
if($post['rubric'] == 3) $cat = 'Kim modni?';
if($post['rubric'] == 4) $cat = 'Kim yosh ko`rinadi?';
if($post['rubric'] == 5) $cat = 'Kim kulguli?';
if($post['rubric'] == 6) $cat = 'Kimning qaddi qomati chiroyli?';
if($post['rubric'] == 7) $cat = 'Kim jinni?';
if($post['rubric'] == 8) $cat = 'Kim glamurli?';
if($post['rubric'] == 9) $cat = 'Kim yoqimtoy?';
echo DIV_AUT;
echo 'Bo`lim: <b>'.$cat.'</b><br />';
echo CLOSE_DIV;
$us = mysql_fetch_array(mysql_query("SELECT * FROM ".USERS." WHERE `user_id` = '".$post['user']."' LIMIT 1"));
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `duel_vote` WHERE `id_duel` = '$post[id]'"),0);
$vote = mysql_result(mysql_query("SELECT COUNT(*) FROM `duel_vote` WHERE `id_duel` = '$post[id]' AND `id_opponent` = '$us[user_id]'"),0);
$man = mysql_result(mysql_query("SELECT COUNT(*) FROM `duel_vote` WHERE `id_duel` = '$post[id]' AND `id_opponent` = '$us[user_id]' AND `man` = '1'"),0);
$woman = mysql_result(mysql_query("SELECT COUNT(*) FROM `duel_vote` WHERE `id_duel` = '$post[id]' AND `id_opponent` = '$us[user_id]' AND `man` = '0'"),0);
echo DIV_AUT;
echo 'Ishtrokchi: <a href="'.HOME.'/id'.$us['user_id'].'">'.$us['nick'].'</a><br />';
echo (empty($us['photo']) ? '<img src="'.HOME.'/style/img/empty_photo.gif"/>' : '<a href="'.HOME.'/files/photo/'.$us['photo'].'"><img src="'.HOME.'/files/photo/mini_'.$us['photo'].'"/></a>');
echo '<br /><b>Ovozlar:</b> '.$vote.' ('.round($vote/$count*100,1).'%)<br />
Erkak: ('.round($man/$vote*100,1).'%) / Ayol: ('.round($woman/$vote*100,1).'%)<br />
<form action="'.HOME.'/duel/?'.rand(1,9999).'" method="post">
<input type="hidden" name="vote_user" value="'.$us['user_id'].'"/>
<input type="hidden" name="duel_id" value="'.$post['id'].'"/>
<input type="submit" name="golos" value="Ovoz berish"/></form>';
echo '<br /><a href="index.php?no='.$post['id'].'">Ovoz berolmayapman, boshqa duelga >></a><br /><br />';
$us2 = mysql_fetch_array(mysql_query("SELECT * FROM ".USERS." WHERE `user_id` = '".$post['opponent']."' LIMIT 1"));
$vote2=mysql_result(mysql_query("SELECT COUNT(*) FROM `duel_vote` WHERE `id_duel` = '$post[id]' AND `id_opponent` = '$us2[user_id]'"),0);
$man2=mysql_result(mysql_query("SELECT COUNT(*) FROM `duel_vote` WHERE `id_duel` = '$post[id]' AND `id_opponent` = '$us2[user_id]' AND `man` = '1'"),0);
$woman2=mysql_result(mysql_query("SELECT COUNT(*) FROM `duel_vote` WHERE `id_duel` = '$post[id]' AND `id_opponent` = '$us2[user_id]' AND `man` = '0'"),0);
echo 'Ishtrokchi: <a href="'.HOME.'/id'.$us2['user_id'].'">'.$us2['nick'].'</a><br />';
echo (empty($us2['photo']) ? '<img src="'.HOME.'/style/img/empty_photo.gif"/>' : '<a href="'.HOME.'/files/photo/'.$us2['photo'].'"><img src="'.HOME.'/files/photo/mini_'.$us2['photo'].'"/></a>');
echo '<br /><b>Ovozlar:</b> '.$vote2.' ('.round($vote2/$count*100,1).'%)<br />
Erkak: ('.round($man2/$vote2*100,1).'%) / Ayol: ('.round($woman2/$vote2*100,1).'%)<br />
<form action="'.HOME.'/duel/?'.rand(1,9999).'" method="post">
<input type="hidden" name="vote_user" value="'.$us2['user_id'].'"/>
<input type="hidden" name="duel_id" value="'.$post['id'].'"/>
<input type="submit" name="golos" value="Ovoz berish"/></form>';
echo CLOSE_DIV;
echo DIV_LI . '<center>Tugash vaqti: <strong>'.vrem($post['time']).'</strong></center>' . CLOSE_DIV;
} else {
echo DIV_AUT . 'Siz duelda qatnashmayapsiz yoki chaqiruvingizga hali javob berishmadi' . CLOSE_DIV;
}
$array = array('Duellar');
nav($array);
require_once('../../core/stop.php');
?>