rendered paste body<?php
/*
* Web-Frontend for the STREAMNIK-IPTV-Server
* Visit www.streamnik.de for details
*
* choose.php lets the user choose an iptv-channel and player
*
* Copyright (C) 2007 Bruno Br�dner
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
include ("inc/conf.inc.php");
// Msamir require ("inc/hash.inc.php");
include_once ("inc/hash.inc.php");
require ("inc/header.inc.php");
require ("inc/time.inc.php");
$ticket = "123456789"; // Dummy, not used in this version
$formaction = "show.php";
$content .= xhtmlheader('STREAMNIK Frontend', '<meta http-equiv="pragma" CONTENT="no-cache">');
$content .= '<body id="body-choose">
';
$content .= '<p class="livehead">
<a href="http://www.streamnik.de"><img src="chrome/streamnik_logo_small.png"
title="STREAMNIK Logo" width="56" height="18" border="0"></a>
STREAMNIK Server Frontend';
include ("inc/dbopen.inc.php"); // Open database
$day = 1; // Used in later versions ...
$now = $timeoffset + time() % 86400; // Current time in seconds since 0:00 h
$content .= '<p class="choose-heading">Choose a channel (at ' . hrtime($now) . ' h):</p>';
$content .= '
<form action="' . $formaction . '" method="post">
<table id="select-video" cellspacing="5">
';
$sql = "SELECT id, name, description FROM channels ORDER BY id ASC";
$q = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($q)){
$nocurrent = 0; // Flag initialisieren
$content .= '<td><input type="radio" name="channel" ';
if ($row['id'] == "1") {
$content .= ' checked="checked" ';
}
$content .= ' value="' .$row['id'] .'"></td>';
$content .= '<td><span class="title">' . $row['name'] . "</span> - <i>" . $row['description']."</i>";
$content .= "<br />Now playing: \n";
// Find out which video is streaming right now
$sqlx = "SELECT V.id, V.title, V.subtitle, V.duration, S.position
FROM videos AS V JOIN schedule AS S
ON V.id = S.video_id
WHERE S.channel_id = ".$row['id']."
AND S.position <= ".$now
." ORDER BY S.position DESC LIMIT 1";
/*
With use of S.day_id (for future versions):
$sqlx = "SELECT V.title, V.subtitle, V.duration, S.position
FROM videos AS V JOIN schedule AS S
ON V.id = S.video_id
WHERE S.day_id = ".$day." AND S.channel_id = ".$row['id']."
AND S.position <= ".$now.' ORDER BY S.position DESC LIMIT 1';
*/
$qq = mysql_query($sqlx) or die(mysql_error());
$rrow = mysql_fetch_array($qq);
if (($rrow['position'] + $rrow['duration']) < $now ) {
$content .= "No Programme at the moment";
$nocurrent = 1; // Flag setzen
}
else {
$content .= '<span class="videotitle">' . $rrow['title']. "</span>" .
'<span class="time"> (since ' . hrtime($rrow['position']).' h)</span><br>';
/* Show preview pics,
* if they are created during upload and saved somewhere (in future versions)
for ($i=1; $i <= 3; $i++) { // 3 preview pics for each video
*
* 1. If nessecary, first copy the preview-pics from a remote server to the
* local file system. Filename is pic_<video-id>.jpg
*
$previewlocation = 'http://foo.bar/previewpics/pic'
. $i. '_' . $rrow['id'] .'.jpg';
if (!copy($previewlocation, $previewpath."pic".$i.'_'.$rrow['id'].".jpg"))
{
print ("failed to copy $previewlocation ...<br>\n");
}
if (file_exists($previewpath."pic".$i."_".$rrow['id'].".jpg"))
{
$content .= '<img src="' . $previewurl.'pic'.$i.'_'.$rrow['id'] .
'.jpg" width="130" alt="Preview"> ';
}
*
* 2. Just link to the preview picture on the remote server
*
$previewlocation = 'http://foo.bar/previewpics/pic'
. $i. '_' . $rrow['id'] .'.jpg';
$previewpic = fopen ($previewlocation, "r");
if (!$previewpic) {
$content .= "No image";
}
else {
$content .= '<img src="http://admin.streamnik.de:88/previewpics/pic'.$i.'_'.$rrow['id'] .
'.jpg" width="130" alt="Preview"> ';
}
}
*/
$content .= "<br><span class=\"link-daylist\">
<a href=\"javascript:void(window.open('guide_fullday.php?channel=1#now',
'daylist', 'width=400,height=600,scrollbars=yes,resizable=yes'))\">Programme Guide</a></span>";
$content .= " | <span class=\"link-url\">
<a href=\"http://streamnik.de:15000/video.ogg?channel=" . $row['id'] . "&ticket="
. $ticket . "&ext=.ogg\"
onclick=\"alert('Used for external player')\">URL</a></span>";
$content .= "</td></tr>";
}
} // End while channels
$content .= '
</table>
';
// Select the player
$content .= '
<br />
<p class="choose-heading">Choose your player:</p>
<table class="choose-select">
<tr><td>
<input type="radio" name="player" value="cortado" checked > Cortado-Player (Java)
</td></tr>
<tr><td>
<input type="radio" name="player" value="mediaplayer"> Windows Media Player (with Ogg-Plugin)
</td></tr>
<tr><td>
<input type="radio" name="player" value="real"> RealPlayer (with Ogg-Plugin)
</td></tr>
<tr><td>
<input type="submit" name="Submit" value="Stream it !">
</td>
</tr>
</table>
</form>
<p> </p>
';
echo $content;
?>
<div id="footer">STREAMNIK Server and Frontend © copyright 2007 STREAMNIK | <a href="http://www.streamnik.de" title="www.streamnik.de">www.streamnik.de</a><br />
Streamnik Logo designed by <a href="http://www.1000sissi.de">1000sissi</a></div>
</body>
</html>