Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8376957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:33:07+00:00 2026-06-09T15:33:07+00:00

I have a problem with cookies. Basically I’m trying to store the user’s session

  • 0

I have a problem with cookies.

Basically I’m trying to store the user’s session ID as a cookie like so:

 setcookie("CheckoutSessionID",session_id(),time()+3600);

This works fine on my site, the cookie has the correct value and is valid for long enough. However, my site redirects to PayPal so the user can confirm a payment. The user is then redirected back to my site. It’s when the user is redirected back to my site that ALL cookie variables are gone.

As in, print_r($_COOKIE), var_dump($_COOKIE) etc have no values. This only occurs after being directed to and from PayPal.

Any ideas as to why this is happening?

Thanks in advance for all help, I’m stumped!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:33:08+00:00Added an answer on June 9, 2026 at 3:33 pm

    Okay I’ve been digging quite deep and realised that an earlier question of mine is related:

    PHP sessions and session_start()

    Basically I had problems because PHP sessions were being deleted when I went to PayPal and back. However, I believe this was actually caused by the session COOKIE being destroyed, not the entire session.

    I also found this topic here: Do PHP sessions get lost when directing to a payment gateway?

    Answer given by someone suggests using a GET request with the return URL to send data back, instead of using cookies or sessions.

    The whole reason I was using a cookie in the first place was to save the user’s session ID, as the sessions weren’t working properly, so basically I’ve just made my return URL something like this:

    mydomain.co.uk/mypage.php?SessionID=[session ID goes here] and then obtained it then set the user’s session ID to it.

    Sorted! For now… I mean I’ll probably end up hitting another brick wall due to cookies/sessions not working properly.

    Thanks everyone for your help 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an issue with login session. Basically the flow is like this: user
I have an issue with login session. Basically the flow is like this: user
For some time I have been trying to solve fairly common problem consisting of
I have this weird problem with setting up cookies with PHP. Everything worked fine
I have a PHP login which sets 2 cookies once someone login. The problem
I have been considering the problems arising with user authentication, using sessions/cookies and the
I have constant problem with cookies on my Django site which is set up
I have a problem with writing cookies in cakephp and even don't know how
I have a problem with javascript cookies that I have been struggling with for
To comply with the cookies law, I have created a user control that gets

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.