<?php
require 'config/db.php';
session_start();
if(!isset($_SESSION['admin_id'])) die("Unauthorized");

$status=$_POST['action']=='approve'?'approved':'rejected';

$st=$pdo->prepare("
UPDATE marketing_ads_daily
SET admin_status=?,
    admin_id=?,
    admin_remark=?,
    admin_at=NOW()
WHERE id=?
");

$st->execute([
 $status,
 $_SESSION['admin_id'],
 $_POST['remark'],
 $_POST['id']
]);

header("Location: admin_ads_list.php");
