<?
#############################################################################
## Автор: -=ША}{ТЕР=- # ## Сайт: http://v4ate.us # ## ICQ : 46-92-90 # ## Версия 3.2 от 28.06.2009 #
## По вопросам приобритения скрипта или обновлений для него обращатьтся на #
## вышеуказанные данные. РАСПРОСТРАНЕНИЕ СКРИПТА ДРУГИМИ ЛИЦАМИ ЗАПРЕШЕНО! #
#############################################################################
if ($msg=="!вопрос"||$msg=="!vopros"){
$r = mysql_query ("select * from vopros where klu4 = '1'");
$a = mysql_fetch_array($r);
$vp = $a ["question"];
$i = $a ["number"];
if ($i!=5){
$st = getmicrotime();
$today=date ("H:i");
$a = @mysql_query ("Select posts from users where id='".$uid."'");
$b = mysql_fetch_array ($a);
$p = $b["posts"];
$p++;
@mysql_query ("Update users set posts='".$p."', onl='".$st."', room='room0' where id ='".$uid."'");
$rnd = rand(0,99999999);
$rs = "<b>Вопрос: </b> ";
mysql_query ("Insert into room0 set klu4= '".$rnd."', time='".$today."', who='".$uus."', message='".$rs."".$vp."', id='".$st."', towhom='', hid='0', usid='".$uid."', komu=''");
}
}
if ($msg=="!ответ"||$msg=="!otvet"){
$a = mysql_query ("Select answer from vopros");
$b = mysql_fetch_array ($a);
$uposts=$row['posts'];
$vposts=$row['credits'];
$byeotv=$row['byeotv'];
$usid=$row['user'];
$otvet = $b["answer"];
$uposts1=$uposts-100;
$byeotv=$byeotv+1;
if ($uposts>=100){
mysql_query ("Update users set posts='".$uposts1."', byeotv='".$byeotv."' where id='".$id."'");
$st = time();
$today=date ("H:i");
$mes = "Правильный ответ на текущий вопрос: <b>".$otvet."</b> =)";
$rnd = rand(0,99999999);
mysql_query ("Insert into room0 set klu4= '".$rnd."', time='".$today."', who='".$prodavec."', message='".$mes."', id='".$st."', towhom='".$id."', hid='0', usid='4', komu='".$usid."'");
}else{
$st = time();
$today=date ("H:i");
$mes = "У вас недостаточно постов! Ответ стоит 100 постов!";
$rnd = rand(0,99999999);
mysql_query ("Insert into room0 set klu4= '".$rnd."', time='".$today."', who='".$prodavec."', message='".$mes."', id='".$st."', towhom='".$id."', hid='0', usid='4', komu='".$usid."'");
}
}
$s = substr ($msg,0,5);
if (($s == "stats")&&(strlen($msg) > 6)){
$stsus = substr ($msg,6,strlen($msg)-6);
$a = @mysql_query ("Select credits from users where user='".$stsus."'");
if (mysql_affected_rows() != 0){
$st = getmicrotime();
$today=date ("H:i");
$b = mysql_fetch_array($a);
$i = $b["credits"];
$a = @mysql_query ("Select user from users order by credits desc LIMIT 101");
$j = 1;
$b = mysql_fetch_array($a);
while (($b["user"] != $stsus)&&($j <= 100)) {$b = mysql_fetch_array($a); $j++;}
if ($j<=100) $s= "И он занимает в рейтинге $j место";
else $s = "И его место в рейтинге за пределами первой сотни.";
$mes = "У пользователя $stsus $i правильных ответов. $s";
$rnd = rand(0,99999999);
if($towhom == $uid) $th = $id; else $th ="";
mysql_query ("Insert into room0 set klu4= '".$rnd."', time='".$today."', who='".$uus."', message='".$mes."', id='".$st."', towhom='".$th."', hid='0', usid='".$uid."', komu=''");
$a = @mysql_query ("Select posts from users where id='".$uid."'");
$b = mysql_fetch_array ($a);
$p = $b["posts"];
$p++;
@mysql_query ("Update users set posts='".$p."', onl='".$st."', room='room0' where id ='".$uid."'");
} else {
$st = getmicrotime();
$today=date ("H:i");
$mes = "Игрока с ником $stsus нет в базе данных!";
$rnd = rand(0,99999999);
if($towhom == $uid) $th = $id; else $th ="";
mysql_query ("Insert into room0 set klu4= '".$rnd."', time='".$today."', who='".$uus."', message='".$mes."', id='".$st."', towhom='".$th."', hid='0', usid='".$uid."', komu=''");
$a = @mysql_query ("Select posts,sex from users where id='".$uid."'");
$b = mysql_fetch_array ($a);
$p = $b["posts"];
$sex = $b["sex"];
$p++;
@mysql_query ("Update users set posts='".$p."', onl='".$st."', room='room0' where id ='".$uid."'");
}
}
$agent = htmlentities(addslashes($HTTP_USER_AGENT));
if (((strpos ($agent,"M3Gate") !== false)||(strpos ($agent,"Opera") !== false)||(strpos ($agent,"emulator") !== false)||(strpos ($agent,"WinWAP") !== false)||(strpos ($agent,"Wapsilon") !== false)||(strpos ($agent,"Mozilla") !== false)||(strpos ($agent,"M3GATE") !== false))&&($rm==0)&&($set["vict"] == 0)){
$latumnik=mysql_fetch_array(mysql_query("Select latuser from users where id='2' LIMIT 1;"));
if (($amsg == $kansw||$amsg == $tran)&&$nom!=5){
$st = time();
$today=date ("H:i");
$mes = "".$us."! Вы правильно ответили на этот вопрос. Но с компа ответы не засчитываются.";
$rnd = rand(0,99999999);
mysql_query ("Insert into room0 set klu4= '".$rnd."', time='".$today."', who='".$uus."', message='".$mes."', id='".$st."', towhom='".$id."', hid='0', usid='".$uid."', komu='".$us."'");
}
}else{
if (($amsg == $kansw||$amsg == $tran)&&$nom!=5){{
$st = time();
$victint = $set["victint"];
$st = $st + $victint;
if ($victint=="10") $interval="10 секунд";
else if ($victint=="30") $interval="30 секунд";
else if ($victint=="60") $interval="минуту";
else $interval="2 минуты";
mysql_query ("Update vopros set number = '5', time = '".$st."', answer = ' ', tran = ' ' WHERE klu4 ='1'");
$a = @mysql_query ("Select posts from users where id='".$uid."'");
$b = mysql_fetch_array ($a);
$p = $b["posts"];
$p++;
@mysql_query ("Update users set posts='".$p."', onl='".$st."', room='room0' where id ='".$uid."'");
$a = @mysql_query ("Select posts from users where id='".$uid."'");
$b = mysql_fetch_array ($a);
$p = $b["posts"];
$p++;
@mysql_query ("Update users set posts='".$p."', onl='".$st."', room='room0' where id ='".$uid."'");
$select = @mysql_query ("Select credits,sex from users where id='".$id."'");
$inf = mysql_fetch_array ($select);
$creditss = $inf["credits"];
$p = $row["credits"];
$p++;
mysql_query ("Update users set credits='".$p."' where id ='".$id."'");
$st = getmicrotime();
$today=date ("H:i");
$creditss1=$creditss+1;
$sex = $inf["sex"];
if($sex=='М'){
$sex1="его";
}else if($sex=='Ж'){
$sex1="её";}
$mes = "".$us.",Правильно отвечает на вопрос! И это $sex1 $creditss1 правильный ответ!. Следующий вопрос через ".$interval.".";
$rnd = rand(0,99999999);
mysql_query ("Insert into room0 set klu4= '".$rnd."', time='".$today."', who='".$uus."', message='".$mes."', id='".$st."', towhom='".$towhom."', hid='0', usid='".$uid."', komu=''");
}
$today=date ("H:i");
$mes = "Поздравляю!!!";
$rnd = rand(0,99999999);
mysql_query ("Insert into room0 set klu4= '".$rnd."', time='".$today."', who='".$uus."', message='".$mes."', id='".$st."', towhom='".$id."', hid='0', usid='".$uid."', komu='".$us."'");
}
}
?>