| Server IP : 10.200.247.200 / Your IP : 216.73.217.19 Web Server : Apache System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64 User : jeremy ( 1001) PHP Version : 8.4.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/church_sites/lvsaints.com_crimsoncliffs/broadcast/ |
Upload File : |
<?php
if(empty($_SERVER['HTTPS']) || $_SERVER['HTTPS']=='off') {
$url = 'https://'.$_SERVER['SERVER_NAME'].'/broadcast/';
header("Location: {$url}");
exit(0);
}
$update_message = '';
$error_message = '';
if(!empty($_POST)) {
switch($_POST['action']) {
case 'update_video':
require_once($_SERVER['DOCUMENT_ROOT'].'/includes/mysql.php');
$do_update = false;
if(!empty($_POST['scrape_for_it'])) {
$res = $db->get_results("SELECT channel_id FROM church_livestream.channel_ids WHERE domain='".$db->clean($_SERVER['HTTP_HOST'])."'");
if(!empty($res)) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_URL,"https://www.youtube.com/channel/{$res[0]->channel_id}");
$buf2 = curl_exec ($ch);
curl_close ($ch);
unset($ch);
if(strpos($buf2,'"videoId":"')!==false) {
$arr = explode('"videoId":"',$buf2);
$id = substr($arr[1],0,strpos($arr[1],'"'));
$iframe_url = 'https://www.youtube.com/embed/'.$id;
$do_update = true;
} else {
$error_message = 'No videos are live right now.';
}
} else {
$error_message = 'Channel ID not found.';
}
} elseif(!empty($_POST['url'])) {
$iframe_url = $_POST['url'];
if(strpos($iframe_url,'embed')===false) {
$arr = explode('?v=',$iframe_url);
if(count($arr)>1) {
$iframe_url = 'https://www.youtube.com/embed/'.$arr[1];
} else {
$arr = explode('/',$_POST['url']);
$iframe_url = 'https://www.youtube.com/embed/'.$arr[count($arr)-1];
}
}
$do_update = true;
}
if($do_update) {
$db->query("INSERT INTO church_livestream.current_livestreams
(
domain
,iframe_url
) VALUES (
'".$db->clean($_SERVER['HTTP_HOST'])."'
,'".$db->clean($iframe_url)."'
)
ON DUPLICATE KEY
UPDATE iframe_url='".$db->clean($iframe_url)."'");
$update_message = 'The YouTube video is updated. You can refresh the main page and it will be there.';
} else {
if(empty($error_message)) {
$error_message = 'You didn\'t put in the link to update';
}
}
break;
}
}
ob_start();
include '../includes/autoload.php';
$page = 'Meadows Edge';
$popup_title = 'Meadows Edge Live';
?>
<style>
.videoWrapper {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
height: 0;
}
.videoWrapper iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>
<center style="margin-bottom:10px;">
<h3>Update the YouTube video</h3>
<?php if(!empty($update_message)) { ?>
<div style="color:#00AA33;font-weight:bold;padding:5px;"><?= $update_message;?></div>
<?php } ?>
<?php if(!empty($error_message)) { ?>
<div style="color:#993333;font-weight:bold;padding:5px;"><?= $error_message;?></div>
<?php } ?>
<form method="post" action="index.php">
<input type="hidden" name="action" value="update_video" />
<input type="hidden" name="scrape_for_it" value="1" />
<div style="margin:10px 0px;"><input type="submit" name="submit" value="Update Automatically" style="font-size:22px;padding:10px;" /></div>
</form>
<br />
<p>If you get an error when clicking the button above, you can copy and paste the new link from youtube here:</p>
<form method="post" action="index.php">
<input type="hidden" name="action" value="update_video" />
<div style="margin:10px 0px;"><input type="text" name="url" placeholder="https://www.youtube.com/watch?v=fc1zdub4K9c" style="width:300px;" /></div>
<div style="margin:10px 0px;"><input type="submit" name="submit" value="Update" /></div>
</form>
</center>
<?php
$pageHtml = ob_get_clean();
include '../includes/layout.php';