ForgetUploadAction.class.php 597 B

123456789101112131415161718192021
  1. <?php
  2. class ForgetUploadAction implements IAction {
  3. public function execute() {
  4. $projectId = $_POST['project_id'] ?? $_GET['project_id'];
  5. $userId = $_SESSION['user_id'];
  6. $database = SqliteDatabase::getSingleton();
  7. $sql = "DELETE FROM upload_logs WHERE user_id = :user_id AND project_id = :project_id;";
  8. $preparedQuery = $database->prepare($sql);
  9. $preparedQuery->bindValue(':user_id', $userId);
  10. $preparedQuery->bindValue(':project_id', $projectId);
  11. $result = $preparedQuery->execute();
  12. $data = array(
  13. "message" => "project deleted " . $projectId
  14. );
  15. return $data;
  16. }
  17. }