SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2009
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Session & cookies problem

    hi All,

    im developing one shopping site with hdfc payment interface. In this whole site im using sessions & cookies to display username.
    Before entering into payment it shows username . After payment (when i return back to my site Ex: afterpayment.php) , my session & cookies are empty.Its only happ in Firefox(im using 3.5.5) and not in IE.

    Here one surprise is , when i open home page again before logout, its showing username which is stored in session..

    why ? & How????????
    Any one help plz.

  2. #2
    SitePoint Wizard bronze trophy Kailash Badu's Avatar
    Join Date
    Nov 2005
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could it be a case of missing Subdomain. For example, before payment the url was http://example.com/process.php but after payment user is redirected back to http://www.example.com/process.php . cookies are not available in subdomains (in some browsers) unless you explicitly tell them to with the third parameter of setcookie() function. same for session I guess which are implemented through cookies.

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2009
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    s. I got it..
    thank you..

    But i dont know how rectify this problem.
    Do u know how to any way?

    or how to keep sesions common for all?

  4. #4
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    refer to http://php.net/setcookie for cookie params
    note domain part
    set appropriate in session_set_cookie_params

  5. #5
    SitePoint Enthusiast
    Join Date
    Oct 2009
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry,

    i cant access this site . trend micro blocked (for security).

    Any other site plz...

  6. #6
    SitePoint Enthusiast
    Join Date
    Oct 2009
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually i have sorted this error by redirecting http://example.com domain to http://www.example.com..


    even though i would like to know, how to sort this error..

  7. #7
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Doh! php.net got blocked! what a weird
    http://www.w3schools.com/php/func_http_setcookie.asp
    Does this site got blocked too?

  8. #8
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this one before session_strart()
    session_set_cookie_params(0, "/", ".example.com");

  9. #9
    SitePoint Enthusiast
    Join Date
    Oct 2009
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can u plz explain this code?

  10. #10
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use manual for explanations. it is great power
    another site
    http://www.weberdev.com/Manuals/PHP/...ie-params.html
    found by typing session_set_cookie_params into google search

  11. #11
    SitePoint Enthusiast
    Join Date
    Oct 2009
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A great thanks to u..


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •