本文整理汇总了PHP中upload_image函数的典型用法代码示例。如果您正苦于以下问题:PHP upload_image函数的具体用法?PHP upload_image怎么用?PHP upload_image使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了upload_image函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setImageAttribute
public function setImageAttribute($value)
{
if ($value instanceof UploadedFile) {
$this->attributes['image'] = upload_image($value, static::$path, 'post.uploaded');
} else {
$this->attributes['image'] = $value;
}
}
开发者ID:pingpongcms,项目名称:post,代码行数:8,代码来源:Post.php
示例2: insert_restaurant
public function insert_restaurant()
{
$requested_mod = $this->uri->segment(2);
if (!$this->acl->hasPermission($requested_mod)) {
redirect('admin/dashboard');
}
if (!empty($_POST)) {
$insert_data['sb_hotel_id'] = $this->input->post('sb_hotel_id');
$insert_data['sb_hotel_restaurant_name'] = $this->input->post('sb_rest_name');
$insert_data['sb_hotel_restaurant_details'] = $this->input->post('sb_rest_desc');
if (array_key_exists("add", $_POST)) {
if (!empty($_FILES['sb_rest_img']['name'])) {
$folderName = RESTAURANT_PIC;
$pic1 = upload_image($folderName, "sb_rest_img");
if ($pic1 != 0) {
$insert_data['sb_rest_image'] = $pic1;
}
}
$r = $this->Restaurant_model->insert_rest($insert_data);
if ($r > 0) {
$this->data['title'] = 'Available Restaurants List';
$this->session->set_flashdata('message', 'New Restaurants added successfully.');
//$this->template->load('page_tpl','restaurant_list_view',$this->data);
} else {
$this->data['title'] = 'Available Restaurants List';
$this->session->set_flashdata('message', 'Some error occured.. Try Again');
//$this->template->load('page_tpl','restaurant_list_view',$this->data);
}
} elseif (array_key_exists("edit", $_POST)) {
$insert_data1['sb_hotel_restaurant_name'] = $this->input->post('sb_rest_name');
$insert_data1['sb_hotel_restaurant_details'] = $this->input->post('sb_rest_desc');
$sb_hotel_restaurant_id = $this->input->post('sb_hotel_restaurant_id');
if ($_FILES['sb_rest_img']['name'] != '') {
$this->unlink_images($sb_hotel_restaurant_id, $insert_data['sb_hotel_id']);
$folderName = RESTAURANT_PIC;
$pic1 = upload_image($folderName, "sb_rest_img");
if ($pic1 != 0) {
$insert_data1['sb_rest_image'] = $pic1;
}
}
$r = $this->Restaurant_model->update_rest($insert_data1, $sb_hotel_restaurant_id, $insert_data['sb_hotel_id']);
if ($r > 0) {
$this->data['title'] = 'Available Restaurants List';
$this->session->set_flashdata('message', 'Restaurants Editted successfully.');
//$this->template->load('page_tpl','restaurant_list_view',$this->data);
} else {
$this->data['title'] = 'Available Restaurants List';
$this->session->set_flashdata('message', 'Some error occured.. Try Again');
//$this->template->load('page_tpl','restaurant_list_view',$this->data);
}
}
} else {
$this->data['title'] = 'Available Restaurants List';
$this->session->set_flashdata('message', 'Image type not valid');
//$this->template->load('page_tpl','restaurant_list_view',$this->data);
}
redirect('admin/Restaurants');
}
开发者ID:JasoonS,项目名称:SebastianServer,代码行数:58,代码来源:Restaurants.php
示例3: uploadPic
public function uploadPic()
{
//include('inc/s3_config.php');
//$bucket = 'akshaytestbucket';
$old_pic_name = $this->input->post('pic_name');
$sb_hotel_user_id = $this->session->userdata('logged_in_user')->sb_hotel_user_id;
if (!empty($_FILES['sb_hotel_user_pic']['name'])) {
// $tempFile = $_FILES['sb_hotel_user_pic']['tmp_name'];
// $ext = $this->getExtension($_FILES['sb_hotel_user_pic']['name']);
// $fileName = $sb_hotel_user_id."_profilepic_".time().".".$ext;
// $targetFile = $targetPath . $fileName ;
// if($s3->putObjectFile($tempFile, BUCKET, $fileName, S3::ACL_PUBLIC_READ) )
// {
// if($old_pic_name !="")
// $result = $s3->deleteObject(BUCKET,$old_pic_name);
// $edit= array(
// 'sb_hotel_user_pic'=>$fileName
// );
// $this->uploadprofilepic_model->uploadPic($edit,$sb_hotel_user_id);
// }
//$folderName=HOTEL_USER_PIC;
$folderName = $sb_hotel_user_id . "_profilepic_";
$pic1 = upload_image($folderName, "sb_hotel_user_pic");
if ($pic1 != 0) {
if ($old_pic_name != "") {
$one = delete_oldpic($old_pic_name);
}
$data["sb_hotel_user_pic"] = $pic1;
$edit = array('sb_hotel_user_pic' => $pic1);
$this->uploadprofilepic_model->uploadPic($edit, $sb_hotel_user_id);
}
}
$this->session->userdata('logged_in_user')->sb_hotel_user_pic = $edit['sb_hotel_user_pic'];
$this->session->set_flashdata('UPLOAD_PROFILEPIC_SUCCESS', UPLOAD_PROFILEPIC_SUCCESS);
redirect('admin/uploadprofilepic');
}
开发者ID:JasoonS,项目名称:SebastianServer,代码行数:36,代码来源:Uploadprofilepic.php
示例4: dirname
<?php
require_once dirname(dirname(__FILE__)) . '/app.php';
need_login();
if ($_POST) {
$update = array('email' => $_POST['email'], 'username' => $_POST['username'], 'realname' => $_POST['realname'], 'zipcode' => $_POST['zipcode'], 'address' => $_POST['address'], 'mobile' => $_POST['mobile'], 'gender' => $_POST['gender'], 'city_id' => $_POST['city_id'], 'qq' => $_POST['qq'], 'city_id' => $_POST['city_id']);
$avatar = upload_image('upload_image', $login_user['avatar'], 'user');
$update['avatar'] = $avatar;
if ($_POST['password'] == $_POST['password2'] && $_POST['password']) {
$update['password'] = $_POST['password'];
}
if (ZUser::Modify($login_user['id'], $update)) {
Session::Set('notice', '修改账户设置成功');
Utility::Redirect(WEB_ROOT . '/account/settings.php ');
} else {
Session::Set('error', '修改账户设置失败');
}
}
$readonly['email'] = defined('UC_API') ? '' : 'readonly';
$readonly['username'] = defined('UC_API') ? 'readonly' : '';
include template('account_settings');
开发者ID:BGCX262,项目名称:zuitu-svn-to-git,代码行数:21,代码来源:settings.php
示例5: upload_image
<?php
if (isset($_POST['male_name'])) {
include_once "../functions.php";
include "../header_db.php";
include "upload.php";
$id = $_POST['id'];
//echo $_POST['male_dob'];
include_once "addslashes_to_POST.php";
$location = "../images/" . $id;
$image_name = upload_image($_FILES, $location);
$has_partner = 0;
if (isset($_POST['female_name'])) {
$has_partner = 1;
}
$sql = "UPDATE s_male SET Name = " . build_value_type($_POST['male_name']) . ", DOB = " . build_value_type($_POST['male_dob']) . ", Email = " . build_value_type($_POST['male_email_id']) . ", Mobile = " . build_value_type($_POST['male_mobile']) . ", Blood_Group = " . build_value_type($_POST['male_blood_group']) . ", Occupation = " . build_value_type($_POST['male_occupation']) . ", off_addr1 = " . build_value_type($_POST['male_off_addr1']) . ", off_addr_area = " . build_value_type($_POST['male_off_area']) . ", off_addr_pin = " . build_value_type((int) $_POST['male_off_pincode']) . ", Office_phone = " . build_value_type($_POST['male_off_phone']) . ", has_partner = " . $has_partner . " WHERE id = " . $_POST['id'] . ";";
$sql .= "UPDATE s_common SET DOM = " . build_value_type($_POST['comm_wedding_date']) . ", res_addr1 = " . build_value_type($_POST['comm_res_addr1']) . ", res_addr_area = " . build_value_type($_POST['comm_res_area']) . ", res_addr_pin = " . build_value_type((int) $_POST['comm_res_pincode']) . ", Residence_Phone = " . build_value_type($_POST['comm_res_phone']) . " WHERE id = " . $_POST['id'] . ";";
$sql .= "UPDATE s_female SET Name = " . build_value_type($_POST['female_name']) . ", DOB = " . build_value_type($_POST['female_dob']) . ", Email = " . build_value_type($_POST['female_email_id']) . ", Mobile = " . build_value_type($_POST['female_mobile']) . ", Blood_Group = " . build_value_type($_POST['female_blood_group']) . ", Occupation = " . build_value_type($_POST['female_occupation']) . ", has_partner = " . $has_partner . " WHERE id = " . ($_POST['id'] + 1) . ";";
$no_of_kids = (int) $_POST['no_of_kids'];
if ($no_of_kids > 0) {
$kids_start_id = $_POST['kid_id'];
for ($i = 0; $i < $no_of_kids; $i++) {
$sql .= "UPDATE s_kids SET Name = " . build_value_type($_POST['kid_name' . $i]) . ", DOB = " . build_value_type($_POST['kid_dob' . $i]) . ", Email = " . build_value_type($_POST['kid_email_id' . $i]) . ", Mobile = " . build_value_type($_POST['kid_mobile_no' . $i]) . ", Blood_Group = " . build_value_type($_POST['kid_blood_group' . $i]) . " WHERE id = " . $kids_start_id . ";";
$kids_start_id++;
}
}
if (mysqli_multi_query($connection, $sql)) {
mysqli_close($connection);
header("Location:index.php");
}
}
开发者ID:dturakhia,项目名称:ryametrostar,代码行数:31,代码来源:edit_user.php
示例6: update
public function update()
{
$id = isset($_POST['id']) ? intval($_POST['id']) : 0;
$data = $_POST;
$data['id'] = $id;
$data['is_complete'] = isset($data['is_complete']) ? SERIES_STATUS_COMPLETE : SERIES_STATUS_ONGOING;
$obj = $this->Series_model->getById($id);
$data['thumbnail'] = $obj['thumbnail'];
$message = $this->validate($data, TRUE);
if (!empty($message)) {
set_flash_error($message);
}
$listGenre = $this->Genre_model->getAll();
$defaultGenre = isset($data['genre']) ? $data['genre'] : array();
$genreSelectbox = selectBox($listGenre, array('Name' => 'genre[]', 'multiple' => 'multiple', 'size' => 10, 'Selected' => $defaultGenre));
$data['genreSelectbox'] = $genreSelectbox;
$statusSelectbox = selectBox($this->_config['status'], array('Name' => 'status', 'Selected' => $data['status']));
$data['statusSelectbox'] = $statusSelectbox;
$countrySelectbox = selectBox($this->_config['countries'], array('Name' => 'country', 'Selected' => $data['country']));
$data['countrySelectbox'] = $countrySelectbox;
$typeSelectbox = selectBox($this->_config['video_type'], array('Name' => 'type', 'Selected' => $data['type']));
$data['typeSelectbox'] = $typeSelectbox;
if (!has_error()) {
$canUpdate = FALSE;
if (!empty($_FILES) && !empty($_FILES['thumbnail']['tmp_name'])) {
$result = upload_image($_FILES, SERIE_IMAGE_THUMBNAIL_PATH);
if ($result['error'] != 0) {
$this->layout->title('Edit video');
$this->layout->view('admin_series/edit', $data);
} else {
$data['thumbnail'] = $result['fileName'];
$this->_deleteImage($id);
$canUpdate = TRUE;
}
} else {
$canUpdate = TRUE;
}
if ($canUpdate) {
$id = $this->Series_model->update($id, $data);
$this->Series_Genre_model->deleteBySeriesId($id);
if ($data['genre']) {
foreach ($data['genre'] as $genreId) {
$seriesGenreData = array();
$seriesGenreData['genre_id'] = $genreId;
$seriesGenreData['series_id'] = $id;
$this->Series_Genre_model->insert($seriesGenreData);
}
}
$url = base_url() . 'admin_series/index';
set_flash_message($this->lang->line('admin.series.updated'));
redirect($url);
}
} else {
$this->layout->title('Edit series');
$this->layout->view('admin_series/edit', $data);
}
}
开发者ID:pdkhuong,项目名称:VideoFW,代码行数:57,代码来源:Admin_series.php
示例7: array
if ($_POST) {
$team = $_POST;
$insert = array('title', 'market_price', 'team_price', 'end_time', 'begin_time', 'expire_time', 'min_number', 'max_number', 'summary', 'notice', 'conduser', 'per_number', 'buyonce', 'product', 'image', 'detail', 'userreview', 'systemreview', 'image1', 'image2', 'flv', 'card', 'bonus', 'mobile', 'address', 'fare', 'express', 'delivery', 'user_id', 'state', 'city_id', 'group_id', 'partner_id', 'team_type', 'sort_order', 'condbuy', 'farefree');
$team['user_id'] = $login_user_id;
$team['state'] = 'none';
$team['begin_time'] = strtotime($team['begin_time']);
$team['city_id'] = abs(intval($team['city_id']));
$team['partner_id'] = abs(intval($partner_id));
$team['sort_order'] = 0;
$team['fare'] = abs(intval($team['fare']));
$team['farefree'] = abs(intval($team['farefree']));
$team['end_time'] = strtotime($team['end_time']);
$team['expire_time'] = strtotime($team['expire_time']);
$team['image'] = upload_image('upload_image', null, 'team', true);
$team['image1'] = upload_image('upload_image1', null, 'team');
$team['image2'] = upload_image('upload_image2', null, 'team');
$table = new Table('team', $team);
//team_type == goods
if ($table->team_type == 'goods') {
$table->min_number = 1;
}
$table->SetStrip('detail', 'systemreview', 'notice');
if ($team_id = $table->insert($insert)) {
Session::Set('notice', '新建项目成功, 请耐心等待审核!');
Utility::Redirect(WEB_ROOT . "/biz/index.php");
}
} else {
$profile = Table::Fetch('leader', $login_user_id, 'user_id');
//1
$team = array();
$team['user_id'] = $login_user_id;
开发者ID:hhdem,项目名称:tuangala_v2,代码行数:31,代码来源:coupon_create.php
示例8: verify_image_upload
//.........这里部分代码省略.........
$image_name_t2 = filename_exists($thumb2_folder, $image_name . $thumb2_suffix . $image_ext);
$image_info['thumb2_name'] = $image_name_t2;
$image_info['thumb2'] = TRUE;
if ($thumb2_ratio == 0) {
createthumbnail($filetype, $target_folder . $image_name_full, $thumb2_folder . $image_name_t2, $thumb2_width, $thumb2_height);
} else {
createsquarethumbnail($filetype, $target_folder . $image_name_full, $thumb2_folder . $image_name_t2, $thumb2_width);
}
}
}
if ($delete_original && !$noThumb) {
unlink($target_folder . $image_name_full);
$image_info['image'] = FALSE;
}
}
}
} else {
$image_info = array("error" => 5);
}
if ($image_info['error'] != 0) {
$this->stop();
// return FALSE if possible
switch ($image_info['error']) {
case 1:
// Invalid file size
addNotice('danger', sprintf($locale['df_416'], parsebytesize($this->field_config['max_byte'])));
self::setInputError($this->field_name);
break;
case 2:
// Unsupported image type
addNotice('danger', sprintf($locale['df_417'], ".gif .jpg .png"));
self::setInputError($this->field_name);
break;
case 3:
// Invalid image resolution
addNotice('danger', sprintf($locale['df_421'], $this->field_config['max_width'], $this->field_config['max_height']));
self::setInputError($this->field_name);
break;
case 4:
// Invalid query string
addNotice('danger', $locale['df_422']);
self::setInputError($this->field_name);
break;
case 5:
// Image not uploaded
addNotice('danger', $locale['df_423']);
self::setInputError($this->field_name);
break;
}
$result[$i] = $image_info;
} else {
$result[$i] = $image_info;
}
}
// end for
return $result;
} else {
return array();
}
} else {
if (!empty($_FILES[$this->field_config['input_name']]['name']) && is_uploaded_file($_FILES[$this->field_config['input_name']]['tmp_name']) && $this->safe()) {
$upload = upload_image($this->field_config['input_name'], $_FILES[$this->field_config['input_name']]['name'], $this->field_config['path'], $this->field_config['max_width'], $this->field_config['max_height'], $this->field_config['max_byte'], $this->field_config['delete_original'], $this->field_config['thumbnail'], $this->field_config['thumbnail2'], 1, $this->field_config['path'] . $this->field_config['thumbnail_folder'] . "/", $this->field_config['thumbnail_suffix'], $this->field_config['thumbnail_w'], $this->field_config['thumbnail_h'], 0, $this->field_config['path'] . $this->field_config['thumbnail_folder'] . "/", $this->field_config['thumbnail2_suffix'], $this->field_config['thumbnail2_w'], $this->field_config['thumbnail2_h']);
if ($upload['error'] != 0) {
$this->stop();
switch ($upload['error']) {
case 1:
// Invalid file size
addNotice('danger', sprintf($locale['df_416'], parsebytesize($this->field_config['max_byte'])));
self::setInputError($this->field_name);
break;
case 2:
// Unsupported image type
addNotice('danger', sprintf($locale['df_417'], ".gif .jpg .png"));
self::setInputError($this->field_name);
break;
case 3:
// Invalid image resolution
addNotice('danger', sprintf($locale['df_421'], $this->field_config['max_width'], $this->field_config['max_height']));
self::setInputError($this->field_name);
break;
case 4:
// Invalid query string
addNotice('danger', $locale['df_422']);
self::setInputError($this->field_name);
break;
case 5:
// Image not uploaded
addNotice('danger', $locale['df_423']);
self::setInputError($this->field_name);
break;
}
return $upload;
} else {
return $upload;
}
} else {
return array();
}
}
}
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:101,代码来源:defender.inc.php
示例9: edit_hotel_action
public function edit_hotel_action($hotel_id)
{
$data = $this->input->post();
$requested_mod = 'hotel';
if (!$this->acl->hasPermission($requested_mod)) {
redirect('admin/dashboard');
}
$this->validation_rules = array(array('field' => 'sb_hotel_country', 'label' => 'Country', 'rules' => 'required', 'class' => 'text-danger'), array('field' => 'sb_hotel_state', 'label' => 'State', 'rules' => 'required', 'class' => 'text-danger'), array('field' => 'sb_hotel_city', 'label' => 'City', 'rules' => 'required', 'class' => 'text-danger'), array('field' => 'sb_hotel_address', 'label' => 'Address', 'rules' => 'required', 'class' => 'text-danger'), array('field' => 'sb_hotel_zipcode', 'label' => 'Postal Code', 'rules' => 'required', 'class' => 'text-danger'), array('field' => 'sb_hotel_owner', 'label' => 'Hotel Owner', 'rules' => 'required', 'class' => 'text-danger'), array('field' => 'sb_hotel_website', 'label' => 'Hotel Website', 'rules' => 'required|prep_url', 'class' => 'text-danger'), array('field' => 'sb_hotel_email', 'label' => 'Hotel Email', 'rules' => 'required|valid_email', 'class' => 'text-danger'));
$this->form_validation->set_error_delimiters('<div class="text-danger">', '</div>');
$this->form_validation->set_rules($this->validation_rules);
if ($this->form_validation->run() == FALSE) {
$this->data['action'] = "admin/hotel/edit_hotel_action/{$hotel_id}";
$this->data['countrylist'] = getCountryList();
$this->data['languagelist'] = getAllLanguages();
$this->data['hoteldata'] = $this->Hotel_model->get_hotel_data($hotel_id);
$this->template->load('page_tpl', 'create_hotel', $this->data);
} else {
$this->data['hoteldata'] = $this->Hotel_model->get_hotel_data($hotel_id);
$data["sb_hotel_pic"] = $this->data['hoteldata']['sb_hotel_pic'];
if (!empty($_FILES['sb_hotel_pic']['name'])) {
$folderName = HOTEL_PIC;
$pic1 = upload_image($folderName, "sb_hotel_pic");
if ($pic1 != 0) {
$data["sb_hotel_pic"] = $pic1;
}
}
$hoteldata = array('sb_hotel_category' => $data['sb_hotel_category'], 'sb_hotel_star' => $data['sb_hotel_star'], 'sb_hotel_email' => $data['sb_hotel_email'], 'sb_hotel_website' => $data['sb_hotel_website'], 'sb_hotel_owner' => $data['sb_hotel_owner'], 'sb_hotel_country' => $data['sb_hotel_country'], 'sb_hotel_state' => $data['sb_hotel_state'], 'sb_hotel_city' => $data['sb_hotel_city'], 'sb_hotel_address' => $data['sb_hotel_address'], 'sb_hotel_zipcode' => $data['sb_hotel_zipcode'], 'sb_hotel_pic' => $data['sb_hotel_pic'], 'sb_property_built_month' => $data['sb_property_built_month'], 'sb_property_built_year' => $data['sb_property_built_year'], 'sb_property_open_year' => $data['sb_property_open_year']);
$result = $this->Hotel_model->edit_hotel($hoteldata, $hotel_id);
if ($result == '1') {
$languageresult = $this->Hotel_model->set_hotel_languages($hotel_id, $data['sb_languages']);
$this->session->set_flashdata('category_success', HOTEL_UPDATION_SUCCESS);
redirect("admin/hotel/edit_hotel/{$hotel_id}");
} else {
$this->session->set_flashdata('category_error', HOTEL_UPDATION_FAIL);
redirect("admin/hotel/edit_hotel/{$hotel_id}");
}
}
}
开发者ID:JasoonS,项目名称:SebastianServer,代码行数:38,代码来源:Property.php
示例10: header
<?php
require_once "../../../../maincore.php";
require_once INCLUDES . "infusions_include.php";
require_once INFUSIONS . "al_catalog/infusion_db.php";
if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
$upload_dir = AL_CATALOG_DIR . "uploads/";
header('Content-Type: application/json');
$uploaded = upload_image("file", "", $upload_dir, $catalog_settings['photo_max_width'], $catalog_settings['photo_max_height'], $catalog_settings['max_photo_size'], false, true, true, 0, $upload_dir, "_t1", $catalog_settings['cat_thumb_width'], $catalog_settings['cat_thumb_height'], 0, $upload_dir, "_t2", $catalog_settings['item_thumb_width'], $catalog_settings['item_thumb_height']);
if ($uploaded['error'] == 0) {
$insert = dbquery("INSERT INTO " . DB_AL_CATALOG_IMAGES . " (ctg_image_file,ctg_image_thumb,ctg_image_thumb_item) VALUES ('" . $uploaded['image_name'] . "','" . $uploaded['thumb1_name'] . "','" . $uploaded['thumb2_name'] . "')");
$id = mysql_insert_id();
die('{"jsonrpc" : "2.0", "thumb" : "' . $uploaded['thumb1_name'] . '", "id" : "' . $id . '"}');
} else {
die('{"jsonrpc" : "2.0", "result" : "' . $uploaded['error'] . '"}');
}
}
if (isset($_POST['action']) && $_POST['action'] == "delete_image" && isset($_POST['image_id']) && isnum($_POST['image_id'])) {
$img_result = dbquery("SELECT * FROM " . DB_AL_CATALOG_IMAGES . " WHERE ctg_image_id='" . $_POST['image_id'] . "'");
if (dbrows($img_result)) {
$img_data = dbarray($img_result);
if (file_exists(AL_CATALOG_DIR . "uploads/" . $img_data['ctg_image_file'])) {
unlink(AL_CATALOG_DIR . "uploads/" . $img_data['ctg_image_file']);
}
if (file_exists(AL_CATALOG_DIR . "uploads/" . $img_data['ctg_image_thumb'])) {
unlink(AL_CATALOG_DIR . "uploads/" . $img_data['ctg_image_thumb']);
}
$del = dbquery("DELETE FROM " . DB_AL_CATALOG_IMAGES . " WHERE ctg_image_id='" . $_POST['image_id'] . "'");
}
header('Content-Type: application/json');
echo json_encode(array('status' => 'ok'));
开发者ID:SymbolixDEV,项目名称:AL-PHP-Fusion-Addons,代码行数:31,代码来源:images-upload.php
示例11: redirect
Session::Set('error', '无权操作');
redirect(WEB_ROOT . '/biz/index.php');
}
$team = Table::Fetch('team', $id);
if ($_POST) {
$insert = array('title', 'market_price', 'team_price', 'end_time', 'begin_time', 'expire_time', 'min_number', 'max_number', 'summary', 'notice', 'per_number', 'product', 'image', 'detail', 'userreview', 'systemreview', 'image1', 'image2', 'flv', 'card', 'conduser', 'buyonce', 'bonus', 'delivery', 'mobile', 'address', 'fare', 'express', 'credit', 'user_id', 'city_id', 'group_id', 'partner_id', 'team_type');
$table = new Table('team', $_POST);
$table->SetStrip('detail', 'systemreview', 'notice');
$table->begin_time = strtotime($_POST['begin_time']);
$table->city_id = abs(intval($table->city_id));
$table->partner_id = abs(intval($partner_id));
$table->end_time = strtotime($_POST['end_time']);
$table->expire_time = strtotime($_POST['expire_time']);
$table->image = upload_image('upload_image', $team['image'], 'team', true);
$table->image1 = upload_image('upload_image1', $team['image1'], 'team');
$table->image2 = upload_image('upload_image2', $team['image2'], 'team');
//team_type == goods
if ($table->team_type == 'goods') {
$table->min_number = 1;
}
$error_tip = array();
if (!$error_tip) {
if ($table->update($insert)) {
print $table->title;
$field = strtoupper($table->conduser) == 'Y' ? null : 'quantity';
$now_number = Table::Count('order', array('team_id' => $table->id, 'state' => 'pay'), $field);
$need_update = array('now_number' => $now_number);
/* 增加了总数,未卖完状态 */
if ($table->max_number > $table->now_number) {
$need_update['close_time'] = 0;
}
开发者ID:yunsite,项目名称:hhzuitu,代码行数:31,代码来源:coupon_edit.php
示例12: mb_convert_encoding
$todaypost = $todaypost[0]['todayposts'];
$new_todaypost = $todaypost + 1;
$thread_info = $db->fetch_all("SELECT subject,replies FROM `" . DB_PRE . "forum_thread` WHERE tid = '" . $_GET['tid'] . "'");
$lastpost = $_GET['tid'] . "\t" . $thread_info[0]['subject'] . "\t" . $postinfo['date'] . "\t" . $postinfo['author'];
if (strtoupper($dbcharset) == 'GBK') {
$lastpost = mb_convert_encoding($lastpost, 'GBK', 'UTF-8');
}
$db->query("UPDATE `" . DB_PRE . "forum_forum` SET `lastpost` = '" . $lastpost . "',`todayposts` = '" . $new_todaypost . "' WHERE fid = '" . $_GET['fid'] . "'");
$new_replies = $thread_info[0]['replies'] + 1;
$db->query("UPDATE `" . DB_PRE . "forum_thread` SET `replies` = '" . $new_replies . "',`lastpost` = '" . $postinfo['date'] . "',`lastposter` = '" . $postinfo['author'] . "' WHERE tid = '" . $_GET['tid'] . "'");
//处理上传的图片
if ($_GET['img'] == '1') {
if ($postinfo['ftpimgname'] == '') {
upload_image($_FILES, $_GET['tid'], $pid, $postinfo['authorid'], true);
} else {
upload_image($_FILES, $_GET['tid'], $pid, $postinfo['authorid'], true, $postinfo['ftpimgname']);
}
}
//如果是需要审核的帖子则插入待审核表中
if ($postinfo['verify'] == '-2') {
$db->query("INSERT INTO `" . DB_PRE . "common_moderate` (`id`,`idtype`,`status`,`dateline`) VALUES ('" . $pid . "','pid','0','" . $postinfo['date'] . "')");
}
$code = '200';
$data_array[0] = array('result' => 'reply succ');
} else {
$code = '500';
$data_array[0] = array('result' => 'reply failed');
}
break;
case 'smiley':
$sql = $topic->getSql('smiley');
开发者ID:caidongyun,项目名称:CS,代码行数:31,代码来源:topicpost.php
示例13: abs
$id = abs(intval($_GET['id']));
$store = Table::Fetch('store', $id);
if ( $_POST && $id==$_POST['id'] && $store) {
$table = new Table('store', $_POST);
$table->SetStrip('location', 'other');
$table->region = abs(intval($table->region));
$table->city_id = abs(intval($table->city_id));
$table->open = (strtoupper($table->open)=='Y') ? 'Y' : 'N';
$table->store_logo = upload_image('store_logo',$store['store_logo'],'team');
$table->store_bg = upload_image('store_bg',$store['store_bg'],'team');
$table->store_banner = upload_image('store_banner',$store['store_banner'],'team');
$table->store_small_logo = upload_image('store_small_logo',$store['store_small_logo'],'team');
$table->image = upload_image('image',$store['image'],'team');
$up_array = array(
'name', 'brand', 'city_id', 'longlat', 'region', 'partner_id',
'type', 'telphone', 'address', 'create_time', 'businesszone',
'location', 'other', 'open', 'longlat','head', 'contact','jtxl','yysj','mcard_bizer_no',
'store_logo','store_bg','store_banner','store_small_logo','car_yh','image'
);
$flag = $table->update( $up_array );
if ( $flag ) {
Session::Set('notice', '修改门店信息成功');
redirect( WEB_ROOT . "/manage/store/edit.php?id={$id}");
}
Session::Set('error', '修改门店信息失败');
$store = $_POST;
开发者ID:noikiy,项目名称:mdwp,代码行数:30,代码来源:edit.php
示例14: mb_convert_encoding
$_POST[$k] = mb_convert_encoding($v, 'GBK', 'UTF-8');
}
}
}
if ($_POST['form_submit'] == 'ok') {
$shop_name = trim($_POST['shop_name']);
$shop_info = trim($_POST['shop_info']);
$shop_phone = trim($_POST['shop_phone']);
$shop_address = trim($_POST['shop_address']);
$shop_website = trim($_POST['shop_website']);
$shop_lat = trim($_POST['shop_lat']);
$shop_lng = trim($_POST['shop_lng']);
$class = trim($_POST['class']);
$fuwu = trim($_POST['fuwu']);
$huanjing = trim($_POST['huanjing']);
$pic_array = upload_image($_FILES);
if ($pic_array) {
$shop_pic = $pic_array[0][0];
} else {
$shop_pic = $data_array[0]['shop_pic'] ? $data_array[0]['shop_pic'] : '';
}
if ($_GET['shop_id'] != '') {
$insert_sql = "UPDATE `" . DB_PRE . "common_shoplist` SET `shop_name` = '" . $shop_name . "', `shop_pic` = '" . $shop_pic . "', `shop_info` = '" . $shop_info . "', `shop_name` = '" . $shop_name . "', `shop_phone` = '" . $shop_phone . "', `shop_address` = '" . $shop_address . "', `shop_website` = '" . $shop_website . "', `shop_lat` = '" . $shop_lat . "', `shop_lng` = '" . $shop_lng . "', `class` = '" . $class . "', `fuwu` = '" . $fuwu . "', `huanjing` = '" . $huanjing . "' WHERE `shop_id` =" . $_GET['shop_id'];
} else {
$insert_sql = "INSERT INTO `" . DB_PRE . "common_shoplist` (`shop_id`, `shop_name`, `shop_pic`, `shop_info`, `shop_phone`, `shop_address`, `shop_website`, `shop_lat`, `shop_lng`, `class`, `fuwu`, `huanjing`) VALUES (NULL, '" . $shop_name . "', '" . $shop_pic . "', '" . $shop_info . "', '" . $shop_phone . "', '" . $shop_address . "', '" . $shop_website . "', '" . $shop_lat . "', '" . $shop_lng . "', '" . $class . "', '" . $fuwu . "', '" . $huanjing . "')";
}
$result = $db->query($insert_sql);
if ($result) {
if ($_GET['shop_id'] != '') {
echo '<script>alert("编辑成功");history.back();</script>';
} else {
开发者ID:caidongyun,项目名称:CS,代码行数:31,代码来源:shoplist.add.php
示例15: header
} else {
header("Location: ../index.php?view=list-news&stt=fail");
}
break;
default:
if (isset($_POST['title']) && isset($_FILES['file']['name']) && isset($_POST['tomtat']) && isset($_POST['content']) && isset($_POST['cat_id']) && isset($_POST['hotnews']) && isset($_POST['featured'])) {
$title = $_POST['title'];
$tomtat = $_POST['tomtat'];
$content = $_POST['content'];
$cat_id = $_POST['cat_id'];
$hotnews = $_POST['hotnews'];
$featured = $_POST['featured'];
// rename file image
$temp_name = explode(".", $_FILES["file"]["name"]);
$newfilename = microtime() . "." . end($temp_name);
if (upload_image($_FILES['file'], $newfilename)) {
if ($news_obj->insertNews($title, $newfilename, $tomtat, $content, $cat_id, $hotnews, $featured)) {
header("Location: ../index.php?view=list-news&stt=success");
} else {
header("Location: ../index.php?view=form-news&stt=fail");
}
} else {
if ($news_obj->insertNews($title, '', $tomtat, $content, $cat_id, $hotnews, $featured)) {
header("Location: ../index.php?view=form-news&stt=success");
} else {
header("Location: ../index.php?view=form-news&stt=fail");
}
}
}
break;
}
开发者ID:vudinhkien,项目名称:APTECH,代码行数:31,代码来源:proccess-news.php
示例16: upload_image
<!-- header -->
<div class="header">
<h1>Créer une nouvelle équipe</h1>
</div>
<!-- content -->
<div class="content" id="page">
<?php
// Message à afficher en fin de page
$message = null;
// Accessible uniquement si le user est log
if (isset($_SESSION['username'])) {
// Accessible uniquement si le user est admin
if (isset($_SESSION['admin']) && $_SESSION['admin'] == $is_admin) {
// S'exécute uniquement si le user a posté le résultats des matchs
if (isset($_POST['envoi']) && $_POST['envoi'] == 'yes') {
$saved_image = upload_image($_POST['image_equipe']);
if ($saved_image != 1) {
creer_nouvelle_equipe($_POST['nom_equipe'], $saved_image);
}
}
?>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th class="left">Nom equipe</th>
<th class="text-right">Image equipe</th>
</tr>
</thead>
<tbody>
<form action="admin_creer_equipe.php" method="post">
开发者ID:sbazin1990,项目名称:Prono,代码行数:31,代码来源:admin_creer_equipe.php
示例17: upload_image
<?php
//// UPLOAD IMAGE FUNCTION ///////////////////
echo "hello";
echo upload_image($_FILES['image']);
function upload_image($file)
{
$image_folder = $_SERVER['DOCUMENT_ROOT'] . "upload/";
$e_allowedExt = array("gif", "jpeg", "jpg", "png");
$e_bits = explode('.', $file['name']);
$e_ext = strtolower(array_pop($e_bits));
$e_allowed = "no";
if (!in_array($e_ext, $e_allowedExt)) {
//error message - bad filetype.
#header("location:edit-images.php?id=$id&error=filetype") or die();
} else {
$e_img_target_path = $image_folder . "temp/" . basename($file['name']);
if (move_uploaded_file($file['tmp_name'], $e_img_target_path)) {
//sucess don't give errors.
} else {
//error message - couldn't upload image
#header("location:edit-images.php?id=$id&error=upload");
}
////END ORIGINAL IMAGE UPLOAD AND BEGIN THUMBNAIL UPLOAD
////////////////
////////////////
//LARGE THUMBNAIL
$e_file = basename($file['name']);
$e_file_info = getimagesize($image_folder . "temp/" . $e_file);
$e_width = $e_file_info[0];
$e_height = $e_file_info[1];
开发者ID:awotherspoon-score,项目名称:FSN,代码行数:31,代码来源:temp_image.php
示例18: get_markers_by_category
case 'get_markers_by_category':
get_markers_by_category($_REQUEST['id_categoria']);
break;
case 'add_post':
add_post($_REQUEST['id_user'], $_REQUEST['post_title'], $_REQUEST['post_content']);
break;
case 'get_post':
get_post($_REQUEST['id_post']);
break;
case 'get_comments':
get_comments($_REQUEST['id_post']);
break;
case 'comment_post':
comment_post($_REQUEST['id_post'], $_REQUEST['username'], $_REQUEST['id_user'], $_REQUEST['comment']);
break;
case 'qualify':
qualify($_REQUEST['id_usuario'], $_REQUEST['qualification']);
break;
case 'get_average':
get_average();
break;
case 'upload_image':
upload_image($_FILES, $_REQUEST['id_user'], $_REQUEST['id_post']);
break;
case 'get_image':
get_image($_REQUEST['filename']);
break;
}
} else {
echo 'No se ha realizado solicitud http alguna.';
} <
|
请发表评论