Файл: inc/fish/fish_license.php
Строк: 82
<?php
$title = 'Рыбалка';
include_once $_SERVER['DOCUMENT_ROOT'].'/inc/system/config.php';
include_once $_SERVER['DOCUMENT_ROOT'].'/inc/fish/func_fish.php';
$req = mysql_query('SELECT * FROM `kolhoz_fishery_data` WHERE `type`="location" and `id`="'.intval($_GET['id']).'" LIMIT 1');
$info_loc = mysql_fetch_array($req);
if(mysql_num_rows($req) == 0){
redirect_fish('/fish/', 'Ошибка'); exit;
}
if(isset($_GET['ok'])){
if($_GET['time_fish'] == 12){
$cena = $info_loc['cena_12'];
$time_loc = 43200;
}elseif($_GET['time_fish'] == 24){
$cena = $info_loc['cena_24'];
$time_loc = 86400;
}elseif($_GET['time_fish'] == 32){
$cena = $info_loc['cena_32'];
$time_loc = 115200;
}else{
redirect_fish('/fish/license/'.$info_loc['id'], 'Ошибка'); exit;
}
if($ku['rubies'] < $cena){
redirect_fish('/fish/license/'.$info_loc['id'], 'У вас недостаточно рубин для покупки лицензии!'); exit;
}
$req = mysql_query("SELECT * FROM `fish_loc` WHERE `id_user` = '".$ku['id']."' and `id_loc` = '".$info_loc['id']."' and `time` < '".time()."'");
if(mysql_num_rows($req) == 0){
mysql_query("INSERT INTO `fish_loc` SET
`id_user` = '".$ku['id']."',
`id_loc` = '".$info_loc['id']."',
`time` = '".(time()+$time_loc)."'");
mysql_query("UPDATE `kolhoz_user` SET `rubies` = `rubies` -$cena WHERE `id` = '".$ku['id']."'");
redirect_fish('/fish/location/'.$my_loc['id_loc'], ''); exit;
}else{
$my_loc = mysql_fetch_array($req);
redirect_fish('/fish/location/'.$my_loc['id_loc'], ''); exit;
}
}
$count = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `fish_loc` WHERE `id_user` = '".$ku['id']."' and `id_loc` = '".$info_loc['id']."' and `time` > '".time()."'"),0);
if($count > 0){
redirect_fish('/fish/location/'.$info_loc['id'], ''); exit;
}
echo '<div><img src="/ImgStyle/lake-details.jpg"/></div>';
echo '<center><div class="blocklocname"><span class="spec-head6">'.$info_loc['name'].'</span>
<a class="blockloctime" href="/fish/license/'.$info_loc['id'].'/ok/12/"><span class="spec-head5">12 ч за <img src="/img/icons/ruby.png"> '.$info_loc['cena_12'].'</span></a>';
echo '<a class="blockloctime" href="/fish/license/'.$info_loc['id'].'/ok/24/"><span class="spec-head5">24 ч за <img src="/img/icons/ruby.png"> '.$info_loc['cena_24'].'</span></a>';
echo '<a class="blockloctime" href="/fish/license/'.$info_loc['id'].'/ok/32/"><span class="spec-head5">36 ч за <img src="/img/icons/ruby.png"> '.$info_loc['cena_32'].'</span></a></div></center>';
echo '<center><div style="padding:5px 0px 0px 0px;" ><a class="blockloctime" href="/fish/"><span class="spec-head1">Выбор места рыбалки</span></a></div></center>';
include_once $_SERVER['DOCUMENT_ROOT'].'/inc/system/foot.php';
?>