최초 커밋
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../skin/member/basic/descope_session.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'].'/egbim/bbs/admin_guard.php';
|
||||
|
||||
if (session_status() !== PHP_SESSION_ACTIVE) session_start();
|
||||
if (!is_qna_admin()) {
|
||||
exit('권한이 없습니다.');
|
||||
}
|
||||
|
||||
$postId = (int)($_POST['post_id'] ?? 0);
|
||||
$status = $_POST['status'] ?? '';
|
||||
|
||||
$allowed = ['new','review','deep','patch','done'];
|
||||
if ($postId < 1 || !in_array($status, $allowed, true)) {
|
||||
exit('잘못된 요청입니다.');
|
||||
}
|
||||
|
||||
try {
|
||||
$pdo = new PDO(
|
||||
"mysql:host=db;dbname=egbim;charset=utf8mb4",
|
||||
'egbim','baron3840!!',
|
||||
[PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION]
|
||||
);
|
||||
$pdo->exec("SET time_zone = '+09:00'");
|
||||
|
||||
$st = $pdo->prepare("UPDATE qa_posts SET status = :st WHERE post_id = :pid");
|
||||
$st->execute([':st'=>$status, ':pid'=>$postId]);
|
||||
|
||||
// detail로 리다이렉트
|
||||
header("Location: /egbim/bbs/descope_qa_detail.php?id={$postId}");
|
||||
exit;
|
||||
|
||||
} catch(Exception $e) {
|
||||
exit('DB 오류: '.$e->getMessage());
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user