ecshop报错compile_str() flow.php的解决方法

2016-07-07 16:46 来源:www.chinab4c.com 作者:ecshop专家

  ecshop部分用户升级之后,在提交订单突然出现报错:

  compile_str()flow.php on line 375:

  打开 flow.php找到375行:

  * 保存收货人信息

  */

  $c**ignee = array(

  'address_id' => empty($_POST['address_id']) ? 0:intval($_POST['address_id']),

  'c**ignee'=> empty($_POST['c**ignee'])? '' :compile_str(trim($_POST['c**ignee'])),

  'country' => empty($_POST['country']) ? '' :intval($_POST['country']),

  'province'=> empty($_POST['province'])? '' :intval($_POST['province']),

  'city' => empty($_POST['city']) ? '' :intval($_POST['city']),

  'district'=> empty($_POST['district'])? '' :intval($_POST['district']),

  'email'=> empty($_POST['email'])? '' :compile_str($_POST['email']),

  'address' => empty($_POST['address']) ? '' :compile_str($_POST['address']),

  'zipcode' => empty($_POST['zipcode']) ? '' :compile_str(make_semiangle(trim($_POST['zipcode']))),

  'tel'=> empty($_POST['tel'])? '' :compile_str(make_semiangle(trim($_POST['tel']))),

  'mobile'=> empty($_POST['mobile'])? '' :compile_str(make_semiangle(trim($_POST['mobile']))),

  'sign_building' => empty($_POST['sign_building']) ? '' :compile_str($_POST['sign_building']),

  'best_time'=> empty($_POST['best_time'])? '' :compile_str($_POST['best_time']),

  );

  昆明国防路医院www.01yzh.com指出这里代码多了个函数 compile_str。 改函数是ecshop最新补丁新加入进入的。原本的这块代码是

  'address_id' => empty($_POST['address_id']) ? 0: intval($_POST['address_id']),

  'c**ignee'=> empty($_POST['c**ignee'])? '' : trim($_POST['c**ignee']),

  'country' => empty($_POST['country']) ? '' : $_POST['country'],

  'province'=> empty($_POST['province'])? '' : $_POST['province'],

  'city' => empty($_POST['city']) ? '' : $_POST['city'],

  'district'=> empty($_POST['district'])? '' : $_POST['district'],

  'email'=> empty($_POST['email'])? '' : $_POST['email'],

  'address' => empty($_POST['address']) ? '' : $_POST['address'],

  'zipcode' => empty($_POST['zipcode']) ? '' : make_semiangle(trim($_POST['zipcode'])),

  'tel'=> empty($_POST['tel'])? '' : make_semiangle(trim($_POST['tel'])),

  'mobile'=> empty($_POST['mobile'])? '' : make_semiangle(trim($_POST['mobile'])),

  'sign_building' => empty($_POST['sign_building']) ? '' : $_POST['sign_building'],

  'best_time'=> empty($_POST['best_time'])? '' : $_POST['best_time'],

  该函数是为补漏洞的。 在文件lib_base.php 776行。

  /**

  * 过滤用户输入的基本数据,防止script攻击

  *

  * @accesspublic

  * @returnstring

  */

  function compile_str($str)

  {

  $arr = array('<' => '<', '>' => '>');

  return strtr($str, $arr);

  }

  该函数是为补漏洞的。

  过滤用户输入的基本数据,防止script攻击!

  所以如果网站提示缺少此函数,直接补个函数就可以了。昆明国防路医院www.fyyhzs.com贴在ecshop系统文件的flow.php底部,问题就解决了