Location: PHPKode > projects > Modular Site Manager > htdocs/misc/imgal_submit.php
<?
chdir("../");
include "inc/functions.inc.php";

$image = $_FILES['image'];
$cat = $_POST['cat'];
/*if(empty($_POST['author']))
{
	header("Location: ".SITE_URL."ImGal-Submit&serror=needauthor");
} else*/
if(empty($_POST['alt']))
{
	header("Location: ".SITE_URL."ImGal-Submit&serror=needalt");
}
$imgname = $_COOKIE['user']."-".$_COOKIE['mid']."-".$image['name'];
$thumbname = "thumb-".$_COOKIE['user']."-".$_COOKIE['mid']."-".$image['name'];
$mysql = new mysql(DB_MAIN);
$xpl = explode(".", $image['name']);

if($xpl[1] !== "png" || $xpl[1] !== "gif" || $xpl[1] !== "jpg" || $xpl[1] !== "jpeg")
{
	header("Location: ".SITE_URL."ImGal-Submit&serror=needimage");
}
//copy($image, SITE_PATH."imgs/".$cat."/".$imgname) or die("Couldn't Upload your image!");
move_uploaded_file($image['tmp_name'] , SITE_PATH."imgs/".$cat."/".$imgname);

createthumb(SITE_PATH."imgs/".$cat."/".$imgname, SITE_PATH."imgs/".$cat."/".$thumbname, "150", "150");

$mysql->insert(PRE."imgal", array('author', 'date', 'link', 'thumb', 'cat', 'alt'), array($_COOKIE['user'], time(), $imgname, $thumbname, $_POST['cat'], $_POST['alt']));
$mysql->close();
header("Location: ".SITE_URL."ImGal/".$cat);
?>
Return current item: Modular Site Manager