示例#1
0
文件: goods.php 项目: netroby/ecshop
 * $Author: testyang $
 * $Id: goods.php 15013 2008-10-23 09:31:42Z testyang $.
 */
define('IN_ECS', true);
require dirname(__FILE__) . '/includes/init.php';
$goods_id = !empty($_GET['id']) ? intval($_GET['id']) : '';
$act = !empty($_GET['act']) ? $_GET['act'] : '';
$_LANG['kilogram'] = '千克';
$_LANG['gram'] = '克';
$_LANG['home'] = '首页';
$_LANG['goods_attr'] = '';
$smarty->assign('goods_id', $goods_id);
$goods_info = get_goods_info($goods_id);
if ($goods_info === false) {
    /* 如果没有找到任何记录则跳回到首页 */
    mobile_error('返回上一页', '', '未找到商品');
}
$goods_info['goods_name'] = encode_output($goods_info['goods_name']);
$goods_info['goods_brief'] = encode_output($goods_info['goods_brief']);
$goods_info['promote_price'] = encode_output($goods_info['promote_price']);
$goods_info['market_price'] = encode_output($goods_info['market_price']);
$goods_info['shop_price'] = encode_output($goods_info['shop_price']);
$goods_info['shop_price_formated'] = encode_output($goods_info['shop_price_formated']);
$goods_info['goods_number'] = encode_output($goods_info['goods_number']);
$smarty->assign('goods_info', $goods_info);
$shop_price = $goods_info['shop_price'];
$smarty->assign('rank_prices', get_user_rank_prices($goods_id, $shop_price));
// 会员等级价格
$smarty->assign('footer', get_footer());
/* 查看商品图片操作 */
if ($act == 'goods_desc') {
示例#2
0
文件: flow.php 项目: netroby/ecshop
    exit;
} elseif ($_REQUEST['act'] == 'to_pay') {
    $order_sn = isset($_REQUEST['order_sn']) && is_numeric($_REQUEST['order_sn']) ? $_REQUEST['order_sn'] : '';
    if (empty($order_sn)) {
        mobile_error('返回用户中心', 'user.php', '无效订单号');
        //echo '无效订单号';exit;
    }
    $sql = 'SELECT * FROM ' . $ecs->table('order_info') . " WHERE `order_sn`='{$order_sn}' ";
    $order = $db->getRow($sql);
    $smarty->assign('order', $order);
    if (empty($order) || $order['user_id'] != $_SESSION['user_id']) {
        mobile_error('返回用户中心', 'user.php', '错误订单号或者该订单不是您的订单');
    }
    $payment = mobile_payment_info($order['pay_id']);
    if (empty($payment)) {
        mobile_error('返回用户中心', 'user.php', '非手机下单,该订单无法支付');
    }
    include_once 'includes/modules/payment/' . $payment['pay_code'] . '.php';
    $pay_obj = new $payment['pay_code']();
    $pay_online = $pay_obj->get_code($order, unserialize_config($payment['pay_config']));
    $smarty->assign('pay_online', $pay_online);
    $smarty->display('to_pay.dwt');
}
function flow_available_points()
{
    $sql = 'SELECT SUM(g.integral * c.goods_number) ' . 'FROM ' . $GLOBALS['ecs']->table('cart') . ' AS c, ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . "WHERE c.session_id = '" . SESS_ID . "' AND c.goods_id = g.goods_id AND c.is_gift = 0 AND g.integral > 0 " . "AND c.rec_type = '" . CART_GENERAL_GOODS . "'";
    $val = intval($GLOBALS['db']->getOne($sql));
    return integral_of_value($val);
}
/**
 * 检查订单中商品库存.
示例#3
0
        $_GET[$arr2[0]] = $arr2[1];
        $pay_code = $arr1[0];
    }
    /* 判断是否启用 */
    $sql = 'SELECT COUNT(*) FROM ' . $ecs->table('mobile_payment') . " WHERE pay_code = '{$pay_code}' AND enabled = 1";
    if ($db->getOne($sql) == 0) {
        mobile_error('返回首页', 'index.php', '未找到对应的支付方式');
    } else {
        $plugin_file = ROOT_PATH . 'mobile/includes/modules/payment/' . $pay_code . '.php';
        /* 检查插件文件是否存在,如果存在则验证支付是否成功,否则则返回失败信息 */
        if (file_exists($plugin_file)) {
            /* 根据支付方式代码创建支付类的对象并调用其响应操作方法 */
            include_once $plugin_file;
            $payment = new $pay_code();
            $msg = @$payment->respond() ? $_LANG['pay_success'] : $_LANG['pay_fail'];
        } else {
            mobile_error('返回首页', 'index.php', '没有这样的支付方式');
        }
    }
}
//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']); // 当前位置
//$smarty->assign('helps',      get_shop_help());      // 网店帮助
//
//$smarty->assign('message',    $msg);
//$smarty->assign('shop_url',   $ecs->url());
//$smarty->display('respond.dwt');
示例#4
0
 * ============================================================================
 * $Author: liuhui $
 * $Id: index.php 15013 2010-03-25 09:31:42Z liuhui $.
 */
