-
Notifications
You must be signed in to change notification settings - Fork 0
/
rmvCategory.php
42 lines (33 loc) · 1.13 KB
/
rmvCategory.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
require 'vendor/autoload.php';
use Parse\ParseObject;
use Parse\ParseUser;
use Parse\ParseQuery;
use Parse\ParseException;
use Parse\ParseClient;
use Parse\ParseSessionStorage;
// Start the session
session_start();
$app_id = "kddcodGlyJ6DmGI7FihXt8BsXyOTS09Dgpj8UA49";
$rest_key = "ryU6g6D37JtDqIAnPbTq4SLNmihEIy8kSNPZxlhj";
$master_key = "Fm9X40ewplSIEDTOmYxVdCEN7ge31vgfFwScYr3y";
ParseClient::initialize( $app_id, $rest_key, $master_key );
if(isset($_POST["categoryId"]) && $_POST["categoryId"] != "") {
$query = new ParseQuery("FAQ_Category");
try {
$category = $query->get($_POST["categoryId"]);
$questions = $category->getRelation("Questions");
$questions->getQuery()->each(function($qa) {
$qa->destroy();
});
$category->destroy();
// The object was retrieved successfully.
} catch (ParseException $ex) {
// The object was not retrieved successfully.
// error is a ParseException with an error code and message.
setcookie("modError",$ex->getMessage());
}
}
header("Location: index.php"); /* Redirect browser */
exit();
?>