本文整理汇总了PHP中ecs_header函数的典型用法代码示例。如果您正苦于以下问题:PHP ecs_header函数的具体用法?PHP ecs_header怎么用?PHP ecs_header使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ecs_header函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: weixin_oauth
function weixin_oauth($callback, $scope = 'BASE')
{
global $db;
$rs = $db->getRow("SELECT * FROM `wxch_config` WHERE `id` = 1");
$param['appid'] = $rs['appid'];
$oauth = intval($_REQUEST['oauth']);
if ($oauth == 0) {
$param['redirect_uri'] = $callback . (strpos($callback, '?') > 0 ? '&' : '?') . 'oauth=1';
$param['response_type'] = 'code';
if ($scope == 'INFO') {
$param['scope'] = 'snsapi_userinfo';
} else {
$param['scope'] = 'snsapi_base';
}
$url = 'https://open.weixin.qq.com/connect/oauth2/authorize?' . http_build_query($param) . '#wechat_redirect';
ecs_header("Location: {$url}\n");
exit;
} elseif ($oauth == 1) {
$param['secret'] = $rs['appsecret'];
$param['code'] = $_REQUEST['code'];
$param['grant_type'] = 'authorization_code';
$url = 'https://api.weixin.qq.com/sns/oauth2/access_token?' . http_build_query($param);
$content = file_get_contents($url);
$token = json_decode($content, true);
$user_info = $db->getRow("SELECT * FROM `wxch_user` WHERE `wxid` = '{$token[openid]}'");
if (empty($user_info)) {
//register
if (register_openid($token['openid'])) {
$user_info = $GLOBALS['user']->get_user_info($user_info['openid']);
} else {
return false;
}
} else {
//login
$user_info = $GLOBALS['user']->get_profile_by_id($user_info['uid']);
if (!empty($user_info) && $user_info['status'] == 1) {
$GLOBALS['user']->set_session($user_info);
$GLOBALS['user']->set_cookie($user_info, TRUE);
update_user_info();
// 更新用户信息
update_user_cart();
recalculate_price();
// 重新计算购物车中的商品价格
} else {
return false;
}
}
if ($token['scope'] == 'snsapi_userinfo') {
$url = "https://api.weixin.qq.com/sns/userinfo?access_token={$token[access_token]}&openid={$token[openid]}&lang=zh_CN";
$content = file_get_contents($url);
$info = json_decode($content, true);
// 更新微信用户数据
$db->autoExecute('wxch_user', array('nickname' => $info['nickname'], 'sex' => $info['sex'], 'city' => $info['city'], 'country' => $info['country'], 'province' => $info['province'], 'language' => $info['language'], 'headimgurl' => $info['headimgurl'], 'dateline' => time()), 'UPDATE', 'uid = ' . $user_info['uid']);
}
$_SESSION['openid'] = $token['openid'];
return $user_info;
}
}
示例2: __construct
/**
* 构造函数
*/
public function __construct()
{
parent::__construct();
/* 只有在没有提交评论内容以及没有act的情况下才跳转 */
$this->cmt = I('request.cmt');
$this->act = I('request.act');
if (!isset($this->cmt) && !isset($this->act)) {
ecs_header("Location: ./\n");
}
}
示例3: upgrade
/**
* 检查版本升级
*/
public function upgrade()
{
global $_CFG;
/* 如果有新版本,升级 */
if (!isset($_CFG['ecs_version'])) {
$_CFG['ecs_version'] = 'v1.0.0';
}
if (preg_replace('/(?:\\.|\\s+)[a-z]*$/i', '', $_CFG['ecs_version']) != preg_replace('/(?:\\.|\\s+)[a-z]*$/i', '', VERSION) && file_exists('../upgrade/index.php')) {
// 转到升级文件
ecs_header("Location: ../upgrade/index.php\n");
exit;
}
}
示例4: ecs_header
ecs_header("Location: user.php?act=order_detail&order_id={$order_id}\n");
exit;
}
$order_amount = $order['order_amount'] - $order['pay_fee'];
$pay_fee = pay_fee($pay_id, $order_amount);
$order_amount += $pay_fee;
$sql = "UPDATE " . $ecs->table('order_info') . " SET pay_id='{$pay_id}', pay_name='{$payment_info['pay_name']}', pay_fee='{$pay_fee}', order_amount='{$order_amount}'" . " WHERE order_id = '{$order_id}'";
$db->query($sql);
/* 跳转 */
ecs_header("Location: user.php?act=order_detail&order_id={$order_id}\n");
exit;
} elseif ($action == 'save_order_address') {
include_once ROOT_PATH . 'includes/lib_transaction.php';
$address = array('consignee' => isset($_POST['consignee']) ? trim($_POST['consignee']) : '', 'email' => isset($_POST['email']) ? trim($_POST['email']) : '', 'address' => isset($_POST['address']) ? trim($_POST['address']) : '', 'zipcode' => isset($_POST['zipcode']) ? make_semiangle(trim($_POST['zipcode'])) : '', 'tel' => isset($_POST['tel']) ? trim($_POST['tel']) : '', 'mobile' => isset($_POST['mobile']) ? trim($_POST['mobile']) : '', 'sign_building' => isset($_POST['sign_building']) ? trim($_POST['sign_building']) : '', 'best_time' => isset($_POST['best_time']) ? trim($_POST['best_time']) : '', 'order_id' => isset($_POST['order_id']) ? intval($_POST['order_id']) : 0);
if (save_order_address($address, $user_id)) {
ecs_header('Location: user.php?act=order_detail&order_id=' . $address['order_id'] . "\n");
exit;
} else {
$err->show($_LANG['order_list_lnk'], 'user.php?act=order_list');
}
} elseif ($action == 'bonus') {
include_once ROOT_PATH . 'includes/lib_transaction.php';
$page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1;
$record_count = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table('user_bonus') . " WHERE user_id = '{$user_id}'");
$pager = get_pager('user.php', array('act' => $action), $record_count, $page);
$bonus = get_user_bouns_list($user_id, $pager['size'], $pager['start']);
$smarty->assign('pager', $pager);
$smarty->assign('bonus', $bonus);
$smarty->display('user_transaction.dwt');
} elseif ($action == 'group_buy') {
include_once ROOT_PATH . 'includes/lib_transaction.php';
示例5: action_tg_login_act
function action_tg_login_act()
{
$user = $GLOBALS['user'];
$_CFG = $GLOBALS['_CFG'];
$_LANG = $GLOBALS['_LANG'];
$smarty = $GLOBALS['smarty'];
$db = $GLOBALS['db'];
$ecs = $GLOBALS['ecs'];
$user_id = $_SESSION['user_id'];
include_once ROOT_PATH . 'includes/lib_clips.php';
$nowtime = gmtime();
$tg_sn = isset($_POST['tcard']) ? trim($_POST['tcard']) : '';
$tg_pwd = isset($_POST['pwd']) ? trim($_POST['pwd']) : '';
if (empty($tg_sn) || empty($tg_pwd)) {
show_message('卡号或密码都不能为空', '返回重新登录', 'user.php?act=tg_login');
}
$sql = "select tg.*, tt.type_money, tt.type_money_count, tt.use_start_date, tt.use_end_date from " . $ecs->table('takegoods') . " AS tg " . " left join " . $ecs->table('takegoods_type') . " AS tt " . "on tg.type_id = tt.type_id where tg.tg_sn= '{$tg_sn}' ";
$tgrow = $db->getRow($sql);
if (!$tgrow) {
show_message('该提货券不存在', '请查证后重新登录', 'user.php?act=tg_login');
}
if ($tg_pwd != $tgrow['tg_pwd']) {
show_message('密码错误', '请查证后重新登录', 'user.php?act=tg_login');
}
if ($nowtime < $tgrow['use_start_date']) {
show_message('对不起,该提货券 开始使用日期为 ' . local_date('Y-m-d H:i:s', $tgrow['use_start_date']), '请过几天再登录试试', 'user.php?act=tg_login');
}
if ($nowtime > $tgrow['use_end_date']) {
show_message('对不起,该提货券已过期', '请换个券号重新登录', 'user.php?act=tg_login');
}
if ($tgrow['used_time'] and count(explode('@', $tgrow['used_time'])) >= $tgrow['type_money_count']) {
show_message('对不起,该提货券使用次数已用尽', '请换个券号重新登录', 'user.php?act=tg_login');
}
$_SESSION['takegoods_sn_68ecshop'] = $tg_sn;
$_SESSION['takegoods_id_68ecshop'] = $tgrow['tg_id'];
ecs_header("Location:takegoods.php");
}
示例6: die
$result['ctype'] = 2;
}
die($json->encode($result));
} else {
$goods_id = isset($_REQUEST['id']) ? $_REQUEST['id'] : '';
if ($goods_id) {
//16:25 2013-07-13
//clear_cart();
$_LANG['shortage'] = "对不起,该商品已经库存不足暂停销售。\n你现在要进行缺货登记来预订该商品吗?";
if (!addto_cart($goods_id)) {
//16:25 2013-07-13
echo '购买失败,请重新购买!';
exit;
} else {
$goods_order = 1;
//16:25 2013-07-13
if ($cp == "add_cart") {
$Loaction = 'cart.php';
} else {
$Loaction = 'buy.php?act=checkout';
}
ecs_header("Location: {$Loaction}\n");
exit;
}
} else {
ecs_header("Location:index.php\n");
exit;
}
}
$smarty->assign('footer', get_footer());
$smarty->display('buy.dwt');
示例7: buy
public function buy()
{
/* 查询:判断是否登录 */
if ($_SESSION['user_id'] <= 0) {
$this->redirect(url('user/login'));
}
/* 查询:取得参数:团购活动id */
$group_buy_id = isset($_POST['group_buy_id']) ? intval($_POST['group_buy_id']) : 0;
if ($group_buy_id <= 0) {
ecs_header("Location: ./\n");
exit;
}
/* 查询:取得数量 */
$number = isset($_POST['number']) ? intval($_POST['number']) : 1;
$number = $number < 1 ? 1 : $number;
/* 查询:取得团购活动信息 */
$group_buy = model('GroupBuyBase')->group_buy_info($group_buy_id, $number);
if (empty($group_buy)) {
ecs_header("Location: ./\n");
exit;
}
/* 查询:检查团购活动是否是进行中 */
if ($group_buy['status'] != GBS_UNDER_WAY) {
show_message(L('gb_error_status'), '', '', 'error');
}
/* 查询:取得团购商品信息 */
$goods = model('Goods')->get_goods_info($group_buy['goods_id']);
if (empty($goods)) {
ecs_header("Location: ./\n");
exit;
}
/* 查询:判断数量是否足够 */
if ($group_buy['restrict_amount'] > 0 && $number > $group_buy['restrict_amount'] - $group_buy['valid_goods'] || $number > $goods['goods_number']) {
show_message(L('gb_error_goods_lacking'), '', '', 'error');
}
/* 查询:取得规格 */
$specs = '';
foreach ($_POST as $key => $value) {
if (strpos($key, 'spec_') !== false) {
$specs .= ',' . intval($value);
}
}
$specs = trim($specs, ',');
/* 查询:如果商品有规格则取规格商品信息 配件除外 */
if ($specs) {
$_specs = explode(',', $specs);
$product_info = model('ProductsBase')->get_products_info($goods['goods_id'], $_specs);
}
empty($product_info) ? $product_info = array('product_number' => 0, 'product_id' => 0) : '';
/* 查询:判断指定规格的货品数量是否足够 */
if ($specs && $number > $product_info['product_number']) {
show_message(L('gb_error_goods_lacking'), '', '', 'error');
}
/* 查询:查询规格名称和值,不考虑价格 */
$attr_list = array();
$sql = "SELECT a.attr_name, g.attr_value " . "FROM " . $this->model->pre . "goods_attr AS g, " . $this->model->pre . "attribute AS a " . "WHERE g.attr_id = a.attr_id " . "AND g.goods_attr_id " . db_create_in($specs);
$res = $this->model->query($sql);
foreach ($res as $row) {
$attr_list[] = $row['attr_name'] . ': ' . $row['attr_value'];
}
$goods_attr = join(chr(13) . chr(10), $attr_list);
/* 更新:清空购物车中所有团购商品 */
model('Order')->clear_cart(CART_GROUP_BUY_GOODS);
/* 更新:加入购物车 */
$goods_price = $group_buy['deposit'] > 0 ? $group_buy['deposit'] : $group_buy['cur_price'];
$cart = array('user_id' => $_SESSION['user_id'], 'session_id' => SESS_ID, 'goods_id' => $group_buy['goods_id'], 'product_id' => $product_info['product_id'], 'goods_sn' => addslashes($goods['goods_sn']), 'goods_name' => addslashes($goods['goods_name']), 'market_price' => $goods['market_price'], 'goods_price' => $goods_price, 'goods_number' => $number, 'goods_attr' => addslashes($goods_attr), 'goods_attr_id' => $specs, 'is_real' => $goods['is_real'], 'extension_code' => addslashes($goods['extension_code']), 'parent_id' => 0, 'rec_type' => CART_GROUP_BUY_GOODS, 'is_gift' => 0);
$new_cart = model('Common')->filter_field('cart', $cart);
$this->model->table('cart')->data($new_cart)->insert();
/* 更新:记录购物流程类型:团购 */
$_SESSION['flow_type'] = CART_GROUP_BUY_GOODS;
$_SESSION['extension_code'] = 'group_buy';
$_SESSION['extension_id'] = $group_buy_id;
/* 进入收货人页面 */
$this->redirect(url('flow/consignee_list'));
exit;
}
示例8: make_json_error
if (!empty($_REQUEST['is_ajax'])) {
make_json_error($_LANG['priv_error']);
} else {
ecs_header("Location: privilege.php?act=login\n");
}
exit;
}
}
$smarty->assign('token', $_CFG['token']);
if ($_REQUEST['act'] != 'login' && $_REQUEST['act'] != 'signin' && $_REQUEST['act'] != 'forget_pwd' && $_REQUEST['act'] != 'reset_pwd' && $_REQUEST['act'] != 'check_order') {
$admin_path = preg_replace('/:\\d+/', '', $ecs->url()) . ADMIN_PATH;
if (!empty($_SERVER['HTTP_REFERER']) && strpos(preg_replace('/:\\d+/', '', $_SERVER['HTTP_REFERER']), $admin_path) === false) {
if (!empty($_REQUEST['is_ajax'])) {
make_json_error($_LANG['priv_error']);
} else {
ecs_header("Location: privilege.php?act=login\n");
}
exit;
}
}
/* 管理员登录后可在任何页面使用 act=phpinfo 显示 phpinfo() 信息 */
if ($_REQUEST['act'] == 'phpinfo' && function_exists('phpinfo')) {
phpinfo();
exit;
}
//header('Cache-control: private');
header('content-type: text/html; charset=' . EC_CHARSET);
header('Expires: Fri, 14 Mar 1980 20:53:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
示例9: COUNT
$_GET[$arr2[0]] = $arr2[1];
$pay_code = $arr1[0];
}
/* 判断是否启用 */
$sql = "SELECT COUNT(*) FROM " . $ecs->table('payment') . " WHERE pay_code = '{$pay_code}' AND enabled = 1";
if ($db->getOne($sql) == 0) {
$msg = $_LANG['pay_disabled'];
} else {
$plugin_file = ROOT_PATH . 'includes/modules/payment/' . $pay_code . '.php';
/* 检查插件文件是否存在,如果存在则验证支付是否成功,否则则返回失败信息 */
if (file_exists($plugin_file)) {
/* 根据支付方式代码创建支付类的对象并调用其响应操作方法 */
include_once $plugin_file;
$payment = new $pay_code();
$msg = @$payment->respond() ? '成功' : '失败';
ecs_header("Location:user.php?act=order_list\n");
} else {
$msg = $_LANG['pay_not_exist'];
}
}
}
assign_template();
$position = assign_ur_here();
$smarty->assign('page_title', $position['title']);
// 页面标题
$smarty->assign('ur_here', $position['ur_here']);
// 当前位置
$smarty->assign('page_title', $position['title']);
// 页面标题
$smarty->assign('ur_here', $position['ur_here']);
// 当前位置
示例10: check_authz_json
check_authz_json('shophelp_manage');
$cat_name = trim($_POST['cat_name']);
if (!empty($cat_name)) {
if ($exc_cat->num("cat_name", $cat_name) != 0) {
make_json_error($_LANG['catname_exist']);
} else {
$sql = "INSERT INTO " . $ecs->table('article_cat') . " (cat_name, cat_type) VALUES ('{$cat_name}', 0)";
$db->query($sql);
admin_log($cat_name, 'add', 'shophelpcat');
ecs_header("Location: shophelp.php?act=query\n");
exit;
}
} else {
make_json_error($_LANG['js_languages']['no_catname']);
}
ecs_header("Location: shophelp.php?act=list_cat\n");
exit;
} elseif ($_REQUEST['act'] == 'edit_title') {
check_authz_json('shophelp_manage');
$id = intval($_POST['id']);
$title = json_str_iconv(trim($_POST['val']));
/* 检查文章标题是否有重名 */
if ($exc_article->num('title', $title, $id) == 0) {
if ($exc_article->edit("title = '{$title}'", $id)) {
clear_cache_files();
admin_log($title, 'edit', 'shophelp');
make_json_result(stripslashes($title));
}
} else {
make_json_error(sprintf($_LANG['articlename_exist'], $title));
}
示例11: array
} else {
$links[] = array('text' => $_LANG['go_url'], 'href' => 'flashplay.php?act=list');
sys_msg($_LANG['id_error'], 0, $links);
}
if (strpos($rt['src'], 'http') === false) {
@unlink(ROOT_PATH . $rt['src']);
}
$temp = array();
foreach ($flashdb as $key => $val) {
if ($key != $id) {
$temp[] = $val;
}
}
put_flash_xml($temp);
set_flash_data($_CFG['flash_theme'], $error_msg = '');
ecs_header("Location: flashplay.php?act=list\n");
exit;
} elseif ($_REQUEST['act'] == 'add') {
admin_priv('flash_manage');
if (empty($_POST['step'])) {
$url = isset($_GET['url']) ? $_GET['url'] : 'http://';
$src = isset($_GET['src']) ? $_GET['src'] : '';
$rt = array('act' => 'add', 'img_url' => $url, 'img_src' => $src);
$width_height = get_width_height();
$smarty->assign('width_height', sprintf($_LANG['width_height'], $width_height['width'], $width_height['height']));
$smarty->assign('action_link', array('text' => $_LANG['go_url'], 'href' => 'flashplay.php?act=list'));
$smarty->assign('rt', $rt);
$smarty->display('flashplay_add.htm');
} elseif ($_POST['step'] == 2) {
if (!empty($_FILES['img_file_src']['name'])) {
if (!get_file_suffix($_FILES['img_file_src']['name'], $allow_suffix)) {
示例12: insert_cart_info
$result['content'] = insert_cart_info();
$result['one_step_buy'] = $_CFG['one_step_buy'];
} else {
$result['message'] = $err->last_message();
$result['error'] = $err->error_no;
$result['package_id'] = stripslashes($package->package_id);
}
}
$result['confirm_type'] = !empty($_CFG['cart_confirm']) ? $_CFG['cart_confirm'] : 2;
die($json->encode($result));
} else {
/* 标记购物流程为普通商品 */
$_SESSION['flow_type'] = CART_GENERAL_GOODS;
/* 如果是一步购物,跳到结算中心 */
if ($_CFG['one_step_buy'] == '1') {
ecs_header("Location: flow.php?step=checkout\n");
exit;
}
/* 取得商品列表,计算合计 */
$cart_goods = get_cart_goods();
$smarty->assign('goods_list', $cart_goods['goods_list']);
$smarty->assign('total', $cart_goods['total']);
//购物车的描述的格式化
$smarty->assign('shopping_money', sprintf($_LANG['shopping_money'], $cart_goods['total']['goods_price']));
$smarty->assign('market_price_desc', sprintf($_LANG['than_market_price'], $cart_goods['total']['market_price'], $cart_goods['total']['saving'], $cart_goods['total']['save_rate']));
// 显示收藏夹内的商品
if ($_SESSION['user_id'] > 0) {
require_once ROOT_PATH . 'includes/lib_clips.php';
$collection_goods = get_collection_goods($_SESSION['user_id']);
$smarty->assign('collection_goods', $collection_goods);
}
示例13: send_pwd_email
/**
* 用户进行密码找回操作时,发送一封确认邮件
*
* @access public
* @param string $uid 用户ID
* @param string $user_name 用户帐号
* @param string $email 用户Email
* @param string $code key
*
* @return boolen $result;
*/
function send_pwd_email($uid, $user_name, $email, $code)
{
global $config;
if (empty($uid) || empty($user_name) || empty($email) || empty($code)) {
ecs_header("Location: user.php?act=get_password\n");
exit;
}
/* 设置重置邮件模板所需要的内容信息 */
$template = get_mail_template('send_password');
//$reset_email = $GLOBALS['ecs']->url() . 'user.php?act=get_password&uid=' . $uid . '&code=' . $code;
$reset_email = $config['site_url'] . 'user.php?act=get_password&uid=' . $uid . '&code=' . $code;
$GLOBALS['smarty']->assign('user_name', $user_name);
$GLOBALS['smarty']->assign('reset_email', $reset_email);
$GLOBALS['smarty']->assign('shop_name', $GLOBALS['_CFG']['shop_name']);
$GLOBALS['smarty']->assign('send_date', date('Y-m-d'));
$GLOBALS['smarty']->assign('sent_date', date('Y-m-d'));
$content = $GLOBALS['smarty']->fetch('str:' . $template['template_content']);
/* 发送确认重置密码的确认邮件 */
if (send_mail($user_name, $email, $template['template_subject'], $content, $template['is_html'])) {
return true;
} else {
return false;
}
}
示例14: put_affiliate
$config['item'][$key]['level_money'] = $val;
$config['on'] = 1;
put_affiliate($config);
make_json_result(stripcslashes($val));
} elseif ($_REQUEST['act'] == 'del') {
$key = trim($_GET['id']) - 1;
unset($config['item'][$key]);
$temp = array();
foreach ($config['item'] as $key => $val) {
$temp[] = $val;
}
$config['item'] = $temp;
$config['on'] = 1;
$config['config']['separate_by'] = 0;
put_affiliate($config);
ecs_header("Location: affiliate.php?act=list\n");
exit;
}
function get_affiliate()
{
$config = unserialize($GLOBALS['_CFG']['affiliate']);
empty($config) && ($config = array());
return $config;
}
function put_affiliate($config)
{
$temp = serialize($config);
$sql = "UPDATE " . $GLOBALS['ecs']->table('shop_config') . "SET value = '{$temp}'" . "WHERE code = 'affiliate'";
$GLOBALS['db']->query($sql);
clear_all_files();
}
示例15: die
/* 如果不存在实体商品,退出 */
if (!exist_real_goods($order_id)) {
die('Hacking Attemp');
}
/* 保存订单 */
$shipping_id = $_POST['shipping'];
$shipping = shipping_info($shipping_id);
$invoice_no = trim($_POST['invoice_no']);
$invoice_no = str_replace(',', '<br>', $invoice_no);
$order = array('shipping_id' => $shipping_id, 'shipping_name' => addslashes($shipping['shipping_name']), 'invoice_no' => $invoice_no);
update_order($order_id, $order);
/* todo 记录日志 */
$sn = $old_order['order_sn'];
admin_log($sn, 'edit', 'order');
if (isset($_POST['finish'])) {
ecs_header("Location: order.php?act=info&order_id=" . $order_id . "\n");
exit;
}
}
} elseif ($act == 'quick_delivery') {
global $ecs, $db;
$order_id = empty($_REQUEST['order_id']) ? 0 : intval($_REQUEST['order_id']);
$express_no = empty($_REQUEST['express_no']) ? 0 : intval($_REQUEST['express_no']);
if (empty($express_no)) {
sys_msg('请输入快递单号!', 1);
}
if (empty($order_id)) {
sys_msg('请输入订单号!', 1);
}
//检测订单是否属于该商户、检测订单是否处于待发货状态
$sql = 'SELECT COUNT(*) FROM ' . $ecs->table('order_info') . ' WHERE supplier_id=' . $_SESSION['supplier_id'] . order_query_sql('await_ship');