define('IN_ECS', true);
//define('ECS_ADMIN', true);
require dirname(__FILE__) . '/includes/init.php';
$id = isset($_GET['id']) ? intval($_GET['id']) : '';
if (empty($id)) {
    mobile_error('返回首页', 'index.php', '活动页不存在');
} else {
    $new_time = time();
    $sql = 'SELECT * FROM ' . $ecs->table('favourable_activity') . " WHERE `start_time`<' {$new_time}'  AND `end_time`>'{$new_time}' AND (`act_type`=1 or `act_type`=2)  AND `act_id` ='{$id}'";
    $result = $db->getRow($sql);
    if (empty($result)) {
        mobile_error('返回首页', 'index.php', '活动页不存在或者已经过期');
    } else {
        $result['content'] = '';
        if (!empty($result['user_rank'])) {
            $rank = explode(',', $result['user_rank']);
            $sql = 'SELECT `rank_name` FROM ' . $ecs->table('user_rank') . ' WHERE  ' . db_create_in($rank, 'rank_id');
            $user_rank = $db->getAll($sql);
            $result['content'] = '可参加活动的会员等级为:';
            foreach ($user_rank as $val) {
                $result['content'] .= $val['rank_name'] . '    ';
            }
            $result['content'] .= '。<br/>';
        }
        $result['content'] .= '活动开始时间为:' . local_date('Y-m-d H:i', $result['start_time']) . ',活动结束时间为:' . local_date('Y-m-d H:i', $result['end_time']);
        $result['content'] .= "<a href =\"activitie_goods.php?id={$result['act_id']}\">点击查看活动商品</a>";
        $smarty->assign('activity', $result);
示例#5
0
        mobile_error('返回首页', $url = 'index.php', '未找到对应的文章');
    }
    if (!empty($article_row['link']) && $article_row['link'] != 'http://' && $article_row['link'] != 'https://') {
        mobile_error('返回首页', $url = 'index.php', '未找到对应的文章');
    }
    $smarty->assign('common_header_title', encode_output($article_row['title']));
    $article_row['title'] = encode_output($article_row['title']);
    $replace_tag = array('<br />', '<br/>', '<br>', '</p>');
    $article_row['content'] = htmlspecialchars_decode(encode_output($article_row['content']));
    $article_row['content'] = str_replace($replace_tag, '{br}', $article_row['content']);
    $article_row['content'] = strip_tags($article_row['content']);
    $article_row['content'] = str_replace('{br}', '<br />', $article_row['content']);
    $smarty->assign('article_data', $article_row);
    $smarty->display('article_desc.dwt');
} else {
    mobile_error('返回首页', $url = 'index.php', '未找到对应的文章');
}
function get_article_info($article_id)
{
    /* 获得文章的信息 */
    $sql = 'SELECT a.*, IFNULL(AVG(r.comment_rank), 0) AS comment_rank ' . 'FROM ' . $GLOBALS['ecs']->table('article') . ' AS a ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('comment') . ' AS r ON r.id_value = a.article_id AND comment_type = 1 ' . "WHERE a.is_open = 1 AND a.article_id = '{$article_id}' GROUP BY a.article_id";
    $row = $GLOBALS['db']->getRow($sql);
    if ($row !== false) {
        $row['comment_rank'] = ceil($row['comment_rank']);
        // 用户评论级别取整
        $row['add_time'] = local_date($GLOBALS['_CFG']['date_format'], $row['add_time']);
        // 修正添加时间显示
        /* 作者信息如果为空,则用网站名称替换 */
        if (empty($row['author']) || $row['author'] == '_SHOPHELP') {
            $row['author'] = $GLOBALS['_CFG']['shop_name'];
        }
示例#6
0
require dirname(__FILE__) . '/includes/init.php';
$id = isset($_GET['id']) ? intval($_GET['id']) : '';
if (empty($id)) {
    mobile_error('返回首页', 'index.php', '活动页不存在');
} else {
    $new_time = time();
    $sql = 'SELECT * FROM ' . $ecs->table('favourable_activity') . " WHERE `start_time`<' {$new_time}'  AND `end_time`>'{$new_time}' AND (`act_type`=1 or `act_type`=2) AND `act_id` ='{$id}'";
    $result = $db->getRow($sql);
    if (empty($result)) {
        mobile_error('返回首页', 'index.php', '活动页不存在或者已经过期');
    } else {
        $result['content'] = '';
        if (!empty($result['user_rank'])) {
            $rank = explode(',', $result['user_rank']);
            if (!in_array($_SESSION['user_rank'], $rank)) {
                mobile_error('返回首页', 'index.php', '您当前等级无法查阅');
            }
        }
        $result['content'] = '';
        if (!empty($result['user_rank'])) {
            $rank = explode(',', $result['user_rank']);
            $sql = 'SELECT `rank_name` FROM ' . $ecs->table('user_rank') . ' WHERE  ' . db_create_in($rank, 'rank_id');
            $user_rank = $db->getAll($sql);
            $result['content'] = '可参加活动的会员等级为:';
            foreach ($user_rank as $val) {
                $result['content'] .= $val['rank_name'] . '&nbsp    ';
            }
            $result['content'] .= '<br/>';
        }
        $result['content'] .= '活动开始时间为:' . local_date('Y-m-d H:i', $result['start_time']) . ',活动结束时间为:' . local_date('Y-m-d H:i', $result['end_time']);
        $smarty->assign('activity', $result);
示例#7
0
文件: alipay.php 项目: netroby/ecshop
    mobile_error('返回首页', 'index.php', '未找到对应的支付方式');
} else {
    /* 判断是否启用 */
    $sql = 'SELECT COUNT(*) FROM ' . $ecs->table('mobile_payment') . " WHERE pay_code = '{$pay_code}' AND enabled = 1";
    if ($db->getOne($sql) == 0) {
        mobile_error('返回首页', 'index.php', '未找到对应的支付方式');
    } else {
        $plugin_file = ROOT_PATH . 'mobile/includes/modules/payment/' . $pay_code . '.php';
        /* 检查插件文件是否存在,如果存在则验证支付是否成功,否则则返回失败信息 */
        if (file_exists($plugin_file)) {
            /* 根据支付方式代码创建支付类的对象并调用其响应操作方法 */
            include_once $plugin_file;
            $payment = new $pay_code();
            $msg = @$payment->respond() ? 'pay_success' : 'pay_fail';
        } else {
            mobile_error('返回首页', 'index.php', '未找到对应的支付方式');
        }
    }
}
$smarty->assign('msg', $msg);
//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']); // 当前位置
//$smarty->assign('helps',      get_shop_help());      // 网店帮助
//
//$smarty->assign('message',    $msg);
//$smarty->assign('shop_url',   $ecs->url());
$smarty->display('respond.dwt');
示例#8
0
文件: init.php 项目: netroby/ecshop
            }
        } else {
            $_SESSION['user_id'] = 0;
            $_SESSION['user_name'] = '';
            $_SESSION['email'] = '';
            $_SESSION['user_rank'] = 0;
            $_SESSION['discount'] = 1.0;
        }
    }
}
if ((DEBUG_MODE & 1) == 1) {
    error_reporting(E_ALL);
} else {
    error_reporting(E_ALL ^ E_NOTICE);
}
if ((DEBUG_MODE & 4) == 4) {
    include ROOT_PATH . 'includes/lib.debug.php';
}
/* 判断是否支持gzip模式 */
if (gzip_enabled()) {
    ob_start('ob_gzhandler');
}
/* wap头文件 */
//if (substr($_SERVER['SCRIPT_NAME'], strrpos($_SERVER['SCRIPT_NAME'], '/')) != '/user.php')
//{}
if (empty($_CFG['wap_config'])) {
    mobile_error('返回电脑版', '../index.php', '对不起,该网店暂时没有开启手机购物功能');
}
if (!empty($_CFG['shop_closed'])) {
    mobile_error('返回首页', 'index.php', $_CFG['close_comment']);
}
示例#9
0
文件: user.php 项目: netroby/ecshop
/**
 * 手机注册.
 */
