$Title = htmlentities($_POST['title']); $Parent = $_POST['parent']; $Status = $_POST['status'] == "on" ? 'A' : 'I'; $Insert = $DB->execQuery('insert', 'category', 'title,parent_id,status,image,creation_date', "'" . $Title . "'," . $Parent . ",'" . $Status . "','" . $Image . "',NOW()"); $ID = $DB->GetInsertId(); //echo $DB->lastQuery(); die; break; case 'update': $ID = $_POST['id']; $Edit = new Category($ID); if (count($_FILES['img']) > 0) { $Name = "file" . intval(rand() * rand() / rand() + rand()); $Img = new FileData($_FILES['img'], "../../../skin/images/categories/", $Name); if (file_exists($Edit->Data['image'])) { $Img->DeleteFile($Edit->Data['image']); } $Image = $Img->BuildImage(45, 45); $ImgFilter = ",img='" . $Image . "'"; } $Title = htmlentities($_POST['title']); $Parent = $_POST['parent']; $Status = $_POST['status'] == "on" ? 'A' : 'I'; $Insert = $DB->execQuery('update', 'category', "title='" . $Title . "',parent_id=" . $Parent . ",status='" . $Status . "'" . $ImgFilter, "category_id=" . $ID); //echo $DB->lastQuery(); die; break; case 'delete': $ID = $_POST['id']; $DB->execQuery('update', 'category', "status = 'I'", "category_id=" . $ID); die;