session problem in oscommerce

Discussion in 'PHP' started by xpertdev, Nov 28, 2010.

  1. #1
    Hi

    I have session problem in oscommerce.
    My problem is for just opera browser and Safari browser in MAC OS.

    In this browsers session in not maintaining for my site.
    So when I add something to cart, so for just once it display in cart but when I refresh the page then cart goes empty.

    Problem occurs only when there is no oscId in url. When there is a oscid exists in url then there is no problem with session.

    I have made custom url for my own. So login.php will like login only.

    Can anyone please figure out the problem.

    I can provide the url upon request.

    Thanks
    Avi
     
    xpertdev, Nov 28, 2010 IP
  2. max2010

    max2010 Greenhorn

    Messages:
    81
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #2
    it could be a problem with cookie domain in configure file
     
    max2010, Nov 29, 2010 IP
  3. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #3
    Logout and clear all your cookies.
    Add this line to index.php and or the login file just under <?php

    header('P3P: CP="CAO PSA OUR"');
    Code (markup):
    If that still fails its because safari doesn't except 3third party cookies, thus if you have no cookies, you can't have sessions. IBM offer a free http://www.alphaworks.ibm.com/tech/p3peditor P3P Policy Editor which should work for all browsers.
     
    MyVodaFone, Nov 29, 2010 IP
  4. xpertdev

    xpertdev Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Then why only in some browsers?
    and how can I sort out this problem?
     
    xpertdev, Nov 29, 2010 IP
  5. xpertdev

    xpertdev Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    What will this do?
     
    xpertdev, Nov 29, 2010 IP
  6. xpertdev

    xpertdev Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    When I have placed your header code in login file, then except mozila fire fox all browsers displaying cookies_usage.php file instead of login page.

    What can be a problem?
     
    xpertdev, Nov 29, 2010 IP
  7. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #7
    And what does that file display, does it allow the user to except cookies ?

    If you google "safari third party cookies " you will find a heap of information, most will boil down to creating a privacy policy (P3P), the IBM link above will help you with that.
     
    MyVodaFone, Nov 29, 2010 IP
  8. xpertdev

    xpertdev Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I have attached the screen shot of the pages which I am getting in Opera and Mac Safari.
    cookies.jpg

    Can you please look into it.? I am getting this page only in opera and Mac Safari.
     
    xpertdev, Nov 29, 2010 IP
  9. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #9
    Looks like instructions for the end user to edit their browser settings to allow cookies which is a good thing, I guess you could edit those and add instructions for the safari etc...

    I found these instruction after a quick search, once the end user completes either of these steps, they wont see that page again and everything should be fine.

    Choose Preferences from Safari menu
    Select Security icon
    Cookie settings are shown in window
    Choose your preferred settings

    Go to Opera in the main menu and select Preferences (or press Alt+P to access them directly)
    Select Privacy

    In addition to choosing different settings for first-party (normal) and third-party cookies, you may edit cookie settings on a domain/server basis or even edit individual cookies by clicking the Manage cookies button.

    -------------
    Other then that, all I can suggest is that you create a P3P as above then you could remove that line of code provided above.
     
    MyVodaFone, Nov 29, 2010 IP
  10. xpertdev

    xpertdev Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    My opera setting already set to always accept.
    And same in safari.
    Can you please tell me, How can I set it for particular domain?

    Thanks
    Avi
     
    xpertdev, Nov 29, 2010 IP
  11. neil12345

    neil12345 Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Enable Cookies for opera by foll.instructions at

    http://www.timeanddate.com/custom/cookiesopera.html

    For Safari ::

    In order to enable/disable cookies from Safari web browser one need to perform below mentioned steps:

    1) Open Safari web browser and click on menu bar.
    2) Click on Preferences and security icons.
    3) select/deselect option “Accept cookies: select Radio button "only from sites you navigate to" on requirement
    6) Click ok to apply changes.
     
    neil12345, Nov 29, 2010 IP