jeramie78
08-08-2007, 04:09 AM
Hello ive been working on this addon for my site to upload files but im having problems with the post submit part of it here is my code. The problem is if the user visits the page or you refresh it sumbits blank data to the DB.
require("classes/video.class.php");
$video = new Video(320, 260, "#000"); //width, height, bacground color
$vid = '';
$video->uploaddir = "/home/gamer/public_html/files/flv/";
$video->localdir = "files/flv/";
// thumbnail name must be set for upload function to create movie thumbnail
$thumb = '';
$video->thumbnail_name = "$thumb";
$video->thumbnail_width = 150;
$video->thumbnail_height = 150;
$video->thumbnail_dir = "/home/gamer/public_html/files/thumbs/";
$video->thumbnail_localdir = "files/thumbs/";
$date = date("$time_an"); // Static date
$month = date("F Y"); // Archive month
mysql_query("INSERT INTO ccms_video SET url='$vid', title='$_POST[title]', cat_id='$_POST[cat_id]', date='$date', type='FLV', author='$_POST[creator]', allow_rating='$_POST[ratings]', allow_comments='$_POST[comments]', game='$_POST[game]', platform='$_POST[platform]', timestamp='$timestamp', description='$_POST[description]'");
if(isset($_FILES) && is_array($_FILES) && !empty($_FILES))
{
if(!$vid = $video->upload())
die("failed to upload video");
}
if (!isset($_POST['submit'])) {
echo "FORM DATA GOES HERE! "\n";
}
Any help is much appreciated.
require("classes/video.class.php");
$video = new Video(320, 260, "#000"); //width, height, bacground color
$vid = '';
$video->uploaddir = "/home/gamer/public_html/files/flv/";
$video->localdir = "files/flv/";
// thumbnail name must be set for upload function to create movie thumbnail
$thumb = '';
$video->thumbnail_name = "$thumb";
$video->thumbnail_width = 150;
$video->thumbnail_height = 150;
$video->thumbnail_dir = "/home/gamer/public_html/files/thumbs/";
$video->thumbnail_localdir = "files/thumbs/";
$date = date("$time_an"); // Static date
$month = date("F Y"); // Archive month
mysql_query("INSERT INTO ccms_video SET url='$vid', title='$_POST[title]', cat_id='$_POST[cat_id]', date='$date', type='FLV', author='$_POST[creator]', allow_rating='$_POST[ratings]', allow_comments='$_POST[comments]', game='$_POST[game]', platform='$_POST[platform]', timestamp='$timestamp', description='$_POST[description]'");
if(isset($_FILES) && is_array($_FILES) && !empty($_FILES))
{
if(!$vid = $video->upload())
die("failed to upload video");
}
if (!isset($_POST['submit'])) {
echo "FORM DATA GOES HERE! "\n";
}
Any help is much appreciated.