Ejemplo n.º 1
0
function delete_line($id)
{
    $sql = "SELECT id FROM type WHERE line_id = '{$id}'";
    $sqlresult = mysql_query($sql);
    while ($row = mysql_fetch_assoc($sqlresult)) {
        delete_type($row["id"]);
    }
    $sql = "DELETE FROM line WHERE id = '{$id}'";
    mysql_query($sql);
}
            $list_fields = array('NETID' => 'NETID', $l->g(49) => 'NAME', 'ID' => 'ID', 'MASK' => 'MASK', 'MODIF' => 'NETID', 'SUP' => 'NETID');
            //$list_fields['SUP']='ID';
            $default_fields = $list_fields;
            $list_col_cant_del = $list_fields;
            $result_exist = ajaxtab_entete_fixe($list_fields, $default_fields, $tab_options, $list_col_cant_del);
            echo "<input type = submit value='" . $l->g(116) . "' name='ADD_SUB'>";
        }
    } else {
        msg_warning($method);
    }
} elseif ($protectedPost['onglet'] == 'ADMIN_TYPE') {
    if (isset($protectedPost['Reset_modif'])) {
        unset($protectedPost['MODIF']);
    }
    if (isset($protectedPost['SUP_PROF']) and $protectedPost['SUP_PROF'] != '') {
        delete_type($protectedPost['SUP_PROF']);
        $tab_options['CACHE'] = 'RESET';
    }
    if (isset($protectedPost['Valid_modif'])) {
        $result = add_type($protectedPost['TYPE_NAME'], $protectedPost['MODIF']);
        if ($result) {
            msg_error($result);
            $protectedPost['ADD_TYPE'] = "VALID";
        } else {
            $protectedPost = '';
            $tab_options['CACHE'] = 'RESET';
            $msg_ok = $l->g(1121);
        }
    }
    if ($protectedPost['MODIF'] != '') {
        echo "<input type='hidden' name='MODIF' id='MODIF' value='" . $protectedPost['MODIF'] . "'";
Ejemplo n.º 3
0
            $qty = $_POST['stock_quantity_' . $type_id];
            if ($qty > 0) {
                $stock_sold_out = 0;
            } else {
                $stock_sold_out = 1;
            }
            $_update->yeast($qty, $stock_sold_out, $type_id);
            $product_type_id = $_get->get_type_id($type_id);
            $type_sold_out = $_get->check_type_sold_out($product_type_id);
            $_update->change_type_sold_out($type_sold_out, $product_type_id);
            $product_id = $_get->get_product_id($product_type_id);
            $product_sold_out = $_get->check_product_sold_out($product_id);
            $_update->change_product_sold_out($product_sold_out, $product_id);
            $i++;
        }
        $type = 'success';
        $msg = 'Changes successfully saved';
    } else {
        if ($_POST['stock_action'] == "delete") {
            foreach ($type as $type_id) {
                delete_type($type_id);
            }
            $count = count(type_id);
            $_SESSION['alert'] = "alert-success";
            $_SESSION['msg'] = $count . " item(s) has been successfully deleted ";
        }
    }
    $page = 'self';
    set_alert($type, $msg);
    safe_redirect($page);
}
Ejemplo n.º 4
0
<?php

include "../../connect.php";
include "../../token.php";
include "../../utils.php";
$user = checkToken(2, $result);
if ($user == -1) {
    echo json_encode($result);
    return;
}
$id = addslashes($_POST["id"]);
$sql = "SELECT * FROM type WHERE id = '{$id}'";
$sqlresult = mysql_query($sql);
if ($row = mysql_fetch_assoc($sqlresult)) {
    if (!is_super($user) && $row["author_id"] != $user) {
        header("http/1.1 403 Forbidden");
        $result["error"] = "用户权限不足";
        echo json_encode($result);
        return;
    }
}
delete_type($id);
$result["info"] = "删除成功";
echo json_encode($result);