Example #1
0
 }
 if (empty($productdescription)) {
     $productdescription = "-";
 }
 if (empty($productcontent)) {
     $productcontent = "-";
 }
 if (empty($productfilename)) {
     $productfilename = "-";
 }
 if ($productfilename == "-") {
     $productfilename = date("YmdHis");
 }
 $productfilename = str_replace(" ", "-", $productfilename);
 $productdata = new Product();
 $existfilename = $productdata->ExistFilename($productfilename, true);
 if ($existfilename == 1) {
     if (strpos($productfilename, "http://") !== 0) {
         exit("指定的文件名已经存在");
     }
 }
 $producttemplets = str_replace("{style}/", "", $producttemplets);
 $nowdate = date("Y-m-d H:i:s");
 if (empty($productadddate)) {
     $productadddate = $nowdate;
 }
 $sql = "INSERT INTO yiqi_product (pid ,name ,cid ,thumb,seotitle ,seokeywords ,seodescription,content ,adddate ,lasteditdate,filename ,templets,status)" . "VALUES (NULL, '{$productname}', '{$productcategory}', '{$productthumb}','{$productseotitle}', '{$productkeywords}', '{$productdescription}', '{$productcontent}', '{$productadddate}', '{$nowdate}','{$productfilename}', '{$producttemplets}', 'ok')";
 $result = $yiqi_db->query(CheckSql($sql));
 if ($result == 1) {
     $pid = $yiqi_db->insert_id;
     $genehtml = getset("urlrewrite")->value;