PHP WebShell

Текущая директория: /var/www/bitcardoApp/backyard/models/security

Просмотр файла: throttle_actions.php

<?php
// backyard/models/security/throttle_actions.php
declare(strict_types=1);
header('Content-Type: application/json; charset=utf-8');

include_once '../../config/db_config.php';
require_once __DIR__.'/throttle.php';

function out($d, int $code=200){ http_response_code($code); echo json_encode($d); exit; }

try{
  if ($_SERVER['REQUEST_METHOD'] !== 'POST') out(['ok'=>false,'error'=>'Method not allowed'],405);

  $raw = file_get_contents('php://input');
  $js  = json_decode($raw,true) ?: [];
  $action = $js['action'] ?? '';

  if ($action === 'delete') {
      $table = $js['table'] ?? '';
      $idPayload = $js['id'] ?? [];
      $res = th_delete($conn, $table, is_array($idPayload)?$idPayload:[]);
      out($res);
  } else {
      out(['ok'=>false,'error'=>'Unknown action'],400);
  }
}catch(Throwable $e){
  out(['ok'=>false,'error'=>'Server error: '.$e->getMessage()],500);
}

Выполнить команду


Для локальной разработки. Не используйте в интернете!