No video URL provided.
'; } $youtube_id = ''; if (preg_match('/youtube\.com\/watch\?v=([a-zA-Z0-9_\-]+)/', $url, $matches)) { $youtube_id = $matches[1]; } elseif (preg_match('/youtu\.be\/([a-zA-Z0-9_\-]+)/', $url, $matches)) { $youtube_id = $matches[1]; } elseif (preg_match('/youtube\.com\/embed\/([a-zA-Z0-9_\-]+)/', $url, $matches)) { $youtube_id = $matches[1]; } if ($youtube_id) { $embed_url = 'https://www.youtube.com/embed/' . $youtube_id; return ''; } // Fallback for other video URLs return ''; } try { $pdo = db(); $stmt = $pdo->prepare("SELECT * FROM videos WHERE id = ? AND status = 'approved'"); $stmt->execute([$video_id]); $video = $stmt->fetch(); } catch (PDOException $e) { die("Database error: " . $e->getMessage()); } // If no video is found, display a simple message if (!$video) { http_response_code(404); // You can create a nicer 404 page later $page_title = "Video Not Found"; include 'includes/header.php'; // Assuming you create a header file echo "Sorry, the requested video was not found or is not currently available.
Description
Related videos will be shown here.