if (file_exists($target_file)) {
         header("location: ../catAdd.php?in=2");
         $response = "insert=failed";
     }
     if ($_FILES["upload_subcategory_image"]["size"] > 5000000) {
         header("location: ../catAdd.php?in=3");
         $response = "insert=failed";
     }
     if ($imageFileType != "jpg") {
         header("location: ../catAdd.php?in=4");
         $response = "insert=failed";
     }
     if ($response == "insert=success") {
         if (move_uploaded_file($_FILES["upload_category_image"]["tmp_name"], $target_file)) {
             $response = "insert=success";
             updateCat($category_id);
             header("location: ../catAdd.php?in=1");
         } else {
             $response = "insert=failed";
             header("location: ../catAdd.php?in=5");
             if ($_SESSION['is_logged_in'] == false) {
                 header("Location: ../logout.php");
             }
         }
     }
 } else {
     $response = "insert=failed";
     header("location: ../catAdd.php?in=6");
     if ($_SESSION['is_logged_in'] == false) {
         header("Location: ../logout.php");
     }
Exemple #2
0
        $stH = stPrep("UPDATE `categories` SET `sequence` = ? WHERE `ID` = ?");
        $count = 1;
        foreach ($rowArray as $row) {
            stExec($stH, array($count++, $row['ID']));
        }
    }
    return $msg;
}
//Control logic
if ($privs >= 4) {
    //manager or admin
    $msg = '';
    if (isset($_POST['addExe'])) {
        $msg = addCat($cat);
    } elseif (isset($_POST['updExe'])) {
        $msg = updateCat($cat);
    } elseif (isset($_GET['delExe'])) {
        $msg = deleteCat($cat);
    }
    echo "<p class='error'>{$msg}</p>\n\t\t<div class='scrollBoxAd'>\n\t\t<div class='centerBox'>\n";
    if ($mode == 'sort') {
        sortCategories();
        //sort on name
    }
    if ($mode != 'add' and $mode != 'edit' or isset($_POST['back'])) {
        showCategories(false);
        //no add / no edit
    } else {
        editCategory($cat);
        //add or edit
        showCategories(true);
Exemple #3
0
            $count = 1;
            while ($row = mysql_fetch_assoc($rSet)) {
                dbQuery("UPDATE [db]categories SET sequence=" . $count++ . " WHERE category_id = " . $row['cid']);
            }
        }
    }
    return $msg;
}
//Control logic
if ($privs >= 4) {
    //manager or admin
    $msg = '';
    if (isset($_POST['addExe'])) {
        $msg = addCat();
    } elseif (isset($_POST['updExe'])) {
        $msg = updateCat();
    } elseif (isset($_GET['delExe'])) {
        $msg = deleteCat();
    }
    echo "<p class='error'>{$msg}</p>\n\t\t<div class='scrollBoxAd'>\n\t\t<div class='centerBox'>\n";
    if (!$editCat or isset($_POST['back'])) {
        showCategories(false);
        //no edit
    } else {
        editCategory($editCat, $cid);
        //action = "add" or "edit"
        showCategories(true);
        //edit
    }
    echo "</div>\n</div>\n";
} else {