36439-vm/video_approve.php
2025-11-28 19:14:48 +00:00

28 lines
647 B
PHP

<?php
session_start();
// If the user is not logged in, redirect to the login page.
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit;
}
require_once __DIR__ . '/db/config.php';
if (isset($_GET['id']) && !empty($_GET['id'])) {
$video_id = $_GET['id'];
try {
$pdo = db();
$sql = "UPDATE videos SET status = 'approved' WHERE id = :id";
$stmt = $pdo->prepare($sql);
$stmt->bindParam(':id', $video_id, PDO::PARAM_INT);
$stmt->execute();
} catch (PDOException $e) {
die("Database error: " . $e->getMessage());
}
}
header("Location: admin.php");
exit;
?>