<?php
set_time_limit(0);
session_start();
include("../db.php");
require_once '../widget/widget_categories.php';
require_once '../date.inc';
if(isset($_SESSION['logged_in']) != true) exit;
$dat = new ShowDate(true);
$Categories = new Widget_Categories();
$Msg = '';
if ( isset($_POST['TheFunction']) ){
$uploaddir = '../stills/';
$uploadfile_temp = date('HiSu').rand(1, 10).basename($_FILES['tstill']['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['tstill']['tmp_name'], $uploadfile)) {
exec($config['mogrify'].' -format gif -thumbnail 125x100 "'.realpath($uploadfile).'"');
$imurl = substr(realpath($uploadfile), 0, strlen(realpath($uploadfile)) - 4).'_small.jpg';
//exec('convert "'.$imurl.'" -resize 800x600 "'.realpath($uploadfile).'"');
exec($config['convert'].' "'.realpath($uploadfile).'" -resize 800x600 "'.$imurl.'"');
$sql = 'Insert Into `stills` Set `still_title1` = "'.$_POST['ttitle1'].'" '.
', `still_title2` = "'.$_POST['ttitle2'].'" '.
', `still_date` = "'.$_POST['TheYear'].'-'.$_POST['TheMonth'].'-'.$_POST['TheDay'].'" '.
', `still_url` = "'.$uploadfile_date.'/'.$uploadfile_temp.'" '.
', `still_desc` = "'.$_POST['tstill_desc'].'" '.
', `category_id` = "'.$_POST['tcategory_id'].'" '.
', `taken_by` = "'.$_POST['ttaken_by'].'"';
//echo $sql;
//exit;
mysql_query($sql);
$Msg = 'Your still has been uploaded. You can view the still <a href="../view_still.php?still_id='.mysql_insert_id().'">here</a>';
}
else{
$Msg = 'Error uploading still! 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=Still%20Upload&font_size=12"><br><br></div></td>
</tr>
<tr>
<td><img src="../images/easy_tms.php?text=<?=urlencode('Still Title 1:')?>&font_size=10"></td>
<td><input type="text" name="ttitle1" size="30" maxlength="30"/></td>
</tr>
<tr>
<td><img src="../images/easy_tms.php?text=<?=urlencode('Still Title 2:')?>&font_size=10"></td>
<td><input type="text" name="ttitle2" size="30" maxlength="30"/></td>
</tr>
<tr>
<td><img src="../images/easy_tms.php?text=<?=urlencode('Still File:')?>&font_size=10"></td>
<td><input type="file" name="tstill" size="35"/></td>
</tr>
<tr>
<td><img src="../images/easy_tms.php?text=<?=urlencode('Still 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('Still Description:')?>&font_size=10"></td>
<td>
<textarea rows="6" cols="56" name="tstill_desc" style="font-size:10px; font-family:Arial;"></textarea>
</td>
</tr>
<tr>
<td><img src="../images/easy_tms.php?text=<?=urlencode('This still 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('Still Category')?>&font_size=10"></td>
<td><?=$Categories->Stills_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>