//upload Images //for user log; if ($allow_log == 1) { $remark = 'New slider added'; insert_user_log($con, $_SESSION['user_id'], 4, REMOTE_IP, $remark); } echo "Data was inserted Successful!"; } //end item insert check } else { //if slider_id not empty $update = mysql_query("UPDATE slider SET\r\n\t\t\t\t\t\t\t\t\t\tslider_type_id='{$slider_type_id}', s_title='{$s_title}', s_serial='{$s_serial}', s_status='{$s_status}',\ts_img1='{$new_img}' \r\n\t\t\t\t\t\t\t\t\t\tWHERE slider_id = '{$slider_id}'"); if (!$update) { echo "Opps! Data not updated./e"; } else { upload_img(@$img_tmp, '../../files/slider/' . $exist_img, '../../files/slider/' . $new_img); //upload Images //for user log; if ($allow_log == 1) { $remark = 'Slider Updated'; insert_user_log($con, $_SESSION['user_id'], 5, REMOTE_IP, $remark); } echo "Data was updated Successful!"; } } //end first slider_id check } //end extention check } elseif (empty($slider_img)) { if (empty($slider_id)) { $insert = mysql_query("INSERT INTO slider VALUES ('','{$slider_type_id}','{$s_title}','{$s_serial}','{$s_status}','','','{$slider_img}','','' ) ");
<?php $tbl = new table('promotion'); if (isset($_POST["done"])) { if (test_isset1('promotion', 'name', $_POST['name']) == 0) { $field = 'id,name,url,image'; $str_img = upload_img('image', '../Images/Promotion/', 22, 22); // values $values = format($tbl->getLastId() + 1, 1); $values .= format($_POST["name"], 1); $values .= format($_POST['url'], 1); $values .= format(str_replace('../', '', $str_img), 0); // insertObject($field,$value) $res = $tbl->insertObject($field, $values); if ($res) { echo "OK"; } } else { echo "Lỗi trùng tên. Vui lòng nhập tên khác."; } } ?> <div id="center-column"> <div class="top-bar"> <h1>Thông tin khuyến mãi</h1> <div class="breadcrumbs"><a href="<?php loadPage('promotion'); ?> ">Thông tin khuyến mãi</a> / <a href="#">Thêm</a></div> </div><br />
<?php $tbl = new table('news'); if (isset($_POST["done"])) { // get field $field = 'id,name,details,image,hot,date_add,alias,url,lang'; $str_img = upload_img('image', '../Images/News/', 250, 163); $id = $tbl->getLastId() + 1; $values = format($id, 1); //$values.= format($_POST["catid"],1); $values .= format($_POST["name"], 1); $values .= format($_POST["details"], 1); $values .= format(str_replace('../', '', $str_img), 1); $values .= format(isCheck(isset($_POST["hot"])), 1); $values .= format(time(), 1); $values .= format(rand_name($_POST["name"], $id), 1); $values .= format($_POST["url"], 1); $values .= format('0', 0); // insertObject($field,$value) $res = $tbl->insertObject($field, $values); if ($res) { //var_dump($res); echo "OK"; } } ?> <div id="center-column"> <div class="top-bar"> <h1>Tin tức</h1> <div class="breadcrumbs"><a href="<?php echo loadPage('news');
<?php $tbl = new table('chuyenmuc'); if (isset($_POST["done"])) { if (test_isset1('chuyenmuc', 'alias', $_POST['name']) == 0) { $field = 'id,name,image,ordering,alias'; $str_img = upload_img('image', '../uploads/chuyenmuc/', 30, 30); // values // format($str,$isComma=1) // isCheck($check) $values = format($tbl->getLastId() + 1, 1); $values .= format($_POST["name"], 1); $values .= format(str_replace('../', '', $str_img), 1); $values .= format($_POST['ordering'], 1); $values .= format(convert($_POST["name"]), 0); // insertObject($field,$value) $res = $tbl->insertObject($field, $values); if ($res) { echo "OK"; } } else { echo "Lỗi trùng tên. Vui lòng nhập tên khác."; } } ?> <div id="center-column"> <div class="top-bar"> <h1>Chuyên mục riêng</h1> <div class="breadcrumbs"><a href="<?php echo loadPage('chuyenmuc'); ?>
$update_j_item_sub_cat = mysql_query("UPDATE j_item_sub_cat SET\r\n\t\t\t\t\t\t\t\t\t\t\ti_sub_cat_id = '{$i_sub_cat_id}' WHERE item_id = '{$item_id}'"); if (!$update_j_item_sub_cat) { echo "Opps! Somthing wrong with updating Sub-category./e"; } $delete_j_item_attrib_value = mysql_query("DELETE FROM j_item_attrib_value WHERE item_id = '{$item_id}'"); if (!$delete_j_item_attrib_value) { echo 'Opps! Problem with deleting item attribute./e'; } else { for ($i = 0; $i < count($i_attrib_id); $i++) { //echo $i_attrib_id[$i].'-'.$attribe_value[$i].' '; $join_item_attrib_attribe_value = mysql_query("INSERT INTO j_item_attrib_value VALUES('{$item_id}','{$i_attrib_id[$i]}','{$attribe_value[$i]}','{$attribe_sirial[$i]}')"); if (!$join_item_attrib_attribe_value) { echo "Opps! Somthing wrong for join Item and attribute value./e"; } } upload_img(@$img_tmp, '../../files/items/' . $exist_img, '../../files/items/' . $new_img); //upload Images //for user log; if ($allow_log == 1) { $remark = 'Item Update'; insert_user_log($con, $_SESSION['user_id'], 5, REMOTE_IP, $remark); } echo "Data was updated Successful!"; } } } //end first item_id check } //end extention check /*###########################################*/ } elseif (empty($img)) {
name_color = document.getElementById('name_color'); if(name_color.value=='') { document.getElementById('thong_bao').innerHTML='Vui lòng nhập tên màu sắc!'; name_color.focus(); return false; } } </script> <?php $tbl = new table('img'); if (isset($_POST["done"])) { // get field $field = 'id,proid,name,image'; // upload file $str_img = upload_img('image', '../Images/Products/', 50, 50); // get values $now = mktime(0, 0, 0, date('m'), date('d'), date('Y')); $id = $tbl->getLastId() + 1; $values = format($id, 1); $values .= format($_POST["proid"], 1); $values .= format($_POST["name"], 1); $values .= format(str_replace('../', '', $str_img), 0); // insertObject($field,$value) $res = $tbl->insertObject($field, $values); if ($res) { $thongbao = "OK"; } } ?> <div id="center-column">
function edit_multi_img($root, $dir, $num_img, $tmp_num, $img_name, $tmpimg_name, $w, $h) { if (!is_numeric($num_img) || $num_img == 0) { for ($i = 0; $i < $tmp_num; $i++) { $cuoi = ''; if ($i != $tmp_num - 1) { $cuoi = '(*_^)'; } $filename = $_FILES[$img_name . $i]['name']; if ($filename != '') { $file = $root . $_POST[$tmpimg_name . $i]; if (is_file($file)) { unlink($file); } $file1 = $root . get_thumb($dir, $_POST[$tmpimg_name . $i]); if (is_file($file1)) { unlink($file1); } $image .= str_replace('../', '', upload_img($img_name . $i, $root . $dir, $w, $h)) . $cuoi; } else { $image .= $_POST[$tmpimg_name . $i] . $cuoi; } } } else { for ($i = 0; $i < $tmp_num + $num_img; $i++) { $cuoi = ''; if ($i != $tmp_num + $num_img - 1) { $cuoi = '(*_^)'; } $filename = $_FILES[$img_name . $i]['name']; if ($filename != '') { $file = $root . $_POST[$tmpimg_name . $i]; if (is_file($file)) { unlink($file); } $file1 = $root . get_thumb($dir, $_POST[$tmpimg_name . $i]); if (is_file($file1)) { unlink($file1); } $image .= str_replace('../', '', upload_img($img_name . $i, $root . $dir, $w, $h)) . $cuoi; } else { if ($_POST[$tmpimg_name . $i] != '') { $image .= $_POST[$tmpimg_name . $i] . $cuoi; } } } } $tam = explode('(*_^)', $image); if ($tam[count($tam) - 1] == '') { for ($i = 0; $i < count($tam) - 1; $i++) { $cuoi = ''; if ($i != count($tam) - 2) { $cuoi = '(*_^)'; } $img .= $tam[$i] . $cuoi; } } else { $img = $image; } return $img; }
<?php $tbl = new table('category_bv'); if (isset($_POST["done"])) { if (test_isset1('category_bv', 'alias', $_POST['name']) == 0) { $field = 'id,name,image,details,display,ordering,alias'; $str_img = upload_img('image', '../Images/Category_bv/', 231, 49); // values // format($str,$isComma=1) // isCheck($check) $values = format($tbl->getLastId() + 1, 1); $values .= format($_POST["name"], 1); $values .= format(str_replace('../', '', $str_img), 1); $values .= format($_POST["details"], 1); $values .= format($_POST["detailsDisplay"], 1); $values .= format($_POST['ordering'], 1); $values .= format(convert($_POST["name"]), 0); // insertObject($field,$value) $res = $tbl->insertObject($field, $values); if ($res) { echo "OK"; } } else { echo "Lỗi trùng tên. Vui lòng nhập tên khác."; } } ?> <div id="center-column"> <div class="top-bar"> <h1>Danh mục bài viết</h1> <div class="breadcrumbs"><a href="<?php
<?php require_once "../config.php"; require_once ykfile("source/talker_service.php"); header("Content-type:text/html;charset=utf8"); // 获取数据 保存数据库 $image = upload_img("image"); $name = $_POST['name']; $talkerSer = new TalkerService(); $result = $talkerSer->save_talker($name, $image); // success id fail false if ($result) { echo "保存成功!"; } // 上传图片 function upload_img($file_upload_name) { $imgName = $_FILES["{$file_upload_name}"]['name']; //上传文件的名称 $imgType = $_FILES["{$file_upload_name}"]['type']; //上传文件的类型 $imgSize = $_FILES["{$file_upload_name}"]['size']; //上传文件的大小 $imgTmp_name = $_FILES["{$file_upload_name}"]['tmp_name']; //上传文件在服务器上的临时文件名称 //随机生成一个图片名称 $imgDbName = md5(getUuid()); //截取文件的后缀 $ext = explode(".", $imgName); $ext = $ext[count($ext) - 1]; $savePath = "pages/upload/" . $imgDbName . "." . $ext;
$result = 'CSRF check passed. Form parsed.'; $err_trgr = false; if (isset($_FILES['data']['name']) and $_FILES['data']['name']) { $post_key_arr = array_keys($_FILES['data']['name']); foreach ($post_key_arr as $k => $post_key) { foreach ($_FILES['data'] as $files_key => $files_value) { $upload_files_array[$post_key][$files_key] = $files_value[$post_key]; } } if (isset($upload_files_array) and !empty($upload_files_array)) { foreach ($upload_files_array as $post_key => $upload_array) { if ($upload_array['error'] != 4) { $f_detail = file_name_details($upload_array['name']); if (in_array($f_detail['ext'], $allowed_exts[$post_key])) { $location = get_upload_file_location($post_key, $file_fields[$table_name]); $image_path = upload_img("", $upload_array, $location); $_POST['data'][$post_key] = $image_path['urls'][0]; } else { $er_msg = 'Selected File for <b class="text-danger">' . $post_key . '</b> Field is wrong.<br><div class="well well-sm"><b><i>Allowed File types are</i></b>: <ol>'; foreach ($allowed_exts[$post_key] as $allowed_exts_key => $allowed_exts_val) { $er_msg .= '<li>' . $allowed_exts_val . '</li>'; } $er_msg .= "</ol></div>"; $error_message[] = $er_msg; $err_trgr = true; } } } } } foreach ($_POST['data'] as $post_key => $post_val) {
upload_img(@$img_tmp, '../../files/brand/' . $exist_img, '../../files/brand/' . $new_img); //upload Images //for user log; if ($allow_log == 1) { $remark = 'New brand name added.'; insert_user_log($con, $_SESSION['user_id'], 4, REMOTE_IP, $remark); } echo "Data was inserted Successful!"; } } } else { $update = mysql_query("UPDATE item_brand SET brand_name='{$brand_name}', brand_details='{$brand_details}',\r\n\t\t\t\t\t\t\t\t\t\t\t\tbrand_img = '{$new_img}' WHERE brand_id = '{$brand_id}'"); if (!$update) { echo "Opps! Data not updated./e"; } else { upload_img(@$img_tmp, '../../files/brand/' . $exist_img, '../../files/brand/' . $new_img); //upload Images //for user log; if ($allow_log == 1) { $remark = 'Brand name edited.'; insert_user_log($con, $_SESSION['user_id'], 5, REMOTE_IP, $remark); } echo "Data was update Successful!"; } } } //img extention check } elseif (empty($img)) { //Image Empty if (empty($brand_id) === true) { if (check_single_data_availibility($con, 'item_brand', 'brand_name', $brand_name) === true) {
public function editGrupo($Nick) { $Grupo = $this->roles_model->getGrupo(null, $Nick); if (!$Grupo) { //Si el usuario no existe o es superior al tuyo redirect(base_url('errores/404/')); } elseif (!$this->compareRangos($Grupo)) { set_error("022", 'grupos'); } $this->load->helper('form'); $this->load->library('form_validation'); $this->form_validation->set_rules('GrupoNombre', 'Nombre', 'trim|required|min_length[3]|max_length[45]|xss_clean'); $this->form_validation->set_rules('GrupoDescripcion', 'Descripcion', 'trim|required|min_length[3]|max_length[500]|xss_clean'); $this->form_validation->set_rules('GrupoRango', 'Rango', 'trim|required|is_natural'); if ($this->form_validation->run() == FALSE) { $val_err = validation_errors(); set_error($val_err, 'grupo/' . $Nick, true); } else { $GrupoNombre = set_value('GrupoNombre'); $GrupoDescripcion = set_value('GrupoDescripcion'); $GrupoRango = set_value('GrupoRango'); if (!preg_match('/^[a-z\\d_]{3,20}$/i', $GrupoNombre)) { set_error("024", 'grupos/nuevo'); } $grupo = $this->roles_model->getGrupo(null, $GrupoNombre); if ($grupo && $grupo->GrupoId != $Grupo->GrupoId) { //Si el grupo existe y no es el mismo set_error("005", 'grupo/' . $Nick); } else { $NGrupo = (object) array("GrupoNombre" => $GrupoNombre, "GrupoDescripcion" => $GrupoDescripcion, "GrupoRango" => $GrupoRango); if ($this->compareRangos($NGrupo)) { $useredit = $this->grupos_model->editGrupo($Nick, $NGrupo); if ($useredit) { if (!empty($_FILES['GrupoAvatar']['size'])) { $this->load->helper('uimage'); $avatar = $Grupo->GrupoId . "." . $this->config->item('img_config_gavatar')['sext']; $uimage = upload_img("GrupoAvatar", 'img_config_gavatar', 'grupo/' . $Nick, 'gavatares', $avatar); if ($uimage) { rename($this->config->item('imgrack_apath') . "/gavatares/" . $uimage, $this->config->item('imgrack_apath') . "/gavatares/" . $Grupo->GrupoId . "." . $this->config->item('img_config_gavatar')['sext']); } else { set_error("008", 'grupo/' . $Nick); } } } else { set_error("007", 'grupo/' . $Nick); } set_error("009", 'grupo/' . $GrupoNombre, false, 'success'); } else { set_error("025", 'grupo/' . $Nick); } } } $data['grupo'] = $Grupo; $bread = array(array("bread" => "Grupos", "link" => "grupos"), array("bread" => $Nick)); $this->vista('grupos/edit', $bread, 'Editar Grupo: ' . $Nick, $data, 'editar-grupo'); }
<?php $tbl = new table('baiviet'); if (isset($_POST["done"])) { if (test_isset1('baiviet', 'alias', $_POST['name']) == 0) { $field = 'id,catid,name,image,details,ordering,alias'; $str_img = upload_img('image', '../uploads/category/', 52, 42); // values // format($str,$isComma=1) // isCheck($check) $values = format($tbl->getLastId() + 1, 1); $values .= format($_POST["catid"], 1); $values .= format($_POST["name"], 1); $values .= format(str_replace('../', '', $str_img), 1); $values .= format($_POST["details"], 1); $values .= format($_POST['ordering'], 1); $values .= format(convert($_POST["name"]), 0); // insertObject($field,$value) $res = $tbl->insertObject($field, $values); if ($res) { echo "OK"; } } else { echo "Lỗi trùng tên. Vui lòng nhập tên khác."; } } ?> <div id="center-column"> <div class="top-bar"> <h1>Bài viết</h1> <div class="breadcrumbs"><a href="<?php
return $path; } // Get values from form if (isset($_POST['submit'])) { /* $nimage = $_FILES['news_image'] ; //print_r($nimage); $nheader = $_FILES['news_image']['news_header'] ; $nimage = addslashes(file_get_contents($_FILES['news_image']['tmp_name'])) ; */ $what_hapnn1111 = $_POST['what_hapnn1111']; } $what_hapnn = $_POST['what_hapnn']; $location = $_POST['location']; $date = $_POST['date']; $time = $_POST['time']; $simage = upload_img(); //$category = $_POST['category']; $detail = $_POST['detail']; $tag = $_POST['tag']; //$sharepin =$_POST['share_pin']; /*$query = "SELECT * FROM sharepin where share_pin= '".$_POST['share_pin']."'"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)){ $share_pin = $row['share_pin']; */ $sql = "INSERT INTO share_hapnn (what_hapnn,location,date,time,detail,tag,image)\nVALUES ('" . mysql_real_escape_string($what_hapnn) . "','" . mysql_real_escape_string($location) . "','{$date}','{$time}','" . mysql_real_escape_string($detail) . "', '" . mysql_real_escape_string($tag) . "','" . mysql_real_escape_string($simage) . "')"; $result1 = mysql_query($sql); if ($result1) {
$delete_join = mysql_query("DELETE FROM article_dtl WHERE article_id = '{$article_id}'"); if (!$delete_join) { echo 'Opps! join data not deleted'; } else { $values = array(); foreach ($_POST['ad_head'] as $key => $ad_head) { @($ad_head = mysql_real_escape_string(htmlentities(input_validation($ad_head)))); $ad_article = mysql_real_escape_string(htmlentities(input_validation($_POST['ad_article'][$key]))); $values[] = "('','{$article_id}','{$ad_head}','{$ad_article}','')"; } //$values = implode(',', $values); //print_r($values); $join_query = mysql_query("INSERT INTO article_dtl (art_dtl_id, article_id, ad_head, ad_article, ad_img) \r\n\t\t\t\t\t\t\t\t\t\t\tVALUES " . implode(',', $values)); if (!$join_query) { echo "Opps! something was wrong for Inserting join table./e"; } else { upload_img(@$img_tmp, '../../files/article/' . $exist_img, '../../files/article/' . $new_img); //upload Images //for user log; if ($allow_log == 1) { $remark = 'Article Updated'; insert_user_log($con, $_SESSION['user_id'], 5, REMOTE_IP, $remark); } echo "Data was updated Successful!"; } } //end Delete join } } //end first article_id check } //end extention check
/** * Summary of update_post * @param mixed $post_data * @param mixed $file_data * @param mixed $draft * @return bool|string */ function update_post($post_data, $file_data = '', $draft = null) { $found = true; $errors = ''; $updated_post = create_post_array($post_data); $i = 0; //Check if the post exist to proceed if (post_exist((int) $post_data['id'])) { $posts_file = get_json_content(CONTENTPATH . 'content.json'); $posts =& $posts_file['posts']; // Update database and update image if submitted while ($i < count($posts)) { if ($posts[$i]['id'] === (int) $post_data['id']) { //Avoid updating .content file and url $updated_post['content'] = $posts[$i]['content']; $updated_post['url'] = $posts[$i]['url']; //Set extra settings if ($draft === null) { $updated_post['status'] = $posts[$i]['status']; } else { $updated_post['status'] = $draft === true ? 'DRAFT' : 'ACTIVE'; } //Update image if (!empty($file_data)) { $uploaded = upload_img($file_data, 5000000); $updated_post['image'] = $uploaded['response']; if (!$uploaded['success']) { $errors .= "Your header image was not updated.\r\n"; } } else { $updated_post['image'] = $posts[$i]['image']; } //Place new post in place of old one $posts[$i] = $updated_post; break; } $i++; } //If posts was found and database updated continue with .content and //saving the database if ($found === true) { if (create_content($post_data['url'] . '.content', $post_data['content'])) { if (!write_to_json(CONTENTPATH . 'content.json', $posts_file)) { $errors .= "Your post could not be saved please try again\r\n"; } $errors .= "contentError:Your post could not be saved please try again\r\n"; } } } else { $errors .= "Post could not be found\r\n"; } return empty($errors) ? true : $errors; }
<?php include "../../common/lib.php"; notLogin("../../login.php"); $page_id = $_POST["page_id"]; //画像アップロードの処理 if (isset($_POST['up'])) { //$month = date(Y/m); //サイトのURLを取得 $row_site = site_data(); $site_url = $row_site["site_url"]; //なんかFILEが送られないよ! //var_dump($_FILES["up_img"]); $up_img = upload_img("upload_img", "../../../penguin/upload_img/"); //ファイル形式が画像じゃない場合 if ($up_img == ka_error) { $_SESSION["up_img"] = "<p>アップロードエラー!画像形式は、JPG、GIF、PNGのみアップロード可能。</p>"; url_get("index.php?page_id={$page_id}"); } //画像未選択の場合 if ($up_img == non_error) { $_SESSION["up_img"] = "<p>アップロードエラー!画像ファイルが選択されていません。</p>"; url_get("index.php?page_id={$page_id}"); } $_SESSION["up_img"] = "<p class='nonF'>アップロード完了しました。<br />ファイルのパス:<input type='text' value='{$site_url}/upload_img/{$up_img}' onclick='this.focus();this.select()' readonly='' size='70'></p>"; url_get("index.php?page_id={$page_id}"); } //ポストされてなかったら、各編集画面へ戻す if (!isset($_POST["sub0"]) && !isset($_POST["sub1"])) { url_get("index.php?page_id={$page_id}"); }
$start_time = @$_POST['start_time']; //活动开始时间 $end_time = @$_POST['end_time']; //活动结束时间 $address = @$_POST['address']; //活动地址 $holder = @$_POST['holder']; //活动的举办方 $seo_alt = @$_POST['seo_alt']; //SEO_ALT 图片的alt属性 $seo_keywords = @$_POST['seo_keywords']; //SEO_KEYWORDS的关键词 $seo_title = @$_POST['seo_title']; // 上传图片 $guest_avatar = @upload_img("guest_avatar"); $thumbnail = @upload_img("thumbnail"); date_default_timezone_set("Asia/Shanghai"); $now_time = date("Y-m-d H:i:s"); $act = new ActivityModel(); $act->type = $activity_type; $act->guest_name = $guest_name; $act->guest_avatar = $guest_avatar; $act->guest_intro = $guest_intro; $act->title = $title; $act->summary = $summary; $act->seo_title = $seo_title; $act->thumbnail = $thumbnail; $act->seo_alt = $seo_alt; $act->state = 2; // state 0:待审核, 1:驳回, 2:发布 $act->author->uuid = @$_SESSION['current_user']->uuid;
upload_img(@$img_tmp, '../../files/associate_partner/' . $exist_img, '../../files/associate_partner/' . $new_img); //upload Images //for user log; if ($allow_log == 1) { $remark = 'New associate partner name added.'; insert_user_log($con, $_SESSION['user_id'], 4, REMOTE_IP, $remark); } echo "Data was inserted Successful!"; } } } else { $update = mysql_query("UPDATE associate_partner SET associate_type_id='{$associate_type_id}', asso_partner_name='{$asso_partner_name}', \r\n\t\t\t\t\t\t\t\t\t\t\t\tasso_partner_details='{$asso_partner_details}', asso_partner_contact='{$asso_partner_contact}',\r\n\t\t\t\t\t\t\t\t\t\t\t\tasso_partner_url='{$asso_partner_url}', asso_partner_status='{$asso_partner_status}', asso_partner_img = '{$new_img}' \r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE asso_partner_id='{$asso_partner_id}'"); if (!$update) { echo "Opps! Data not updated./e"; } else { upload_img(@$img_tmp, '../../files/associate_partner/' . $exist_img, '../../files/associate_partner/' . $new_img); //upload Images //for user log; if ($allow_log == 1) { $remark = 'Associate partner name update.'; insert_user_log($con, $_SESSION['user_id'], 5, REMOTE_IP, $remark); } echo "Data was update Successful!"; } } } //img extention check } elseif (empty($img)) { //Image Empty if (empty($asso_partner_id) === true) { if (check_single_data_availibility($con, 'associate_partner', 'asso_partner_name', $asso_partner_name) === true) {
<?php $tbl = new table('category2'); /* * * add to category1 * */ if (isset($_POST["done"])) { if (test_isset2('category2', 'alias', $_POST["catid"], $_POST['name']) == 0) { // get field $field = "id,catid,name,image,ordering,alias"; $str_img = upload_img('image', '../Images/Category2/', 22, 22); $values = format($tbl->getLastId() + 1, 1); $values .= $_POST["catid"] . ','; $values .= format($_POST["name"], 1); $values .= format(str_replace('../', '', $str_img), 1); $values .= format($_POST["ordering"], 1); $values .= format(convert($_POST["name"]), 0); // submit // insertObject($field,$value) $res = $tbl->insertObject($field, $values); if ($res) { echo "OK"; } } else { echo "Lỗi trùng tên. Vui lòng nhập tên khác."; } } ?> <div id="center-column">
} elseif ($password !== $password_again) { echo 'Your password do not match./e'; } else { if (!empty($img)) { //Image Not Empty if (($extension != "gif" || $extension != "jpeg" || $extension != "jpg" || $extension != "png") && !$array_match) { echo $extension . " - is not support for upload./e"; } elseif ($tmp_size > MAX_SIZE * 1024) { echo number_format($img_size / 1024, 2) . "Kb, is Big size file, Not upload./e"; } else { $add_user = add_admin_user($con, $username, $user_name, $email, $password, $dob, $role, $user_contact, $user_address, $user_desc, $new_img, $active, $user_lock, $allow_email, $tac); if ($add_user === true) { if ($send_email == 1) { email($email, 'Your registration have been successfull. ', "Hello " . $user_name . ",\n\nYour username is: " . $email . "\nYour password is: |" . $password . "| \nPlease change your password at first login. \n\nBest Regards\n Tiger Talents Ltd."); } upload_img(@$img_tmp, '', '../../files/profile/' . $new_img); //upload Images //for user log; if ($allow_log == 1) { $remark = 'New admin is created using this ' . $email . '.'; insert_user_log($con, $_SESSION['user_id'], 4, REMOTE_IP, $remark); } echo 'User Successfully added in our system.'; } else { echo 'Oppos, Somthing was worng, please try again./e'; } // } } elseif (empty($img)) { //Image Empty $add_user = add_admin_user($con, $username, $user_name, $email, $password, $dob, $role, $user_contact, $user_address, $user_desc, $img, $active, $user_lock, $allow_email, $tac);
function multi_img_upload($upload_files_array) { foreach ($upload_files_array as $post_key => $upload_array) { if ($upload_array['error'] != 4) { $location = get_upload_file_location($post_key, $file_fields[$table_name]); $image_path = upload_img("", $upload_array, $location); $post_data[$post_key] = "/uploads/album_images/" . $image_path['urls'][0]; } } return $post_data; }
/** * 上传图片接口 * 图片格式要求 */ public function upload_img() { $key = isset($_REQUEST['key']) ? $_REQUEST['key'] : "upload_img"; $ret = upload_img($key); $path = ''; if ($ret['status'] == 0) { $path = $ret['data']; } else { } header("Content-Type: text/html;charset=utf-8"); //前端需要设置这样的header return $path; }
<?php $tbl = new table('nsx'); if (isset($_POST["done"])) { if (test_isset1('nsx', 'alias', $_POST['name']) == 0) { $field = 'id,name,image,ordering,alias'; $str_img = upload_img('image', '../Images/Brand/', 180, 84); // values // format($str,$isComma=1) // isCheck($check) $values = format($tbl->getLastId() + 1, 1); $values .= format($_POST["name"], 1); $values .= format(str_replace('../', '', $str_img), 1); $values .= format($_POST['ordering'], 1); $values .= format(convert($_POST["name"]), 0); // insertObject($field,$value) $res = $tbl->insertObject($field, $values); if ($res) { echo "OK"; } } else { echo "Lỗi trùng tên. Vui lòng nhập tên khác."; } } ?> <div id="center-column"> <div class="top-bar"> <h1>Thương hiệu nổi tiếng</h1> <div class="breadcrumbs"><a href="<?php echo loadPage('nsx'); ?>