File size: 1.12Kb
<?
require_once'../core/system.php';
echo only_reg();
echo ban();
echo blok();
$header='Завершение работы';
require_once'../core/head.php';
if($user['level']<7){
header('location: /');
$_SESSION['err'] = 'Доступно только с 7 уровня';}
$lot = intval($_GET['id']);
$time=time();
$req = mysql_query("SELECT * FROM `master` WHERE `usr` = '$user[id]' and `id` = '$lot'");
$master = mysql_fetch_array($req);
$avto = mysql_num_rows($req);
if($avto==0){$_SESSION['err'] = "Ошибка";
header('Location: /master/');
exit();}
if($master['usr']!=$user['id']){$_SESSION['err'] = "Ошибка";
header('Location: /master/');
exit();}
if($master['time']>$time){$_SESSION['err'] = "Ошибка";
header('Location: /master/');
exit();}
mysql_query("DELETE FROM `master` WHERE `id` = '".$lot."' and `usr` = '".$user[id]."'");
mysql_query("UPDATE `user` SET `$master[img]`=`$master[img]`+'$master[kol]', `master`=`master`+'$master[kol]' WHERE `id`='$user[id]'");
header("Location: /master/"); //,`snow`=`snow`+'$master[kol]'
$_SESSION['message'] = " Работа завершена";
require_once'../core/foot.php';
?>