Файл: work2.php
Строк: 207
<?
define('PROTECTOR', 1);
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
$textl='Работа';
include($path.'files/core.php');
$mobs1=mysql_query("SELECT * FROM `arena_usr` WHERE `usr`='".$udata['id']."'");
$rows1=mysql_num_rows($mobs1);
if($rows1!=0)
{
header('location: arena.php');exit;
}
$mobs2=mysql_query("SELECT * FROM `avan_usr` WHERE `usr`='".$udata['id']."'");
$rows2=mysql_num_rows($mobs2);
if($rows2!=0)
{
header('location: avan.php');exit;
}
$mobs3=mysql_query("SELECT * FROM `battle` WHERE `usr`='".$udata['id']."'");
$rows3=mysql_num_rows($mobs3);
if($rows3!=0)
{
header('location: battle.php');exit;
}
$mobs4=mysql_query("SELECT * FROM `ohota` WHERE `usr`='".$udata['id']."'");
$rows4=mysql_num_rows($mobs4);
if($rows4!=0)
{
header('location: b_oh.php');exit;
}
$mobs5=mysql_query("SELECT * FROM `okr_usr` WHERE `usr`='".$udata['id']."'");
$rows5=mysql_num_rows($mobs5);
if($rows5!=0)
{
header('location: b_okr.php');exit;
}
$mobs6=mysql_query("SELECT * FROM `str_usr` WHERE `usr`='".$udata['id']."'");
$rows6=mysql_num_rows($mobs6);
if($rows6!=0)
{
header('location: b_str.php');exit;
}
$mobs7=mysql_query("SELECT * FROM `terr_usr` WHERE `usr`='".$udata['id']."'");
$rows7=mysql_num_rows($mobs7);
if($rows7!=0)
{
header('location: terr_b.php');exit;
}
if(isset($_GET['start']))
{
if($_POST['res']==4)
{
$mobs=mysql_query("SELECT * FROM `craft` WHERE `usr`='".$udata['id']."'");
$rows=mysql_num_rows($mobs);
if($rows==0)
{
$time=time()+300;
mysql_query("INSERT INTO `craft` SET
`id`='',
`usr`='".$udata['id']."',
`res`='".$_POST['res']."',
`time`='".$time."',
`status`='0'
");
}
else
{
}
}
header('location: ?');exit;
}
if(isset($_GET['stop']))
{
mysql_query("DELETE FROM `craft` WHERE `usr`='".$udata['id']."'");
header('location: ?');exit;
}
include($path.'files/head.php');
include($path.'files/zag.php');
echo '<div class="v3 bts brs bls b p v12">Навигация</div><div class="v4 bts brs bls bbs p t1">
<img src=img/main/i26.png class="menu"> <a href=game.php>главная</a> / <a href=?>работа</a>
</div>';
echo '<div class="v8"><div class="v3 bts brs bls b p v12">Работа</div>';
echo'<div class="v2 bts brs bls bbs p t1">';
if($udata['lvl']<6)
{
echo '<font color=#ff0000>Работать можно с 6 уровня! Приходите позже!</font>';
}
else
{
echo '<div align=center><img src=img/inter/14.jpg></div>';
echo '<div class="v4 p"><font color=#ff9900>Работа позволит тебе заработать золото,
добывая редкие минералы или ресурсы</font></div>';
$mobs=mysql_query("SELECT * FROM `craft` WHERE `usr`='".$udata['id']."'");
$rows=mysql_num_rows($mobs);
if($rows==0)
{
echo '<img src=img/main/p21.png> <font color=#999999>Что делать?:</font><br>';
echo '<form action=work.php?start method=POST>
<input type=radio name=res value=4>добывать драгоценные камни +
<img src=img/main/r13.png> <img src=img/main/r14.png> <img src=img/main/r15.png><br>
<div align=center><input type=submit value="работать" class="line"></div>
</form>
<img src=img/main/e55.png> <a href=craft_user.php>Опыт крафта</a><br>
';
}
else
{
$cr=mysql_fetch_array($mobs);
echo '<img src=img/main/e22.png> <a href=>Обновить</a><br>
<img src=img/main/e55.png> <a href=craft_user.php>Опыт крафта</a><br>';
if($cr['time']>time())
{
if($cr['res']==1)
{
$prof='Горняк';
}
if($cr['res']==2)
{
$prof='Рыбак';
}
if($cr['res']==3)
{
$prof='Лесоруб';
}
if($cr['res']==4)
{
$prof='Каменщик';
}
echo '<img src=img/main/p21.png> Профессия: <font color=#ff9900>'.$prof.'</font><br>
<img src=img/main/p21.png> Осталось работать: <font color=#1faee9>';
$cr['time']=$cr['time']-time();
if($cr['time']<60){
echo $cr['time']." с.</font>";
}elseif($cr['time']>60 and $cr['time']<3600){
$cr['time']=round($cr['time']/60);
echo $cr['time']." м.</font>";
}else{
$cr['time']=round($cr['time']/3600);
echo $cr['time']." ч.</font>";
}
echo'<br><img src=img/main/e55.png> <a href=?stop><font color=#ff0000>Прекратить работу</font></a>';
}
else
{
echo '<div class="t4 v5 p">';
$r=rand(1,100);
if($cr['res']==4)
{
if($r<=33)
{
if($udata['kam_lvl']<14)
{
$kol=1;
}
if($udata['kam_lvl']>=14 and $udata['kam_lvl']<28)
{
$kol=2;
}
if($udata['kam_lvl']>=28 and $udata['kam_lvl']<40)
{
$kol=3;
}
if($udata['kam_lvl']>=40)
{
$kol=4;
}
$dat_pay=date('d');
$tim_pay=date('H');
$sob_pay=mysql_query("SELECT * FROM `sob` WHERE `d_start`<='".$dat_pay."' and `d_finish`>='".$dat_pay."' and `t_start`<='".$tim_pay."' and `t_finish`>='".$tim_pay."' and `lvl`<='".$udata['lvl']."' and `tip`='work' ORDER BY `kol` DESC LIMIT 1");
$n_sob=mysql_num_rows($sob_pay);
if($n_sob!=0)
{
$kol=$kol*2;
}
$exp=$kol;
echo '<table><tr>
<td><img src=img/work/r13m.jpg></td>
<td>
<img src=img/main/p9.png> Опыт крафта <font color=#ff9900>Каменщик</font>: +'.$exp.'<br>
<img src=img/main/e9.png> Ресурс: <img src=img/work/r13.png> '.$kol.'<br>
</td>
</tr></table>';
$res=$udata['iss']+$kol;
$exp=$udata['kam_exp']+$kol;
if($udata['admin']>0 and $udata['admin']<6)
{
$ad= '<img src=img/main/md.png> ';
}
elseif($udata['admin']>5)
{
$ad= '<img src=img/main/admin.png> ';
}
$text=''.$ad.' <img src=img/main/c'.$udata['klass'].'.png>
<img src=img/main/r'.$udata['rasa'].'.png> <a href=info.php?id='.$udata['id'].'>'.$udata['usr'].'</a>
<font color=#cccccc>получил на работе: <img src=img/work/r13.png> '.$kol.'</font>
';
$tma=time();
$dats=date('d.m.Y (H:i:s)');
mysql_query("INSERT INTO `adm_res` SET `id`='', `usr`='".$udata['id']."', `tip`='kraft', `text`='".$text."', `time`='".$tma."', `data`='".$dats."'");
mysql_query("UPDATE `users` SET `iss`='".$res."', `kam_exp`='".$exp."' WHERE `id`='".$udata['id']."'");
if($udata['kv_d']==19)
{
$kv_kol=$udata['kv_d_n']+$kol;
mysql_query("UPDATE `users` SET `kv_d_n`='".$kv_kol."' WHERE `id`='".$udata['id']."'");
}
if($udata['kv_d']==31)
{
$kv_kol=$udata['kv_d_n']+$kol;
mysql_query("UPDATE `users` SET `kv_d_n`='".$kv_kol."' WHERE `id`='".$udata['id']."'");
}
mysql_query("DELETE FROM `craft` WHERE `usr`='".$udata['id']."'");
}
if($r>33 and $r<=66)
{
if($udata['kam_lvl']<14)
{
$kol=1;
}
if($udata['kam_lvl']>=14 and $udata['kam_lvl']<28)
{
$kol=2;
}
if($udata['kam_lvl']>=28 and $udata['kam_lvl']<40)
{
$kol=3;
}
if($udata['kam_lvl']>=40)
{
$kol=4;
}
$dat_pay=date('d');
$tim_pay=date('H');
$sob_pay=mysql_query("SELECT * FROM `sob` WHERE `d_start`<='".$dat_pay."' and `d_finish`>='".$dat_pay."' and `t_start`<='".$tim_pay."' and `t_finish`>='".$tim_pay."' and `lvl`<='".$udata['lvl']."' and `tip`='work' ORDER BY `kol` DESC LIMIT 1");
$n_sob=mysql_num_rows($sob_pay);
if($n_sob!=0)
{
$kol=$kol*2;
}
$exp=$kol;
echo '
<table><tr>
<td><img src=img/work/r14m.jpg></td>
<td>
<img src=img/main/p9.png> Опыт крафта <font color=#ff9900>Каменщик</font>: +'.$exp.'<br>
<img src=img/main/e9.png> Ресурс: <img src=img/work/r14.png> '.$kol.'<br>
</td>
</tr></table>';
$res=$udata['lazyr']+$kol;
$exp=$udata['kam_exp']+$kol;
if($udata['admin']>0 and $udata['admin']<6)
{
$ad= '<img src=img/main/md.png> ';
}
elseif($udata['admin']>5)
{
$ad= '<img src=img/main/admin.png> ';
}
$text=''.$ad.' <img src=img/main/c'.$udata['klass'].'.png>
<img src=img/main/r'.$udata['rasa'].'.png> <a href=info.php?id='.$udata['id'].'>'.$udata['usr'].'</a>
<font color=#cccccc>получил на работе: <img src=img/work/r14.png> '.$kol.'</font>
';
$tma=time();
$dats=date('d.m.Y (H:i:s)');
mysql_query("INSERT INTO `adm_res` SET `id`='', `usr`='".$udata['id']."', `tip`='kraft', `text`='".$text."', `time`='".$tma."', `data`='".$dats."'");
mysql_query("UPDATE `users` SET `lazyr`='".$res."', `kam_exp`='".$exp."' WHERE `id`='".$udata['id']."'");
if($udata['kv_d']==19)
{
$kv_kol=$udata['kv_d_n']+$kol;
mysql_query("UPDATE `users` SET `kv_d_n`='".$kv_kol."' WHERE `id`='".$udata['id']."'");
}
if($udata['kv_d']==31)
{
$kv_kol=$udata['kv_d_n']+$kol;
mysql_query("UPDATE `users` SET `kv_d_n`='".$kv_kol."' WHERE `id`='".$udata['id']."'");
}
mysql_query("DELETE FROM `craft` WHERE `usr`='".$udata['id']."'");
}
if($r>66)
{
if($udata['kam_lvl']<14)
{
$kol=1;
}
if($udata['kam_lvl']>=14 and $udata['kam_lvl']<28)
{
$kol=2;
}
if($udata['kam_lvl']>=28 and $udata['kam_lvl']<40)
{
$kol=3;
}
if($udata['kam_lvl']>=40)
{
$kol=4;
}
$dat_pay=date('d');
$tim_pay=date('H');
$sob_pay=mysql_query("SELECT * FROM `sob` WHERE `d_start`<='".$dat_pay."' and `d_finish`>='".$dat_pay."' and `t_start`<='".$tim_pay."' and `t_finish`>='".$tim_pay."' and `lvl`<='".$udata['lvl']."' and `tip`='work' ORDER BY `kol` DESC LIMIT 1");
$n_sob=mysql_num_rows($sob_pay);
if($n_sob!=0)
{
$kol=$kol*2;
}
$exp=$kol;
echo '<table><tr>
<td><img src=img/work/r15m.jpg></td>
<td>
<img src=img/main/p9.png> Опыт крафта <font color=#ff9900>Каменщик</font>: +'.$exp.'<br>
<img src=img/main/e9.png> Ресурс: <img src=img/work/r15.png> '.$kol.'<br>
</td>
</tr></table>';
$res=$udata['bagr']+$kol;
$exp=$udata['kam_exp']+$kol;
if($udata['admin']>0 and $udata['admin']<6)
{
$ad= '<img src=img/main/md.png> ';
}
elseif($udata['admin']>5)
{
$ad= '<img src=img/main/admin.png> ';
}
$text=''.$ad.' <img src=img/main/c'.$udata['klass'].'.png>
<img src=img/main/r'.$udata['rasa'].'.png> <a href=info.php?id='.$udata['id'].'>'.$udata['usr'].'</a>
<font color=#cccccc>получил на работе: <img src=img/work/r15.png> '.$kol.'</font>
';
$tma=time();
$dats=date('d.m.Y (H:i:s)');
mysql_query("INSERT INTO `adm_res` SET `id`='', `usr`='".$udata['id']."', `tip`='kraft', `text`='".$text."', `time`='".$tma."', `data`='".$dats."'");
mysql_query("UPDATE `users` SET `bagr`='".$res."', `kam_exp`='".$exp."' WHERE `id`='".$udata['id']."'");
if($udata['kv_d']==19)
{
$kv_kol=$udata['kv_d_n']+$kol;
mysql_query("UPDATE `users` SET `kv_d_n`='".$kv_kol."' WHERE `id`='".$udata['id']."'");
}
if($udata['kv_d']==31)
{
$kv_kol=$udata['kv_d_n']+$kol;
mysql_query("UPDATE `users` SET `kv_d_n`='".$kv_kol."' WHERE `id`='".$udata['id']."'");
}
mysql_query("DELETE FROM `craft` WHERE `usr`='".$udata['id']."'");
}
}
echo '<img src=img/main/e55.png> <a href=work.php>Вернуться</a>';
echo '</div>';
}
}
}
echo '</div></div>';
include('files/down.php');
?>