Esempio n. 1
0
             echo json_encode($data);
         } else {
             $data["success"] = 0;
             $data["error"] = 1;
             $data["error_message"] = "It was not possible to insert the message in the database!";
             echo json_encode($data);
         }
     }
 } else {
     if ($mode == 'deleteTopic') {
         if (isset($_POST['topic_id']) && $_POST['topic_id'] != '' && isset($_POST['user_name']) && $_POST['user_name'] != '') {
             $user_name = $_POST['user_name'];
             $user_id = $database->getUserDetails($user_name);
             if ($user_id != false) {
                 $topic_id = $_POST['topic_id'];
                 $issameuser = $database->deleteTopic($topic_id, $user_id);
                 if ($issameuser != false) {
                     $data["success"] = 1;
                     $data["error"] = 0;
                     $data["message"] = "The topic was deleted!";
                     echo json_encode($data);
                 } else {
                     $data["success"] = 0;
                     $data["error"] = 1;
                     $data["message"] = "Something went wrong while deleting the topic!";
                     echo json_encode($data);
                 }
             } else {
                 $data["success"] = 0;
                 $data["error"] = 1;
                 $data["message"] = "Something went wrong while deleting the topic!";