discourse-legacysite-perl/site/slowtwitch.com/www/tick/videos.php
2024-06-17 22:30:36 +10:00

160 lines
4.7 KiB
PHP

<?require ("global.php");?>
<?php
$userID = 0;
if (isset($_COOKIE['userID'])) { $userID = $_COOKIE['userID']; }
else { header("Location: /tick/login.html"); }
$stageID = 0;
if (isset($_COOKIE['stageID'])) { $stageID = $_COOKIE['stageID']; }
else { header("Location: /tick/stages.php"); }
$query = "SELECT events.name as event_name, stages.*, DATE_FORMAT(stages.date, '%b %e, %Y') AS datef FROM events, stages WHERE events.ID = stages.eventID AND stages.ID = $stageID AND events.userID = $userID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$event_name = $r['event_name'];
$stage_string = "[${r['datef']}] ${event_name} ${r['name']}";
}
}
mysql_free_result($result);
$ID = 0;
$thumbname = '';
$link = '';
$caption = '';
$courtesy_of = '';
$default_flag = '';
if (isset($_GET['ID']))
{
$ID = $_GET["ID"];
$query = "SELECT * FROM videos WHERE ID = $ID";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$filename = $r['thumbname'];
$link = $r['link'];
$caption = $r['caption'];
$courtesy_of = $r['courtesy_of'];
$default_flag = $r['default_flag'];
}
}
}
?>
<html>
<head>
<title>OneTicker :: Videos</title>
<link rel=stylesheet type="text/css" href="tick.css">
<script src="banner.js" type="text/javascript"></script>
</head>
<body bgcolor=#000000 marginheight=4 marginwidth=15 leftmargin=15 topmargin=4>
<script type="text/javascript">banner(7);</script>
<form name="videos" enctype="multipart/form-data" action="videos_add.php" method="post">
<input type="hidden" name="ID" value="<? echo $ID ?>">
<input type="hidden" name="stageID" value="<? echo $stageID ?>">
<table border=0 cellspacing=1 cellpadding=1 width="480">
<tr>
<td><div class=text><b>Stage:</b></div></td>
<td><div class=text><? echo "$stage_string"; ?></div></td>
</tr>
<tr valign=top>
<td><div class=text><b>Thumbnail:</b></div></td>
<td><div class=text>
<input class=blacktext type=file name="thumbnail" size=40>
<ul>
<li>thumbnail will be resized appropriately</li>
<li>leave blank to keep existing thumbnail</li>
<li>DO NOT put non-alphanumeric characters in filenames</li>
<li>don't forget to activate thumbnails you want visible</li>
</ul>
</div></td>
</tr>
<tr>
<td><div class=text><b>Link:</b></div></td>
<td><input class=blacktext type=text name="link" value="<? echo "$link"; ?>" size=50 maxlength=175></td>
</tr>
<tr>
<td><div class=text><b>Caption:</b></div></td>
<td><input class=blacktext type=text name="caption" value="<? echo "$caption"; ?>" size=50 maxlength=175></td>
</tr>
<tr>
<td><div class=text><b>Credit:</b></div></td>
<td><input class=blacktext type=text name="courtesy_of" value="<? echo "$courtesy_of"; ?>" size=50 maxlength=175></td>
</tr>
<tr>
<td colspan="2" align=center>
<input class=boldtext type="submit" name="submit" value="add/update video"></td>
</tr>
</table>
</form>
<p><table border=0 cellpadding=3 cellspacing=3 bgcolor="#000000" width="640">
<tr valign=top>
<?php
$count = 1;
$query = "SELECT * FROM videos WHERE stageID = $stageID ORDER BY default_flag";
$result = mysql_query($query, $db);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$videoID = $r['ID'];
$link = $r['link'];
$caption = $r['caption'];
$courtesy_of = $r['courtesy_of'];
$thumbname = $r['thumbname'];
$default_flag = $r['default_flag'];
$bgcolor = "#888888";
if ($default_flag == "yes" ) { $bgcolor = "#ffffff"; }
if ($videoID == $ID) { $bgcolor = "#ff6666"; }
echo '<td align=center width="33%"><div class=text>';
echo "<table cellpadding=2 cellspacing=0 border=0 bgcolor=${bgcolor}>";
echo "<tr><td align=center>";
echo "<a target=_blank href=\"${link}\"><img src=\"/tick/images/gallery/${thumbname}\" border=0></a></td></tr></table>";
if ($caption != "") { echo "<br>$caption"; }
if ($courtesy_of != "") { echo "<br><i>by $courtesy_of</i>"; }
echo "<br><a href=\"javascript:popup('videos_remove.php?ID=${videoID}', 'video');\"><img src=\"images/x.gif\" border=0></a>&nbsp;";
echo "[<a href=\"videos.php?ID=${videoID}\">edit</a>]&nbsp;";
if ($default_flag == "yes")
{
echo "[<a href=\"videos_set_default.php?stageID=${stageID}&become=no&ID=${videoID}\">deactivate</a>]";
}
else
{
echo "[<a href=\"videos_set_default.php?stageID=${stageID}&become=yes&ID=${videoID}\">activate</a>]";
}
echo "</div></td>";
if ($count % 3 == 0) { echo "</tr><tr valign=top>"; }
$count++;
}
}
?>
</tr>
</table>
</body>
</html>