dsfgds4215 2014-10-16 14:47
浏览 14

PHP Session在购买过程中失去了一半

THE SET UP

I have a buying process that has the following stages:

  • results
  • customer
  • payment
  • order-conf

The results page sets a session variable with an ID from our orders database table. Each page posts data to the next one. The start of customer and payment BOTH check the existence of the ID number session variable.

As you can imagine, 99% of browsers with default cookie settings have no problem with the setting of these sessions vars and reading them.

I get an alert whenever that session var check comes back as blank. Most of these errors seem to be direct hits to the customer and payment page, so BOTS or bookmark hits which all makes sense.

Sometimes we get alerts back from the customer page, with the referring URL as results saying the session was blank and it looks like a customer who has cookies disabled. Again, this is fair enough and up to the user to accept cookies.

THE PROBLEM

We are getting a handful of alerts per week from customers who have an empty order ID session var, but on the payment page (with the referring URL as customer). So they successfully pass the customer stage with the order ID var in existence. But when I recheck it on the payment page after they submit their personal info - GONE!

It makes no sense to me. How can it be fine on the previous page, but not on the next? The domain stays the same, all URLS are on HTTPS so it's not that.

My email includes PHP to loop through all SEssion Vars - and that is always blank. (So it's not just the single session variable that is blank, the whole lots is blank).

Is there any more debug I can add to these email alerts to see if the session is in tact, or rather it isn't? Here's some code:

customer and payment both start with:

<?php
require_once "../includes/common.php";

$quoteShared        = new quoteShared();

// Check if this is a direct page hit
if (requestSession("sessionid") == "") {

    echo $quoteShared->directHit();
    die;

Common includes the obvious at the start:

session_start();

How we check sessions:

function requestSession($xParam) {
    $value = "";

    if (isset($_SESSION[$xParam]))
    {
        if ($_SESSION[$xParam] != "") {
            $value = $_SESSION[$xParam];
        }
    }

    return $value;
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算