Location: PHPKode > projects > Modular Site Manager > htdocs/misc/dl_submit.php
<?php
chdir("../");
include "inc/functions.inc.php";
if(!isset($_POST['name']))
{
	header("Location: ".SITE_URL."Download-Submit&serror=noname");
} elseif(!isset($_FILES['download']))
{
	header("Location: ".SITE_URL."Download-Submit&serror=nofile");
} elseif(!$_POST['desc'])
{ 
	header("Location: ".SITE_URL."Download-Submit&serror=nodesc");
} elseif(!$_POST['longdesc'])
{
	header("Location: ".SITE_URL."Download-Submit&serror=nolongdesc");
} else {
	$mysql = new mysql(DB_MAIN);
	$dl = $_FILES['download'];
	if(!is_dir(SITE_PATH."dls/".$_POST['cat']))
	{
		mkdir(SITE_PATH."dls/".$_POST['cat']);
	}
	$dlname = $_COOKIE['user']."-".$_COOKIE['mid']."-".$dl['name'];
	print_r($dl);
	move_uploaded_file($dl['tmp_name'], SITE_PATH."dls/".$_POST['cat']."/".$dlname) or die("Couldn't upload your file");
	$mysql->insert(PRE."downloads", array('name', 'author', 'link', 'date', 'longdesc', 'descr', 'cat'), array($_POST['name'], $_COOKIE['user'], "dls/".$_POST['cat']."/".$dlname, time(), $_POST['longdesc'], $_POST['desc'], $_POST['cat']));
	header("Location: ".SITE_URL."Downloads/".$_POST['cat']);
}
?>
Return current item: Modular Site Manager