Файл: lake.php
Строк: 172
<?php
include_once("files/zag.php");
include_once("files/ini.php");
$polz=mysql_query("SELECT * FROM `users` WHERE `udata0`='$log' AND `udata1`='$pas' LIMIT 1");
if(mysql_num_rows($polz)==0){
header ("Location: index.php?error");
echo'<div class="p">Ошибка! Пользователь с таким логином и паролем не зарегистрирован, или пароль/логин неверен! <a href="index.php">На главную</a><br>';exit;
}else{
switch($go) {
default:
$time = date("H:i:s");
echo"Вы стоите на берегу большого озера. Здесь можно порыбачить.</br>";
$namee=explode("*",$udata12);
if($namee[0]!=="Удочка"){echo"Перед рыбалкой нужно одеть удочку.";}else{
echo"<a href="lake.php?&go=ribalka">Забросить удочку</a><br/>";}
break;
case 'ribalka1':
$res1 = mysql_query("SELECT * FROM `fishlov` WHERE `login`='$log' LIMIT 1");
$test=mysql_num_rows($res1);
if($test==0){
mysql_query("INSERT INTO
`fishlov` SET
`login` = '$log',
`id_fish` = '',
`name` = '',
`hpregen` = '',
`hp` = '',
`hpall` = '',
`time` = '',
`povedenie` = ''");}
$arr=mysql_fetch_array($res1);
$res1 = mysql_query("SELECT * FROM `fishlov` WHERE `login`='$log' LIMIT 1");
$arr=mysql_fetch_array($res1);
if($arr[time]<time()){mysql_query("UPDATE `fishlov` SET `id_fish` = '', `hp`='', `time`='', `hpall`='', `hpregen`='', `povedenie`='', `name`='' WHERE `login`='".$log."' LIMIT 1"); mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Рыбка сорвалась.', '".$log."')");}
if($arr[hp]<=0 and $arr[id_fish]!=""){header ("Location: lake.php?&go=win"); exit;}
$namee=explode("*",$udata12);
if($namee[0]!=="Удочка"){echo"Перед рыбалкой нужно одеть удочку.";}
$res = mysql_query("SELECT * FROM `item` WHERE `uda4`='Наживка' and `uda3`>'0' and `uda7`='".$log."' LIMIT 1");
$avto=mysql_num_rows($res);
if($avto=="0"){echo"Вам нужна наживка!"; include_once"files/down.php"; exit;}
if($arr[id_fish]==""){
echo"Рыба не клюнула и наживка испорчена.</br>";
echo"<a href="lake.php?&go=ribalka">Забросить удочку</a><br/>";}
else{
$ostatok=$arr[time]-time();
echo"<font color=red>$arr[hp] | $arr[hpall]</font>(Осталось: $ostatok)</br>";
if($arr[povedenie]=="sopr"){echo"Рыба сопротивляется!</br>";}
if($arr[povedenie]=="no"){echo"Рыба ничего не делает!</br>";}
if($arr[povedenie]=="xz"){echo"Поведение непонятно</br>";}
$mp=round($udata29/100);
echo"<a href="lake.php?&go=ribalka&vid=1">Тянуть</a>($mp MP)<br/>";
echo"<a href="lake.php?&go=ribalka&vid=2">Подсечь</a>($mp MP)<br/>";
echo"<a href="lake.php?&go=ribalka&vid=3">Подождать</a><br/>";}
echo"<hr>";
echo'<b>Лог рыбалки:</b><br>- - -';
if(empty($startan)) $startan = 0;
$startan=intval($startan);
if($startan<0) $startan=0; $num_msgs_an=5;
$arr = mysql_query("SELECT * from `battle_log`");
$qi = mysql_query("SELECT * from `battle_log` WHERE `blog1`='$log' ORDER by `iu` DESC LIMIT 5");
if (mysql_affected_rows()==0)
{
echo "<br>Лог рыбалки пуст!";
}
else
{
while($row=mysql_fetch_array($qi))
{
echo '<br>'.$row[blog0].' ';
}
}
break;
case 'ribalka':
$time = date("H:i:s");
$mp=$udata29/100;
$udata29=round($udata29-$mp);
mysql_query("UPDATE `users` SET `udata29`='$udata29' WHERE `udata0`='".$log."' LIMIT 1");
$res1 = mysql_query("SELECT * FROM `fishlov` WHERE `login`='$log' LIMIT 1");
$test=mysql_num_rows($res1);
if($test==0){
mysql_query("INSERT INTO
`fishlov` SET
`login` = '$log',
`id_fish` = '',
`name` = '',
`hpregen` = '',
`hp` = '',
`hpall` = '',
`time` = '',
`povedenie` = ''");}
$res = mysql_query("SELECT * FROM `item` WHERE `uda4`='Наживка' and `uda3`>'0' and `uda7`='".$log."' LIMIT 1");
$avto=mysql_num_rows($res);
$avi=mysql_fetch_array($res);
if($avi[uda3]==1){mysql_query("DELETE FROM `item` WHERE `uda7`='$log' and `uda4`='Наживка' ");}else{
$uda3=$avi[uda3]-1;
mysql_query("UPDATE `item` SET `uda3`='$uda3' WHERE `login`='".$log."' and `uda4`='Наживка' LIMIT 1");}
$namee=explode("*",$udata12);
if($namee[0]!=="Удочка"){echo"Перед рыбалкой нужно одеть удочку.";}
if($avto=="0"){echo"Вам нужна наживка!"; include_once"files/down.php"; exit;}
$res1 = mysql_query("SELECT * FROM `fishlov` WHERE `login`='$log' LIMIT 1");
$arr=mysql_fetch_array($res1);
if($arr[time]<time()){mysql_query("UPDATE `fishlov` SET `id_fish` = '', `hp`='', `time`='', `hpall`='', `hpregen`='', `povedenie`='', `name`='' WHERE `login`='".$log."' LIMIT 1"); mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Рыбка сорвалась.', '".$log."')");}
if($arr[id_fish]==""){
$randoms=rand(1,4);
if($randoms!=1){
if($udata9<10){$rib = mysql_query("SELECT * FROM `fish` where `level`<='2' ORDER BY RAND() LIMIT 1");}else
if($udata9<20){$rib = mysql_query("SELECT * FROM `fish` where `level`<='4' ORDER BY RAND() LIMIT 1");}else
if($udata9<30){$rib = mysql_query("SELECT * FROM `fish` where `level`<='6' ORDER BY RAND() LIMIT 1");}else
if($udata9<40){$rib = mysql_query("SELECT * FROM `fish` where `level`<='8' ORDER BY RAND() LIMIT 1");}else
if($udata9<50){$rib = mysql_query("SELECT * FROM `fish` where `level`<='10' ORDER BY RAND() LIMIT 1");}else
if($udata9<60){$rib = mysql_query("SELECT * FROM `fish` where `level`<='14' ORDER BY RAND() LIMIT 1");}else
if($udata9<70){$rib = mysql_query("SELECT * FROM `fish` where `level`<='18' ORDER BY RAND() LIMIT 1");}else
if($udata9<80){$rib = mysql_query("SELECT * FROM `fish` where `level`<='22' ORDER BY RAND() LIMIT 1");}else
if($udata9<=85){$rib = mysql_query("SELECT * FROM `fish` ORDER BY RAND() LIMIT 1");}
$ri=mysql_fetch_array($rib);
$random=rand(1,3);
if($random=="1"){$povedenie="sopr";}
if($random=="2"){$povedenie="no";}
if($random=="3"){$povedenie="xz";}
$timerok=$ri[combat_time]/1000;
$timero4ek=$timerok+time();
mysql_query("UPDATE `fishlov` SET `id_fish` = '$ri[id]', `hp`='$ri[hp]', `time`='$timero4ek', `hpall`='$ri[hp]', `hpregen`='$ri[hpregen]', `povedenie`='$povedenie', `name`='$ri[name]' WHERE `login`='".$log."' LIMIT 1");}
header ("Location: lake.php?&go=ribalka1"); exit;
}
if($vid=="1" and $arr[povedenie]=="no"){
$res1 = mysql_query("SELECT * FROM `weapon_item` WHERE `name`='Удочка' and `login`='".$log."' LIMIT 1");
$av=mysql_fetch_array($res1);
$atk=$av[p_dam]+$av[m_dam];
$hp=$arr[hp]-$atk;
mysql_query("UPDATE `fishlov` SET `hp`='$hp' WHERE `login`='".$log."' LIMIT 1"); mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы нанесли рыбке $atk урона.', '".$log."')"); header ("Location: lake.php?&go=ribalka1"); exit;}else
if($vid=="2" and $arr[povedenie]=="no"){mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Рыбка защитилась.', '".$log."')"); header ("Location: lake.php?&go=ribalka1"); exit;}else
if($vid=="3"){mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы немного подождали.', '".$log."')"); header ("Location: lake.php?&go=ribalka1"); exit;}else
if($vid=="1" and $arr[povedenie]=="sopr"){mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Рыбка защитилась.', '".$log."')"); header ("Location: lake.php?&go=ribalka1"); exit;}else
if($vid=="2" and $arr[povedenie]=="sopr"){
$res1 = mysql_query("SELECT * FROM `weapon_item` WHERE `name`='Удочка' and `login`='".$log."' LIMIT 1");
$av=mysql_fetch_array($res1);
$atk=$av[p_dam]+$av[m_dam];
$hp=$arr[hp]-$atk;
mysql_query("UPDATE `fishlov` SET `hp`='$hp' WHERE `login`='".$log."' LIMIT 1"); mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы нанесли рыбке $atk урона.', '".$log."')"); header ("Location: lake.php?&go=ribalka1"); exit;}else
if($vid=="1" and $arr[povedenie]=="xz"){
$randomm=rand(1,2);
if($randomm==1){mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Рыбка защитилась.', '".$log."')"); header ("Location: lake.php?&go=ribalka1"); exit;}else{
$res1 = mysql_query("SELECT * FROM `weapon_item` WHERE `name`='Удочка' and `login`='".$log."' LIMIT 1");
$av=mysql_fetch_array($res1);
$atk=$av[p_dam]+$av[m_dam];
$hp=$arr[hp]-$atk;
mysql_query("UPDATE `fishlov` SET `hp`='$hp' WHERE `login`='".$log."' LIMIT 1"); mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы нанесли рыбке $atk урона.', '".$log."')"); header ("Location: lake.php?&go=ribalka1"); exit;}}else
if($vid=="2" and $arr[povedenie]=="xz"){
$randomm=rand(1,2);
if($randomm==1){mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Рыбка защитилась.', '".$log."')"); header ("Location: lake.php?&go=ribalka1"); exit;}else{
$res1 = mysql_query("SELECT * FROM `weapon_item` WHERE `name`='Удочка' and `login`='".$log."' LIMIT 1");
$av=mysql_fetch_array($res1);
$atk=$av[p_dam]+$av[m_dam];
$hp=$arr[hp]-$atk;
mysql_query("UPDATE `fishlov` SET `hp`='$hp' WHERE `login`='".$log."' LIMIT 1"); mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы нанесли рыбке $atk урона.', '".$log."')"); header ("Location: lake.php?&go=ribalka1"); exit;}}
break;
case 'win':
$time = date("H:i:s");
$rib = mysql_query("SELECT * FROM `fishlov` WHERE `login`='$log' and `hp`<='0' and `name`!='' LIMIT 1");
$ri=mysql_num_rows($rib);
$riba=mysql_fetch_array($rib);
if($ri==1){
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы поймали $riba[name].', '".$log."')");
$rys = mysql_query("SELECT * FROM `fish` WHERE `name`='$riba[name]' LIMIT 1");
$ar=mysql_fetch_array($rys);
$res = mysql_query("SELECT * FROM `item` WHERE `uda4`='$riba[name]' and `uda7`='".$log."' LIMIT 1");
$avto=mysql_num_rows($res);
$avi=mysql_fetch_array($res);
if($avi[uda3]==0){mysql_query("INSERT INTO `item` VALUES ('', '0', '10000', 'fish', '$ar[name]', '', '$ar[fish_type]', '$log')");}else{
$uda3=$avi[uda3]+1;
mysql_query("UPDATE `item` SET `uda3`='$uda3' WHERE `uda7`='".$log."' and `uda4`='$ar[name]' LIMIT 1") or die(mysql_error());}
mysql_query("UPDATE `fishlov` SET `id_fish` = '', `hp`='', `time`='', `hpall`='', `hpregen`='', `povedenie`='', `name`='' WHERE `login`='".$log."' LIMIT 1");
$reqqqq = mysql_query("SELECT * FROM `eventfish` WHERE `usr`='$log'");
$avtomat=mysql_num_rows($reqqqq);
$olimp=mysql_fetch_array($reqqqq);
if($avtomat==1){
$nk=$olimp[kol]+1;
mysql_query("UPDATE `eventfish` SET `kol` = '$nk' WHERE `usr` = '$log'");
}else{mysql_query("INSERT INTO
`eventfish` SET
`usr` = '$log',
`kol` = '1'");}
header ("Location: lake.php?&go=ribalka1");
}else{header ("Location: lake.php?&go=ribalka1");}
break;
}
}
include_once"files/down.php";
?>