<?php


require_once("syncinclude.php");

$return=3;
$_POST['userID'] = $_POST['euser'];
$_POST['userPWD'] = $_POST['epass'];
if (auth())
{
	
	$return=0;
	//nur BildNr 1 wird ber�cksichtigt
	if (intval($_POST['kArtikelBild'])>0 && $_FILES['bild'])
	{
		//hol categories_id
		$categories_id = getFremdKategorie(intval($_POST['kArtikelBild']));
		$bildname="categories/Kat_".$categories_id.".jpg";
		if (!file_exists(FOLDER_ABSOLUT_CATALOG_PICTURES."categories"))
			mkdir(FOLDER_ABSOLUT_CATALOG_PICTURES."categories",0777);
		move_uploaded_file($_FILES['bild']['tmp_name'],FOLDER_ABSOLUT_CATALOG_PICTURES.$bildname);
		chmod (FOLDER_ABSOLUT_CATALOG_PICTURES.$bildname, 0644);
		//updaten
		eS_execute_query("update categories set categories_picture=\"$bildname\" where categories_id=".$categories_id);
	}
}
echo($return);
logge($return);

?>