$parent_1 = $oldid; //lay parent tra $fields_arrUpdate1 = array("parent_1" => "'{$parent_1}'"); $resultCodeUpdate1 = update($tableCategoryConfigId, $fields_arrUpdate1, "id=" . $oldid); } foreach ($conf as $ln => $j) { $code = isset($_POST['txtCode']) ? trim($_POST['txtCode']) : ''; $name = isset($_POST['txtName' . $ln]) ? trim($_POST['txtName' . $ln]) : ''; $urlCode1 = strip_tags(isset($_POST['txtUrl' . $ln])) ? strip_tags(trim($_POST['txtUrl' . $ln])) : ''; //xac dinh url----------------- if ($codeParent == '' or $codeParent == '1') { $urlCode = noneUniAlias($name, true); //removeVietnamese($urlCode1," ","-");//lay url tu dong } else { $urlCodeCode = getRecord($tableCategoryConfig, 'id_code=' . $codeParent . " and lang='" . $ln . "'"); $urlCode = noneUniAlias($name, true); //removeVietnamese($urlCode1," ","-");//lay url tu dong } //ket thuc xac dinh url----------------- $title_t = isset($_POST['txtTitle_t' . $ln]) ? trim($_POST['txtTitle_t' . $ln]) : ''; $name = isset($_POST['txtName' . $ln]) ? trim($_POST['txtName' . $ln]) : ''; $subject = isset($_POST['txtSubject' . $ln]) ? trim($_POST['txtSubject' . $ln]) : ''; $detail_short = isset($_POST['txtDetailShort' . $ln]) ? trim($_POST['txtDetailShort' . $ln]) : ''; $keywords = isset($_POST['txtKeywords' . $ln]) ? trim($_POST['txtKeywords' . $ln]) : ''; $description = isset($_POST['txtDescription' . $ln]) ? trim($_POST['txtDescription' . $ln]) : ''; $detail = isset($_POST['txtDetail' . $ln]) ? trim($_POST['txtDetail' . $ln]) : ''; $sort = isset($_POST['txtSort' . $ln]) ? trim($_POST['txtSort' . $ln]) : 0; $status = $_POST['chkStatus' . $ln] != '' ? 1 : 0; $fields_arr = array("havechildren" => "{$havechildren}", "submenu" => "'{$submenu}'", "parent" => "{$codeParent}", "parent_1" => "{$parent_1}", "id_code" => "'{$oldid}'", "code" => "'{$code}'", "type_link" => "'{$type_link}'", "link" => "'{$link}'", "url" => "'{$urlCode}'", "title_t" => "'{$title_t}'", "name" => "'{$name}'", "subject" => "'{$subject}'", "detail_short" => "'{$detail_short}'", "detail" => "'{$detail}'", "keywords" => "'{$keywords}'", "description" => "'{$description}'", "sort" => "{$sort}", "status" => "{$status}", "new" => "'{$new}'", "scores" => "'{$scores}'", "minutes" => "'{$minutes}'", "date_added" => "now()", "last_modified" => "now()", "lang" => "'{$ln}'"); $result = insert($tableCategoryConfig, $fields_arr); $oldidLn = @mysql_insert_id();
//$result = update($tableConfigId,$fields_home,"parent=".$codeParent); $fields_arr1 = array("parent" => "{$codeParent}", "parent_1" => "'{$parent_1}'", "id_member" => "'{$idMember}'", "name_member" => "'{$nameMember}'", "type_member" => "'{$type_member}'", "type_search" => "'{$type_search}'", "discounts" => "'{$discounts}'", "parent2" => "'{$parent2}'", "home" => "'{$home}'", "ldate" => "'{$ldate}'", "price" => "'{$price}'", "link" => "'{$link}'", "sale" => "'{$sale}'", "new" => "'{$new}'", "name" => "'{$name}'", "code" => "'{$code}'", "url" => "'{$urlCode}'", "sort" => "'{$sort}'", "status" => "0", "date_added" => "now()", "last_modified" => "now()"); $result = insert($tableConfigId, $fields_arr1); //die('Error: '.mysql_error()); $oldid = mysql_insert_id(); //lay id vua them vo foreach ($conf as $ln => $j) { if ($defaulType['type_price'] == '2') { //kiem tra gia $price = isset($_POST['txtPrice' . $ln]) ? trim(addslashes($_POST['txtPrice' . $ln])) : ''; //$sale = isset($_POST['txtSale'.$ln]) ? trim($_POST['txtSale'.$ln]) : ''; //$oldprice = isset($_POST['txtOldprice'.$ln]) ? trim($_POST['txtOldprice'.$ln]) : ''; } $name = isset($_POST['txtName' . $ln]) ? trim(addslashes($_POST['txtName' . $ln])) : ''; $defaulUrlLn = trim(addslashes($_POST['txtName' . $ln])); $urlCode = noneUniAlias($defaulUrlLn, true); //lay url tu dong //$detail_short = str_replace("<p>", "", $detail_short); //$detail_short = str_replace("</p>", "", $detail_short); $title_t = isset($_POST['txtTitle_t' . $ln]) ? trim(addslashes($_POST['txtTitle_t' . $ln])) : ''; $detail = isset($_POST['txtDetail' . $ln]) ? trim(addslashes($_POST['txtDetail' . $ln])) : ''; $size = isset($_POST['txtSize' . $ln]) ? trim(addslashes($_POST['txtSize' . $ln])) : ''; $subject = isset($_POST['txtSubject' . $ln]) ? trim(addslashes($_POST['txtSubject' . $ln])) : ''; $detail_short = isset($_POST['txtDetailShort' . $ln]) ? trim(addslashes($_POST['txtDetailShort' . $ln])) : ''; $keywords1 = $_POST['Keywords' . $ln] != '' ? trim(addslashes($_POST['Keywords' . $ln])) : $name; //10 $description1 = $_POST['Description' . $ln] != '' ? trim(addslashes($_POST['Description' . $ln])) : $detail_short; //160 $keywords = removeUtf8(trim(substrNumber(strip_tags($keywords1), '160', ''))); $description = removeUtf8(trim(substrNumber(strip_tags($description1), '160', ''))); //$sort = isset($_POST['txtSort'.$ln]) ? trim($_POST['txtSort'.$ln]) : 0;