function m_register($username, $password, $email, $other)
{
    /* 检查username */
    if (empty($username)) {
        mobile_error('返回用户登录', $url = 'user.php', '用户名不能为空');
    }
    if (preg_match('/\'\\/^\\s*$|^c:\\\\con\\\\con$|[%,\\*\\"\\s\\t\\<\\>\\&\'\\\\]/', $username)) {
        mobile_error('返回用户登录', $url = 'user.php', '用户名错误');
    }
    /* 检查email */
    if (empty($email)) {
        mobile_error('返回用户登录', $url = 'user.php', 'email不能为空');
    }
    if (!is_email($email)) {
        mobile_error('返回用户登录', $url = 'user.php', 'email错误');
    }
    /* 检查是否和管理员重名 */
    if (admin_registered($username)) {
        mobile_error('返回用户登录', $url = 'user.php', '此用户已存在');
    }
    if (!is_mobile($other['mobile_phone'])) {
        mobile_error('返回用户登录', $url = 'user.php', '手机号错误');
    }
    if (!$GLOBALS['user']->add_user($username, $password, $email)) {
        mobile_error('返回用户登录', $url = 'user.php', '注册失败');
    } else {
        //注册成功
        /* 设置成登录状态 */
        $GLOBALS['user']->set_session($username);
        $GLOBALS['user']->set_cookie($username);
    }
    //定义other合法的变量数组
    $other_key_array = array('msn', 'qq', 'office_phone', 'home_phone', 'mobile_phone');
    $update_data['reg_time'] = local_strtotime(local_date('Y-m-d H:i:s'));
    if ($other) {
        foreach ($other as $key => $val) {
            //删除非法key值
            if (!in_array($key, $other_key_array)) {
                unset($other[$key]);
            } else {
                $other[$key] = htmlspecialchars(trim($val));
                //防止用户输入javascript代码
            }
        }
        $update_data = array_merge($update_data, $other);
    }
    $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('users'), $update_data, 'UPDATE', 'user_id = ' . $_SESSION['user_id']);
    update_user_info();
    // 更新用户信息
    return true;
}