Solved

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

Posted on 2016-09-25
5
33 Views
Last Modified: 2016-09-25
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
Comment
Question by:Black Sulfur
  • 3
  • 2
5 Comments
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 41814404
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
 

Author Comment

by:Black Sulfur
ID: 41814405
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
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 41814411
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
 

Author Comment

by:Black Sulfur
ID: 41814414
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
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 41814421
Sounds like a plan to me.!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now