| |||||||||||
| |||||||||||
Cookies 101 with a twist Posted by dabbler (leah), 7 October 2003 I've spent a couple of hours reading through various cookie pages, and I understand cookies generally. But, I am trying to translate perl script to php, and I'm getting a little lost. I'm not sure if I need to translate actually.What I want to do is take an open source php/mysql recipe database and use yabb membership for user management and permissions, stripping out it's own login code. Testing/learning with a blank page, I can see that the yabb cookie is set, and print it's contents. So far I'm confident that I can display a page or display an authorization error based on this. However, I also need to display a login and be able to set this same cookie from this non yabb page, so as not to force someone to login at the forum and then return to the cookbook area. I did some research at yabbforum, and found others who were doing this with cgi, but not with php. I want this to be independent of yabb scripts, other than checking user.dat files to set user permissions. So the first question, how can this section of perl script be translated to php? Code:
It's the first part that's got me stumped. ![]() Posted by admin (Graham Ellis), 8 October 2003 In Perl, you have to translate the cookie string in the environment variable into something more friendly (that's what the first section of the code is doing), but PHP does it for you automatically, and provides you with an array of cookies called $_COOKIE.Simply leave out the first setcion of the code ![]() Posted by dabbler (leah), 13 October 2003 Thanks Graham, I appeared to continue to try to make it more complicated than it actually was, then resorting to finding another php login/cookie setting script to see working code. I've now got a basic script which is checking the login password and comparing it to the yabb user data, and setting the cookies properly. ![]() However, I spent the weekend learning how to encrypt the passwords before comparing and setting the password encrypted as yabb does, tracking down the salt that was in front of my face the whole time. And that was the easy part, lol. ![]() Thanks for you help. ![]() This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |