来源:自学PHP网 时间:2015-04-15 15:00 作者: 阅读:次
[导读] 20140618详细说明:虽然20140618添加了防注入的 但是还是能勉强绕过。首先注册一个会员 然后申请开店。然后把店的名字改成 yu,user(),1 and extractvalue(1,concat(0x5c,(user())))) 然后这里转义再入库...
|
20140618 虽然20140618添加了防注入的 但是还是能勉强绕过。首先注册一个会员 然后申请开店。
function index()
{
if (!IS_POST)
{
$goods_info = $this->_get_goods_info();
if ($goods_info === false)
{
/* 购物车是空的 */
$this->show_warning('goods_empty');
return;
}
/* 根据商品类型获取对应订单类型 */
$goods_type =& gt($goods_info['type']);
$order_type =& ot($goods_type->get_order_type());
/* 显示订单表单 */
$form = $order_type->get_order_form($goods_info['store_id']);
if ($form === false)
{
$this->show_warning($order_type->get_error());
return;
}
$this->_curlocal(
LANG::get('create_order')
);
$this->assign('goods_info', $goods_info);
$this->assign($form['data']);
$this->display($form['template']);
}
else
{
/* 在此获取生成订单的两个基本要素:用户提交的数据(POST),商品信息(包含商品列表,商品总价,商品总数量,类型),所属店铺 */
$goods_info = $this->_get_goods_info();
if ($goods_info === false)
{
/* 购物车是空的 */
$this->show_warning('goods_empty');
return;
}
/* 根据商品类型获取对应的订单类型 */
$goods_type =& gt($goods_info['type']);
$order_type =& ot($goods_type->get_order_type());
/* 将这些信息传递给订单类型处理类生成订单(你根据我提供的信息生成一张订单) */
$order_id = $order_type->submit_order(array(
'goods_info' => $goods_info, //商品信息(包括列表,总价,总量,所属店铺,类型),可靠的!
'post' => $_POST, //用户填写的订单信息
));
if (!$order_id)
{
$this->show_warning($order_type->get_error());
return;
}
/* 下单完成后清理商品,如清空购物车,或将团购拍卖的状态转为已下单之类的 */
$this->_clear_goods();
/* 发送邮件 */
$model_order =& m('order');
/* 减去商品库存 */
$model_order->change_stock('-', $order_id);
/* 获取订单信息 */
$order_info = $model_order->get($order_id);
$buyer_address = $this->visitor->get('email');
$model_member =& m('member');
$member_info = $model_member->get($goods_info['store_id']);
$seller_address= $member_info['email'];
/* 发送给买家下单通知 */
$buyer_mail = get_mail('tobuyer_new_order_notify', array('order' => $order_info));
$this->_mailto($buyer_address, $buyer_mail['subject'], $buyer_mail['message']);
/* 发送给卖家新订单通知 */
$seller_mail = get_mail('toseller_new_order_notify', array('order' => $order_info));
$this->_mailto($seller_address, $seller_mail['subject'], $seller_mail['message']);
/* 更新下单次数 */
$model_goodsstatistics =& m('goodsstatistics');
$seller_mail = get_mail('toseller_new_order_notify', array('order' => $order_info));
$this->_mailto($seller_address, $seller_mail['subject'], $seller_mail['message']);
<?php
return array (
'version' => '1.0',
'subject' => '{$site_name}提醒:您有一个新订单需要处理',
'content' => '<p>尊敬的{$order.seller_name}:</p>
<p style="padding-left: 30px;">您有一个新的订单需要处理,订单号{$order.order_sn},请尽快处理。</p>
function _mailto($to, $subject, $message, $priority = MAIL_PRIORITY_LOW)
{
/* 加入邮件队列,并通知需要发送 */
$model_mailqueue =& m('mailqueue');
$mail = array(
'mail_to' => $to,
'mail_encoding' => CHARSET,
'mail_subject' => $subject,
'mail_body' => $message,
'priority' => $priority,
'add_time' => gmtime(),
);
$model_mailqueue->add($mail);
修复方案:返回的时候addslashes一次把。 |
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com