Example #1
0
 public function deleteProduct($id, $user_id)
 {
     //storing all the image names into an array so that later on we can delete those images from the folder
     $imageArray = parent::getResultSetAsArray("SELECT file_name FROM apartment_images WHERE dwelling_Id = {$id}");
     //deleting apartment images from the database
     parent::executeSqlQuery("DELETE FROM apartment_images WHERE dwelling_Id = {$id}");
     //storing address id into an array so that we can delete address of the apartment later on
     $address_id = self::getAddressId($id);
     //deleting apartment information such as description, price, etc
     parent::executeSqlQuery("DELETE FROM dwellings WHERE dwelling_Id = {$id}");
     //deleting the pictures from the folder
     for ($row = 0; $row < count($imageArray); $row++) {
         unlink("apartment_images/" . $imageArray[$row]['file_name'] . "");
     }
     //deleting the addresse of apartments
     parent::executeSqlQuery("DELETE FROM address_info WHERE address_id = '{$address_id}'");
 }
Example #2
0
 public function deactivateAccount()
 {
     $user_id = $this->getUserId();
     //get all the conversations of that user
     $allTheConversations = Conversation::displayConversations($user_id);
     //delete all the conversations with all their messages
     for ($row = 0; $row < count($allTheConversations); $row++) {
         Conversation::deleteConversation($allTheConversations[$row]['conversationId']);
     }
     //get all the apartments of this user in an array
     $apartmentArray = Product::displayOwnerProducts($user_id);
     //delete all the selected apartments
     for ($row = 0; $row < count($apartmentArray); $row++) {
         Product::deleteProduct($apartmentArray[$row]['dwelling_Id'], $user_id);
     }
     //delete the user from the database
     parent::executeSqlQuery("DELETE FROM bannedusers WHERE user_id = '{$user_id}'");
     parent::executeSqlQuery("DELETE FROM users WHERE user_id = '{$user_id}'");
     parent::printMessage("MESSAGE", "Your account has been delete successfully!", "login.php");
 }
Example #3
0
 public function unBanUser($user_id)
 {
     $query = "DELETE FROM bannedUsers WHERE user_id = '{$user_id}'";
     Database::executeSqlQuery($query);
     header("location: adminPanel.php?action=user");
 }
 public function deleteAllMessages($conversation_id)
 {
     $query = "DELETE FROM conversation_reply WHERE conversationId = '{$conversation_id}'";
     Database::executeSqlQuery($query);
 }