Keep the same session on different websites

← Ask a Question — Started 19 Jul, 2011

c3f3 Admin
19 Jul, 2011, 3:24 pm (This post was last modified: 19 Jul, 2011 3:30 pm by c3f3 Admin.)
Ok, so i have a few websites, that are all linked to my main 1. I am coding them all and want to know if it is possible to link them all to the same database where they can sign in on 1 website, and go onto my other website and still be signed in on my other website with the same login details... I know you cannot use sessions, so i was wondering if it was possible with cookies? I don't know really anything about them as i have never had to use them before, but i was wondering if i could create it on the website they sign into, and then it either gets the information stored in a database accessible to to my other websites, or whether i can grab the cookie from the place where it is created... Im sure there is a way, i just cant find 1 Tongue Thanks.
[Image: 1_15_01_11_6_52_28.png]
Yes you can easily provide cookie-based sessions.

Normally, the cookie will have a value of 1_randomised string. This means it's user #1 and the random string will be something like an md5 of the user's "login key" - a unique string per user. When the user visits the second site, you just need to check that the cookie - and it's values - match a value in the users table.

You should also do other processes, such as making sure the cookie expires after a certain time or making sure that the user is coming from the same (or similar) IP address.

User(s) browsing this thread: 1 Guest(s)