</td> <td><?php foreach ($v as $gv) { echo getFullUserNameById($gv->drop_id) . '<br>'; } ?> </td> <td><?php foreach ($v as $gv) { echo getFullUserNameById($gv->buyer_id) . '<br>'; } ?> </td> <td><?php foreach ($v as $gv) { $groupItemPkgStatus = getPackageStatus($gv->id); echo $groupItemPkgStatus->time . "<br>"; } ?> </td> <td class="text-center"> <a href="<?php echo $cfg['options']['siteurl']; ?> /dropPkgInfo/<?php echo $gv->id; ?> /outbox"><i class="fa fa-cogs"></i></a> </td> </tr> <?php
function getBuyerInworkPkgs($id) { global $db; $q = "SELECT * FROM `packages` WHERE buyer_id = " . $id . ";"; $pkgs = $db->query($q); $cnt = 0; if (isset($pkgs[0])) { foreach ($pkgs as $pk => $pv) { $status = getPackageStatus($pv->id); if ($status->status_text == 'onbuyer') { $cnt++; } } } return $cnt; }
foreach ($options as $k => $v) { $cfg['options'][$v->option] = $v->value; } } unset($options); // смотрим на авторизацию include $cfg['realpath'] . '/gears/auth_init.php'; // смотрим можно ли if ($user['rankname'] != 'admin' && $user['rankname'] != 'support') { exit(json_encode(array('type' => 'error', 'text' => 'Вы не админ!'))); } /** ============================================================================================================ **/ // фильтруем входящие данные $shop_id = addslashes(strip_tags(filter_input(INPUT_POST, 'shop_id', FILTER_VALIDATE_INT))); //exit(json_encode(array($name, $email, $pass1, $pass2, $rank))); if (!isset($shop_id) || !$shop_id || empty($shop_id)) { exit(json_encode(array('type' => 'error', 'text' => 'ID пусто'))); } $pkgs = getPackages(false); if ($pkgs !== false) { foreach ($pkgs as $pkg) { if (getPackageStatus($pkg->id)->status_text != 'compleate' && $pkg->shop_id == $shop_id) { exit(json_encode(array('type' => 'error', 'text' => 'Этот магазин используется при доставке сейчас.<br>Дождитесь завершения.'))); } } } $q = "DELETE FROM `drops2shippers` WHERE `shop_id` = " . $shop_id; $db->query($q); $q = "DELETE FROM `shops` WHERE `id` = " . $shop_id; $db->query($q); exit(json_encode(array('type' => 'ok', 'text' => 'Магазин удален')));
} } unset($options); // смотрим на авторизацию include $cfg['realpath'] . '/gears/auth_init.php'; $id = addslashes(strip_tags(filter_input(INPUT_POST, 'id', FILTER_VALIDATE_INT))); if (!isset($id)) { exit(json_encode(array('type' => 'error', 'text' => 'ID empty!'))); } if ($id != $user['id']) { exit(json_encode(array('type' => 'error', 'text' => 'Hack attempt!'))); } function getManInfo($id) { $user = getUserInfoById($id); $ret = $user->first_name . ' ' . $user->middle_name . ' ' . $user->last_name . ' | ' . $user->country . ' ' . $user->city . ' ' . $user->state; return $ret; } $q = "\n\tSELECT p.id, p.drop_id, p.*, p.action, pd.currency, pd.item, pd.price\n\tFROM `packages` AS p \n\tLEFT JOIN `pkg_description` AS pd ON pd.pkg_id = p.id \n"; $pkg = $db->query($q); if (isset($pkg[0])) { foreach ($pkg as $k => $v) { $currPkgStatus = getPackageStatus($v->id); if ($currPkgStatus->status_text != 'ondrop') { continue; } else { $v->userInfo = getManInfo($v->drop_id); exit(json_encode(array('type' => 'ok', 'text' => $v))); } } }