<?php
session_start();
require_once '../../config/database.php';

if (isset($_POST['gallery_id'])) {
    $id = intval($_POST['gallery_id']);
    $school_id = 2; // Mumbai University ID
    
    $stmt = $pdo->prepare("SELECT video_url, title FROM mum_gallery WHERE id = ? AND school_id = ? AND status = 'active'");
    $stmt->execute([$id, $school_id]);
    $video = $stmt->fetch(PDO::FETCH_ASSOC);
    
    header('Content-Type: application/json');
    if ($video) {
        echo json_encode(['success' => true, 'video_url' => $video['video_url'], 'title' => $video['title']]);
    } else {
        echo json_encode(['success' => false]);
    }
}
?>
