0

Ok, this one caught me by surprise. I have a shopping cart coded in PHP. During checkout, I re-direct to the secure SSL page by simple adding the 'https://' to the link. This works just fine in internet explorer. No data lost, all my session variables pass just fine. When I use any other browser however, my shopping cart information (one of my session variables) does not get passed.

Clearly, my simple idea isn't the correct way to do this. Any ideas on how to link to the secure SSL PHP page, and maintain continuity with my session variables? Here is my link to begin the checkout process as it currently stands;

if ($btns=="shop") {
    echo "<div id=\"btns\"><table id=\"cart_btns\">\n";
    // display save change button
    echo "<tr><td><input type=\"hidden\" name=\"save\" value=\"true\"/>
            <input type=\"image\" src=\"images/save-changes.png\"
            style=\"border:1px solid rgb(50,50,50)\" alt=\"Save Changes\"/></td>\n";
    // continue shopping button
    echo "<td><a href=\"index.php\">
        <img src=\"images/continue-shopping.png\"
        alt=\"Continue Shopping\" style=\"border:1px solid rgb(50,50,50)\" height=\"50\"
        width=\"135\"/></a></td>\n";    
    // check-out button (SSL implemented)
    echo "<td><a href=\"https://MASphotoPDX.com/mas_cart.php?paynow=1\">
        <img src=\"images/go-to-checkout.png\"
        alt=\"Go to Checkout\" style=\"border:1px solid rgb(50,50,50)\" height=\"50\"
        width=\"135\"/></a></td></tr></table></div>\n";         
    echo "</form>\n"; }

I can see conceptually what is happening, just not how to fix it. Also, why the heck does this silly thing work just fine in IE?!?! That one really blows my mind. Usually it is the other way around!

Any help would be GREATLY appreciated!!

  • 1
    Background (not a solution): [Cookie across HTTP and HTTPS in PHP](http://stackoverflow.com/questions/2321224/2321774#2321774) not sure what is happening here, as long as the cookie is not marked "secure" it should work across protocols in all browsers – Pekka Nov 21 '13 at 23:51
  • Possible duplicate : http://stackoverflow.com/questions/441496/session-lost-when-switching-from-http-to-https-in-php – Sebastien C. Nov 21 '13 at 23:56
  • You are definitely my hero!!! I didn't see that question/answer in my original search. Great catch! I took his suggestion, and it worked perfectly!! Still don't know why IE doesn't generate a new session id, and every other browser does, but all is now right with the world! Thank you so much!!! – Michael Smith Nov 22 '13 at 00:39

0 Answers0