View file sdark.mobi/master/order.php

File size: 17.06Kb
<?
require_once'../core/system.php';
print only_reg();
print ban();
print blok();
$header='Выберите драгоценный камень';
require_once'../core/head.php';
if($user['level']<7){
header('location: /'); 
$_SESSION['err'] = 'Доступно только с 7 уровня';}
$lot = intval($_GET['id']);
$req = mysql_query("SELECT * FROM `master` WHERE `usr` = '".$user['id']."' and `lot` = '".$lot."'");
$master = mysql_fetch_array($req);
$avto = mysql_num_rows($req);
if($avto>0){$_SESSION['err'] = "Ошибка";
header('Location: /master/');
exit();}
if($user['lot'.$lot.'']!=1 and $lot>1){$_SESSION['err'] = "Ошибка";
header('Location: /master/');
exit();}
if($lot>8 or $lot<1){$_SESSION['err'] = "Ошибка";
header('Location: /master/');
exit();}

print"<div class='foot center'><table  class='foot' width='100%' border='0' cellpadding='0' cellspacing='0' style='padding-top: 5px;'>
<tbody><tr>
<td width='19%'> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&sapfyr'><div class='imgwrap'><img src='/images/icon/res/sapfyr.png'></div>Сапфир</a></td>
<td width='19%'> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&izumrud'><div class='imgwrap'><img src='/images/icon/res/izumrud.png'></div>Изумруд</a></td>
<td width='19%'> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&topaz'><div class='imgwrap'><img src='/images/icon/res/topaz.png'></div>Топаз</a></td>
<td width='19%'> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&rubyn'><div class='imgwrap'><img src='/images/icon/res/rubyn.png'></div>Рубин</a></td>
<td width='19%'> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&almaz'><div class='imgwrap'><img src='/images/icon/res/almaz.png'></div>Алмаз</a></td></td></tbody></table>
</div></div>";
if(isset($_GET['sapfyr'])){
print"<div class='foot center'>Укажите количество</br><div class='empty2'></div><table  class='foot' width='100%' border='0' cellpadding='0' cellspacing='0' style='padding-top: 5px;'>
<tbody><tr>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&sapfyr&kol=1'><div class='imgwrap'><img src='/images/icon/res/sapfyr.png'></div>1</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&sapfyr&kol=2'><div class='imgwrap'><img src='/images/icon/res/sapfyr.png'></div>2</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&sapfyr&kol=3'><div class='imgwrap'><img src='/images/icon/res/sapfyr.png'></div>3</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&sapfyr&kol=4'><div class='imgwrap'><img src='/images/icon/res/sapfyr.png'></div>4</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&sapfyr&kol=5'><div class='imgwrap'><img src='/images/icon/res/sapfyr.png'></div>5</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&sapfyr&kol=6'><div class='imgwrap'><img src='/images/icon/res/sapfyr.png'></div>6</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&sapfyr&kol=7'><div class='imgwrap'><img src='/images/icon/res/sapfyr.png'></div>7</a></td></tbody></table>
</div></div>";}

if(isset($_GET['izumrud'])){
print"<div class='foot center'>Укажите количество</br><div class='empty2'></div><table  class='foot' width='100%' border='0' cellpadding='0' cellspacing='0' style='padding-top: 5px;'>
<tbody><tr>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&izumrud&kol=1'><div class='imgwrap'><img src='/images/icon/res/izumrud.png'></div>1</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&izumrud&kol=2'><div class='imgwrap'><img src='/images/icon/res/izumrud.png'></div>2</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&izumrud&kol=3'><div class='imgwrap'><img src='/images/icon/res/izumrud.png'></div>3</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&izumrud&kol=4'><div class='imgwrap'><img src='/images/icon/res/izumrud.png'></div>4</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&izumrud&kol=5'><div class='imgwrap'><img src='/images/icon/res/izumrud.png'></div>5</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&izumrud&kol=6'><div class='imgwrap'><img src='/images/icon/res/izumrud.png'></div>6</a></td></tbody></table>
</div></div>";}

if(isset($_GET['topaz'])){
print"<div class='foot center'>Укажите количество</br><div class='empty2'></div><table  class='foot' width='100%' border='0' cellpadding='0' cellspacing='0' style='padding-top: 5px;'>
<tbody><tr>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&topaz&kol=1'><div class='imgwrap'><img src='/images/icon/res/topaz.png'></div>1</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&topaz&kol=2'><div class='imgwrap'><img src='/images/icon/res/topaz.png'></div>2</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&topaz&kol=3'><div class='imgwrap'><img src='/images/icon/res/topaz.png'></div>3</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&topaz&kol=4'><div class='imgwrap'><img src='/images/icon/res/topaz.png'></div>4</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&topaz&kol=5'><div class='imgwrap'><img src='/images/icon/res/topaz.png'></div>5</a></td></tbody></table>
</div></div>";}

if(isset($_GET['rubyn'])){
print"<div class='foot center'>Укажите количество</br><div class='empty2'></div><table  class='foot' width='100%' border='0' cellpadding='0' cellspacing='0' style='padding-top: 5px;'>
<tbody><tr>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&rubyn&kol=1'><div class='imgwrap'><img src='/images/icon/res/rubyn.png'></div>1</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&rubyn&kol=2'><div class='imgwrap'><img src='/images/icon/res/rubyn.png'></div>2</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&rubyn&kol=3'><div class='imgwrap'><img src='/images/icon/res/rubyn.png'></div>3</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&rubyn&kol=4'><div class='imgwrap'><img src='/images/icon/res/rubyn.png'></div>4</a></td></tbody></table>
</div></div>";}

if(isset($_GET['almaz'])){
print"<div class='foot center'>Укажите количество</br><div class='empty2'></div><table  class='foot' width='100%' border='0' cellpadding='0' cellspacing='0' style='padding-top: 5px;'>
<tbody><tr>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&almaz&kol=1'><div class='imgwrap'><img src='/images/icon/res/almaz.png'></div>1</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&almaz&kol=2'><div class='imgwrap'><img src='/images/icon/res/almaz.png'></div>2</a></td>
<td> <a class='big-but' href='/master/order?id=".intval($_GET['id'])."&almaz&kol=3'><div class='imgwrap'><img src='/images/icon/res/almaz.png'></div>3</a></td></tbody></table>
</div></div>";}


if(isset($_GET['sapfyr'],$_GET['kol'])){
$sap = intval($_GET['kol']);
if($sap>7 or $sap<1){$_SESSION['err'] = "Ошибка";
header('Location: /master/order');
exit();}
$cena=10*$sap;
$go=floor($cena/100);
$gold=''.$cena.'';
$b=mb_strlen($gold);
$sil=$gold[$b-2].$gold[$b-1];
$t=$sap;
if($cena<100){$skolko='<img src="/images/icon/silver.png">'.$cena.'';}else{$skolko='<img src="/images/icon/gold.png"/>'.$go.' <img src="/images/icon/silver.png"/>'.$sil.'';}
print'<hr><div class="main center" style="padding:7px;">  Стоимость:  '.$skolko.' </br>
Время: '.$t.'ч 0мин</div><hr>
<div class="foot center"><a class="inpc-ar" href="/master/order?id='.intval($_GET['id']).'&sapfyr&kol='.intval($_GET['kol']).'&yes">Заказать</a></div>';
}

if(isset($_GET['izumrud'],$_GET['kol'])){
$sap = intval($_GET['kol']);
if($sap>6 or $sap<1){$_SESSION['err'] = "Ошибка";
header('Location: /master/order');
exit();}
$cena=20*$sap;
$go=floor($cena/100);
$gold=''.$cena.'';
$b=mb_strlen($gold);
$sil=$gold[$b-2].$gold[$b-1];
$t=$sap*2;
if($cena<100){$skolko='<img src="/images/icon/silver.png">'.$cena.'';}else{$skolko='<img src="/images/icon/gold.png"/>'.$go.' <img src="/images/icon/silver.png"/>'.$sil.'';}
print'<hr><div class="main center" style="padding:7px;">  Стоимость:  '.$skolko.' </br>
Время: '.$t.'ч 0мин</div><hr>
<div class="foot center"><a class="inpc-ar" href="/master/order?id='.intval($_GET['id']).'&izumrud&kol='.intval($_GET['kol']).'&yes">Заказать</a></div>';
}

if(isset($_GET['topaz'],$_GET['kol'])){
$sap = intval($_GET['kol']);
if($sap>5 or $sap<1){$_SESSION['err'] = "Ошибка";
header('Location: /master/order');
exit();}
$cena=40*$sap;
$go=floor($cena/100);
$gold=''.$cena.'';
$b=mb_strlen($gold);
$sil=$gold[$b-2].$gold[$b-1];
$t=$sap*4;
if($cena<100){$skolko='<img src="/images/icon/silver.png">'.$cena.'';}else{$skolko='<img src="/images/icon/gold.png"/>'.$go.' <img src="/images/icon/silver.png"/>'.$sil.'';}
print'<hr><div class="main center" style="padding:7px;">  Стоимость:  '.$skolko.' </br>
Время: '.$t.'ч 0мин</div><hr>
<div class="foot center"><a class="inpc-ar" href="/master/order?id='.intval($_GET['id']).'&topaz&kol='.intval($_GET['kol']).'&yes">Заказать</a></div>';
}

if(isset($_GET['rubyn'],$_GET['kol'])){
$sap = intval($_GET['kol']);
if($sap>4 or $sap<1){$_SESSION['err'] = "Ошибка";
header('Location: /master/order');
exit();}
$cena=60*$sap;
$go=floor($cena/100);
$gold=''.$cena.'';
$b=mb_strlen($gold);
$sil=$gold[$b-2].$gold[$b-1];
$t=$sap*6;
if($cena<100){$skolko='<img src="/images/icon/silver.png">'.$cena.'';}else{$skolko='<img src="/images/icon/gold.png"/>'.$go.' <img src="/images/icon/silver.png"/>'.$sil.'';}
print'<hr><div class="main center" style="padding:7px;">  Стоимость:  '.$skolko.' </br>
Время: '.$t.'ч 0мин</div><hr>
<div class="foot center"><a class="inpc-ar" href="/master/order?id='.intval($_GET['id']).'&rubyn&kol='.intval($_GET['kol']).'&yes">Заказать</a></div>';
}
if(isset($_GET['almaz'],$_GET['kol'])){
$sap = intval($_GET['kol']);
if($sap>3 or $sap<1){$_SESSION['err'] = "Ошибка";
header('Location: /master/order');
exit();}
$cena=100*$sap;
$go=floor($cena/100);
$gold=''.$cena.'';
$b=mb_strlen($gold);
$sil=$gold[$b-2].$gold[$b-1];
$t=$sap*8;
if($cena<100){$skolko='<img src="/images/icon/silver.png">'.$cena.'';}else{$skolko='<img src="/images/icon/gold.png"/>'.$go.' <img src="/images/icon/silver.png"/>'.$sil.'';}
print'<hr><div class="main center" style="padding:7px;">  Стоимость:  '.$skolko.' </br>
Время: '.$t.'ч 0мин</div><hr>
<div class="foot center"><a class="inpc-ar" href="/master/order?id='.intval($_GET['id']).'&almaz&kol='.intval($_GET['kol']).'&yes">Заказать</a></div>';
}

if(isset($_GET['sapfyr'],$_GET['kol'],$_GET['yes'])){
if($user['gold']<$cena){
header("Location: /master/");
$_SESSION['err'] = 'Недостаточно золота';exit;}
$sap = intval($_GET['kol']);
$vrem=$t*3600+$time;
$av = mysql_num_rows(mysql_query("SELECT * FROM `task` WHERE `usr`='".$user['id']."' and `status`='2' and `task`='5'"));
if($av>0){mysql_query("UPDATE `task` SET `min` = `min`+'".$sap."'  WHERE `usr`='".$user['id']."' and `status`='2' and `task`='5'");}

mysql_query("INSERT INTO `master` set `usr` = '".$user['id']."', `name` = 'Сапфир', `time` = '".$vrem."', `kol`='".$sap."', `img`='sapfyr', `lot`='".$lot."'");
$rest = mysql_result(mysql_query("SELECT COUNT(*) FROM `logi` WHERE `user_id` = '".$user['id']."' and `text` = 'Сапфир'"),0);
if($rest==0){mysql_query("INSERT INTO `logi` set `user_id` = '".$user['id']."', `text` = 'Сапфир', `time` = '".$time."', `kol`='".$cena."', `kto`='-'");}else{
mysql_query("UPDATE `logi` set `time` = '".$tm."', `kol`=`kol`+'".$cena."', `kto`='-' WHERE `user_id` = '".$user['id']."' and `text` = 'Сапфир'");}

mysql_query("UPDATE `user` SET `gold`=`gold`-'".$cena."'  WHERE `id`='".$user['id']."'");
header("Location: /master/"); 
$_SESSION['message'] = " Работа началась";
}

if(isset($_GET['izumrud'],$_GET['kol'],$_GET['yes'])){
if($user['gold']<$cena){
header("Location: /master/");
$_SESSION['err'] = 'Недостаточно золота';exit;}
$sap = intval($_GET['kol']);
$vrem=$t*3600+$time;
$av = mysql_num_rows(mysql_query("SELECT * FROM `task` WHERE `usr`='".$user['id']."' and `status`='2' and `task`='5'"));
if($av>0){mysql_query("UPDATE `task` SET `min` = `min`+'".$sap."'  WHERE `usr`='".$user['id']."' and `status`='2' and `task`='5'");}

mysql_query("INSERT INTO `master` set `usr` = '".$user['id']."', `name` = 'Изумруд', `time` = '".$vrem."', `kol`='".$sap."', `img`='izumrud', `lot`='".$lot."'");
$rest = mysql_result(mysql_query("SELECT COUNT(*) FROM `logi` WHERE `user_id` = '".$user['id']."' and `text` = 'Изумруд'"),0);
if($rest==0){mysql_query("INSERT INTO `logi` set `user_id` = '".$user['id']."', `text` = 'Изумруд', `time` = '".$time."', `kol`='".$cena."', `kto`='-'");}else{
mysql_query("UPDATE `logi` set `time` = '".$tm."', `kol`=`kol`+'".$cena."', `kto`='-' WHERE `user_id` = '".$user['id']."' and `text` = 'Изумруд'");}
mysql_query("UPDATE `user` SET `gold`=`gold`-'".$cena."'  WHERE `id`='".$user['id']."'");
header("Location: /master/"); 
$_SESSION['message'] = " Работа началась";
}
if(isset($_GET['topaz'],$_GET['kol'],$_GET['yes'])){
if($user['gold']<$cena){
header("Location: /master/");
$_SESSION['err'] = 'Недостаточно золота';exit;}
$sap = intval($_GET['kol']);
$vrem=$t*3600+$time;
$av = mysql_num_rows(mysql_query("SELECT * FROM `task` WHERE `usr`='".$user['id']."' and `status`='2' and `task`='5'"));
if($av>0){mysql_query("UPDATE `task` SET `min` = `min`+'".$sap."'  WHERE `usr`='".$user['id']."' and `status`='2' and `task`='5'");}

mysql_query("INSERT INTO `master` set `usr` = '".$user['id']."', `name` = 'Топаз', `time` = '".$vrem."', `kol`='".$sap."', `img`='topaz', `lot`='".$lot."'");
$rest = mysql_result(mysql_query("SELECT COUNT(*) FROM `logi` WHERE `user_id` = '".$user['id']."' and `text` = 'Топаз'"),0);
if($rest==0){mysql_query("INSERT INTO `logi` set `user_id` = '".$user['id']."', `text` = 'Топаз', `time` = '".$time."', `kol`='".$cena."', `kto`='-'");}else{
mysql_query("UPDATE `logi` set `time` = '".$tm."', `kol`=`kol`+'".$cena."', `kto`='-' WHERE `user_id` = '".$user['id']."' and `text` = 'Топаз'");}
mysql_query("UPDATE `user` SET `gold`=`gold`-'".$cena."'  WHERE `id`='".$user['id']."'");
header("Location: /master/"); 
$_SESSION['message'] = " Работа началась";
}
if(isset($_GET['rubyn'],$_GET['kol'],$_GET['yes'])){
if($user['gold']<$cena){
header("Location: /master/");
$_SESSION['err'] = 'Недостаточно золота';exit;}
$sap = intval($_GET['kol']);
$vrem=$t*3600+$time;
$av = mysql_num_rows(mysql_query("SELECT * FROM `task` WHERE `usr`='".$user['id']."' and `status`='2' and `task`='5'"));
if($av>0){mysql_query("UPDATE `task` SET `min` = `min`+'".$sap."'  WHERE `usr`='".$user['id']."' and `status`='2' and `task`='5'");}

mysql_query("INSERT INTO `master` set `usr` = '".$user['id']."', `name` = 'Рубин', `time` = '".$vrem."', `kol`='".$sap."', `img`='rubyn', `lot`='".$lot."'");
$rest = mysql_result(mysql_query("SELECT COUNT(*) FROM `logi` WHERE `user_id` = '".$user['id']."' and `text` = 'Рубин'"),0);
if($rest==0){mysql_query("INSERT INTO `logi` set `user_id` = '".$user['id']."', `text` = 'Рубин', `time` = '".$time."', `kol`='".$cena."', `kto`='-'");}else{
mysql_query("UPDATE `logi` set `time` = '".$tm."', `kol`=`kol`+'".$cena."', `kto`='-' WHERE `user_id` = '".$user['id']."' and `text` = 'Рубин'");}
mysql_query("UPDATE `user` SET `gold`=`gold`-'".$cena."'  WHERE `id`='".$user['id']."'");
header("Location: /master/"); 
$_SESSION['message'] = " Работа началась";
}
if(isset($_GET['almaz'],$_GET['kol'],$_GET['yes'])){
if($user['gold']<$cena){
header("Location: /master/");
$_SESSION['err'] = 'Недостаточно золота';exit;}
$sap = intval($_GET['kol']);
$vrem=$t*3600+$time;
$av = mysql_num_rows(mysql_query("SELECT * FROM `task` WHERE `usr`='".$user['id']."' and `status`='2' and `task`='5'"));
if($av>0){mysql_query("UPDATE `task` SET `min` = `min`+'".$sap."'  WHERE `usr`='".$user['id']."' and `status`='2' and `task`='5'");}

mysql_query("INSERT INTO `master` set `usr` = '".$user['id']."', `name` = 'Алмаз', `time` = '".$vrem."', `kol`='".$sap."', `img`='almaz', `lot`='".$lot."'");
$rest = mysql_result(mysql_query("SELECT COUNT(*) FROM `logi` WHERE `user_id` = '".$user['id']."' and `text` = 'Алмаз'"),0);
if($rest==0){mysql_query("INSERT INTO `logi` set `user_id` = '".$user['id']."', `text` = 'Алмаз', `time` = '".$time."', `kol`='".$cena."', `kto`='-'");}else{
mysql_query("UPDATE `logi` set `time` = '".$tm."', `kol`=`kol`+'".$cena."', `kto`='-' WHERE `user_id` = '".$user['id']."' and `text` = 'Алмаз'");}
mysql_query("UPDATE `user` SET `gold`=`gold`-'".$cena."'  WHERE `id`='".$user['id']."'");
header("Location: /master/"); 
$_SESSION['message'] = " Работа началась";
}
require_once'../core/foot.php';
?>