Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 61
  • Last Modified:

Cookie set on google chrome doesn't work when using Safari

I am using Chrome to test my registration code. When I register, it sets a cookie valid for 24 hrs so that the person who registered the account has 24 hours to activate their account. If I use google tools I can see that the cookie is definitely set.

When I receive the activation email and click on the link, it takes me to my safari browser as this is my default browser. I then get the message that I set up to say that the activation was unsuccessful because the time expired which is impossible since I did it 30 seconds later. I noticed however that if I copy that link and put it into chrome, it works.

What am I doing wrong? Surely in the real world it doesn't work like this i.e.: if I register on chrome, I can't activate in another browser?
0
Black Sulfur
Asked:
Black Sulfur
  • 3
  • 2
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
if I register on chrome, I can't activate in another browser?
Using cookies, No, you can't.  Cookies are set in the browser that was used.  They are Not available to any other browser.  Cookies are never shared between browsers.
0
 
Black SulfurAuthor Commented:
I see. So, I basically can't achieve what I want unless I store the time of registration in the database and compare that with the time the user tries to activate their account?
0
 
Dave BaldwinFixer of ProblemsCommented:
What is 'normally' done is to include a long hash as a query string to the link in the email.  Such as https://www.mydomain.com/?q=Asjjkqoorllk1928747665mmnnsjhjkckjdjk where the hash is your code to identify the user.
0
 
Black SulfurAuthor Commented:
Yeah, I have that hash but I also want to have a time limit for them to register which is why I wanted the cookie. But as I said, I think I will just store the time of registration in the database and take it from there.
0
 
Dave BaldwinFixer of ProblemsCommented:
Sounds like a plan to me.!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now