<?php
set_time_limit(0);
session_start();
include("../db.php");
require_once '../date.inc';
require_once '../widget/widget_categories.php';
if(isset($_SESSION['logged_in']) != true) exit;
$dat = new ShowDate(true);
$Categories = new Widget_Categories();
$Msg = '';
if ( isset($_POST['TheFunction']) ){
$uploaddir = '../videos/';
$uploadfile_temp = date('HiSu').rand(1, 10).basename($_FILES['tvideo']['name']);
$uploadfile_date = date('Y-m-d');
$uploadfile = $uploaddir.$uploadfile_date.'/'.$uploadfile_temp;
if(file_exists($uploaddir.$uploadfile_date.'/') != true){
mkdir($uploaddir.$uploadfile_date.'/');
}
if (move_uploaded_file($_FILES['tvideo']['tmp_name'], $uploadfile)) {
$sql = 'Insert Into `videos` Set `video_title` = "'.$_POST['ttitle'].'" '.
', `video_date` = "'.$_POST['TheYear'].'-'.$_POST['TheMonth'].'-'.$_POST['TheDay'].'" '.
', `video_url` = "'.$uploadfile_date.'/'.$uploadfile_temp.'" '.
', `video_desc` = "'.$_POST['tvideo_desc'].'" '.
', `category_id` = "'.$_POST['tcategory_id'].'"';
//', `taken_by` = "'.$_POST['ttaken_by'].'"';
//echo $sql;
//exit;
mysql_query($sql);
$Msg = 'Your video has been uploaded. You can view the video <a href="../video.php?video_id='.mysql_insert_id().'">here</a>';
}
else{
$Msg = 'Error uploading video! Please ensure that your video is below the allowed size of 100Mb';
}
}
?>
<html>
<head>
<style type="text/css">
<!--
body {
background-color: black;
}
h1{
font-size:20px;
font-family:Arial, Helvetica, sans-serif;
}
div, td, tr, table, p{
font-size:10px;
font-family:Arial, Helvetica, sans-serif;
color:white;
}
a:link {
color:white;
text-decoration: underline;
}
a:visited {
color:white;
text-decoration: underline;
}
a:hover {
text-decoration: underline;
color:white;
}
a:active {
text-decoration: underline;
color:white;
}
input{
font-size:10px;
font-family:Tahoma;
-->
</style>
</head>
<body>
<br>
<form name="DataEntry" method="post" action="<?=$_SERVER['PHP_SELF']?>" enctype="multipart/form-data">
<input type="hidden" name="TheFunction" value="1">
<p> </p>
<div align="center">
<?=$Msg ?>
<table width="230" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2"><div align="center"><img src="../images/easy_tms.php?text=Video%20Upload&font_size=12"><br><br></div></td>
</tr>
<tr>
<td><img src="../images/easy_tms.php?text=<?=urlencode('Video Title: ')?>&font_size=10"></td>
<td><input type="text" name="ttitle" size="30" maxlength="30"/></td>
</tr>
<tr>
<td><img src="../images/easy_tms.php?text=<?=urlencode('Video File:')?>&font_size=10"></td>
<td><input type="file" name="tvideo" size="35"/></td>
</tr>
<tr>
<td><img src="../images/easy_tms.php?text=<?=urlencode('Video Date:')?>&font_size=10"></td>
<td><?= $dat->DayMonthYear_Date( 'TheDay', 'TheMonth', 'TheYear', date('Y-m-d'));?></td>
</tr>
<tr>
<td><img src="../images/easy_tms.php?text=<?=urlencode('Video Description:')?>&font_size=10"></td>
<td>
<textarea rows="6" cols="56" name="tvideo_desc" style="font-size:10px; font-family:Arial;"></textarea>
</td>
</tr>
<!--
<tr>
<td><img src="../images/easy_tms.php?text=<?=urlencode('This video was taken by:')?>&font_size=10"></td>
<td><input type="text" name="ttaken_by" size="62" maxlength="30" /></td>
</tr>
-->
<tr>
<td><img src="../images/easy_tms.php?text=<?=urlencode('Video Category')?>&font_size=10"></td>
<td><?=$Categories->Videos_Combobox('tcategory_id', '')?></td>
</tr>
<tr>
<td colspan="2"><div align="center"><a href="javascript:document.DataEntry.submit();"><br><br<img src="../images/easy_tms.php?text=Upload&font_size=12" border="0"></a></div></td>
</tr>
</table>
</div>
<p align="center"> </p>
</form>
</body>
</html>