Exemplo n.º 1
0
<?php

require_once '_pm/class.authenticationmgr.php';
require_once 'task/config.inc.php';
mysql_connect($dbs, $dbu, $dbp);
mysql_select_db($dbn);
ob_start();
$autMgr = new AuthenticationManager();
$userID = $autMgr->getUserID();
$userGroup = $autMgr->getUserGroup();
if ($userID == 1 or $userGroup != 5) {
    $autMgr->endSession();
    header('location: /login');
    exit;
}
if (isset($_POST['sID']) && is_numeric($_POST['sID'])) {
    $sID = $_POST['sID'];
} else {
    $sID = 0;
}
if ($sID) {
    $oResult = mysql_query("SELECT accID FROM pm_as_parts WHERE sID='{$sID}' LIMIT 1");
    if ($oResult && mysql_num_rows($oResult)) {
        list($accID) = mysql_fetch_array($oResult);
        @mysql_query("DELETE FROM pm_as_parts_properties WHERE accID='{$accID}'");
        @mysql_query("DELETE FROM pm_as_parts WHERE accID='{$accID}' LIMIT 1");
        @mysql_query("DELETE FROM pm_structure WHERE sID='{$sID}' LIMIT 1");
        print 'Товар удален<br />';
    } else {
        print 'Товар с sID=' . $sID . ' не найден.<br />';
    }