Esempio n. 1
0
function queryDeleteProject($param, $mysqli)
{
    recursive_trim($param);
    extract($param);
    $stmt = $mysqli->stmt_init();
    if ($stmt->prepare("DELETE FROM `project` WHERE Project_ID=?")) {
        $stmt->bind_param("s", $Project_ID);
        $stmt->execute();
        $stmt->close();
    } else {
        die($stmt->error);
    }
    //Delete all tables and fields, including all stuff related to those tables and fields
    //(table relations, field list sources, etc)
    $mysqli->real_query("SELECT `Table_ID`\n                            FROM `table`\n                            WHERE `Project_ID`='{$Project_ID}'");
    if ($result = $mysqli->use_result()) {
        $mysqli2 = connect_DB();
        while ($data = $result->fetch_assoc()) {
            queryDeleteTable($data, $mysqli2);
        }
    } else {
        die($mysqli->error);
    }
    $result->close();
    //Delete all predefined lists
    $mysqli->real_query("SELECT `List_ID`\n                            FROM `table_fields_predefined_list`\n                            WHERE `Project_ID`='{$Project_ID}'");
    if ($result = $mysqli->use_result()) {
        while ($data = $result->fetch_assoc()) {
            queryDeletePredefinedList($data);
        }
    } else {
        die($mysqli->error);
    }
    $result->close();
    //Delete all database connections
    $stmt = $mysqli->stmt_init();
    if ($stmt->prepare("DELETE FROM database_connection WHERE Project_ID=?")) {
        $stmt->bind_param("s", $Project_ID);
        $stmt->execute();
        $stmt->close();
    } else {
        die($stmt->error);
    }
    unset($_SESSION['Project_ID']);
    unset($_SESSION['Project_Name']);
}
Esempio n. 2
0
        $data = $result->fetch_assoc();
        extract($data);
    } else {
        die($mysqli->error);
    }
    $mysqli->close();
    $mysqli = connect_DB();
    $mysqli->real_query("SELECT `List_Item` \n                            FROM `table_fields_predefined_list_items` \n                            WHERE `List_ID`='{$List_ID}' \n                            ORDER BY `Number`");
} elseif (xsrf_guard()) {
    init_var($_POST['btnCancel']);
    init_var($_POST['btnSubmit']);
    if ($_POST['btnCancel']) {
        header('location: ListView_PredefinedLists.php');
        exit;
    } elseif ($_POST['btnSubmit']) {
        queryDeletePredefinedList($_POST);
        header("location: ../success.php?success_tag=DeletePredefinedLists");
        exit;
    }
}
drawHeader();
drawPageTitle('Delete Predefined List', 'Are you sure you wish to delete this predefined list?');
echo '<input type="hidden" name="List_ID" value="' . $List_ID . '">';
?>
<div class="container_mid">
<fieldset class="top">
Delete List
</fieldset>

<fieldset class="middle">
<table class="input_form">