Exemplo n.º 1
0
        exit;
    }
    if ($_POST['btnSubmit'] || $_POST['particularButton']) {
        extract($_POST);
    }
    if ($_POST['btnSubmit']) {
        $errMsg = scriptCheckIfNull('DB Connection', $DB_Connection_ID, 'Table Name', $Table_Name);
        for ($a = 0; $a < $particularsCount; $a++) {
            $b = $a + 1;
            $errMsg .= scriptCheckIfNull("Table page #{$b}", $Page_ID[$a]);
            $Path_Filename[$a] = trim($Folder) . '/' . trim(basename($Filename[$a]));
        }
        if ($errMsg == "") {
            $select = "SELECT `Table_Name` FROM `table` WHERE `Table_Name`='{$Table_Name}' AND `Table_Name`!='{$Orig_Table_Name}' AND Project_ID='{$_SESSION['Project_ID']}'";
            $error = "The table name '{$Table_Name}' already exists. Please choose a new name. <br>";
            $errMsg = scriptCheckIfUnique($select, $error);
            if ($errMsg == "") {
                //Add additional info needed before passing $_POST
                $_POST['Project_ID'] = $_SESSION['Project_ID'];
                $_POST['Path_Filename'] = $Path_Filename;
                queryCreateTable($_POST);
                header("location: ../success.php?success_tag=CreateTables");
                exit;
            }
        }
    }
}
init_var($particularsCount);
if ($particularsCount <= 0) {
    $numParticulars = 6;
}
Exemplo n.º 2
0
require '../Core/SCV2_Core.php';
init_SCV2();
if (xsrf_guard()) {
    init_var($Parent_Field_ID);
    init_var($_POST['btnCancel']);
    init_var($_POST['btnSubmit']);
    extract($_POST);
    if ($_POST['btnCancel']) {
        header("location: ListView_TableRelations.php");
        exit;
    }
    if ($_POST['btnSubmit']) {
        $errMsg = scriptCheckIfNull('Relation', $Relation, 'Parent', $Parent_Field_ID, 'Child', $Child_Field_ID);
        //Check for duplicate
        $errMsg .= scriptCheckIfUnique("SELECT Relation_ID\n                                        FROM table_relations\n                                        WHERE\n                                                `Relation` = '" . $Relation . "' AND\n                                                `Parent_Field_ID` = '" . $Parent_Field_ID . "' AND\n                                                `Child_Field_ID` = '" . $Child_Field_ID . "'", "Cannot add relationship - this relationship already exists!<br />");
        if ($Relation == "ONE-to-ONE") {
            $errMsg .= scriptCheckIfNull('Child Field Subtext', $Child_Field_Subtext);
            if ($errMsg == '') {
                //Check if chosen fields actually exist in parent
                //--Get Table ID
                $Table_ID = '';
                $db_handle = connect_DB();
                $db_handle->real_query("SELECT Table_ID\n                                        FROM `table_fields`\n                                        WHERE Field_ID = '{$Parent_Field_ID}'");
                if ($result = $db_handle->use_result()) {
                    while ($row = $result->fetch_assoc()) {
                        $Table_ID = $row['Table_ID'];
                    }
                    $result->close();
                }
                //--Get the fields of this table