Пример #1
0
     for ($i = 0; $i < count($card_message_arr); $i++) {
         //var_dump(iconv_strlen($card_message,'utf-8'));
         ANTI_SPAM($card_message_arr[$i], array('minLength' => 0, 'maxLength' => 10));
     }
     //每次结算要记录一个ip防止被刷
     $current_ip = GET_IP();
     $_key = 'checkout_times_' . $current_ip;
     $_value;
     if ($REDIS_CLIENT->exists($_key)) {
         $_value = intval($REDIS_CLIENT->get($_key));
         $_value += 1;
         $REDIS_CLIENT->setex($_key, 24 * 3600, $_value);
     } else {
         $REDIS_CLIENT->setex($_key, 24 * 3600, 1);
     }
     echo MES_Order::checkout($card_message);
 } else {
     if ($action == 'done') {
         $token = $_POST['token'];
         $pay_id = $_POST['pay_id'];
         echo MES_Order::done($token, $pay_id);
     } else {
         if ($action == 'add_to_cart') {
             //add an cake or fork to your cart
             $_POST['goods'] = strip_tags(urldecode($_POST['goods']));
             $_POST['goods'] = json_str_iconv($_POST['goods']);
             $goods = $_POST['goods'];
             if (!empty($_REQUEST['goods_id']) && empty($goods)) {
                 if (!is_numeric($_REQUEST['goods_id']) || intval($_REQUEST['goods_id']) <= 0) {
                     ecs_header("Location:./\n");
                 }