<?
session_start();
?><?
require_once("../../config/configDB.php");
require("../inc/yqrdb.php");
require("../inc/resizeToFile.func.php");
$mydb=new yqrdb($config_db);
//$r=$mydb->executeUpdate("insert into shopinfo(shopname) values('ddd')");
//$arr=$mydb->executeQuery("select * from category2");
//print_r($arr);
if(isset($_POST["action"]))
{
$id_parent=$_POST["id_parent"];
$pos=$_POST["pos"];
$nest_level=$_POST["nest_level"];
$title=$_POST["title"];
$description=$_POST["description"];
$picture="";
$active=$_POST["active"];
$iconurl=$_FILES["picture"]["name"];
$picture=basename($iconurl);
if(move_uploaded_file($_FILES["picture"]["tmp_name"],"./".$picture))
{
echo "ÉÏ´«³É¹¦!";
}
resizeToFile($picture,80,80,"icon".$picture,100);
copy("icon".$picture,"../../web/img/categories/".$picture);
unlink("icon".$picture);
unlink($picture);
$sql="insert into ".$config_table["category"]."(id_parent,pos,nest_level,title,description,picture,date_created,active)".
"values ($id_parent,$pos,$nest_level,'$title','$description','$picture',now(),$active)";
$a=$mydb->executeUpdate($sql);
if($a)
{
echo "´´½¨·ÖÀà³É¹¦!";
}
}
?>
<html><head>
<link href="../css/red_theme.css" rel="stylesheet" type="text/css" />
</head>
<body>
<? include("top_bar.php"); ?>
<form action="" method="post" enctype="multipart/form-data" name="form1" id="form1" style="width:400px">
<table width="371" border="0" cellpadding="3">
<tr>
<td width="93">Éϲã±àºÅ</td>
<td width="260">
<input name="id_parent" type="text" value="0" /></td>
</tr>
<tr>
<td>λÖÃ:</td>
<td>
<input name="pos" type="text" value="0" /> </td>
</tr>
<tr>
<td>Éî¶È:</td>
<td>
<input name="nest_level" type="text" value="1" /> </td>
</tr>
<tr>
<td>·ÖÀàÃû³Æ:</td>
<td>
<input type="text" name="title" /> </td>
</tr>
<tr>
<td>ÃèÊö:</td>
<td>
<textarea name="description" rows="5"></textarea></td>
</tr>
<tr>
<td>Ñ¡ÔñͼƬ:</td>
<td>
<input type="file" name="picture" /></td>
</tr>
<tr>
<td>ÊÇ·ñÆôÓÃËü: </td>
<td>
<input name="active" type="radio" value="1" checked="checked" />
yes
<input type="radio" name="active" value="0" />
no</td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Ìá½»" />
<input type="hidden" name="action" value="upload"/>
</td>
<td><input type="reset" name="Submit2" value="ÖØÖÃ" /></td>
</tr>
</table>
</form>
</body></html>