28 lines
647 B
PHP
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;
|
|
?>
|