|
-
Oct 10th, 2002, 09:59 AM
#1
Thread Starter
Frenzied Member
Reading a cookie (Need to brush up this one :D)
Hey ya,
I'm writing a (simplish) php / MySQL pop up exchange to use on my site.
I want the user to be able to store their username and password in a cookie, And so, IF they provide the correct details,
The cookie gets set like so:
PHP Code:
// User ID - Username - Password (MD5)
$userinfo = base64_encode("$user_id:$username:$password");
setcookie("usercookie","$userinfo",time()+2592000);
Any how, so far, i have got by just editing my php nuke site, to include the login, password ETC thats needed (Genious huh)
Well any how, I want this site to be totally indipendant from my nuke site, (For the main reason, it dont go anything with my nuke site).
Any how,
How do i get the cookie READ into the php script?
Like make it into a variable called "$userinfo" When they call my index.php / login.php / member.php?
From php nuke (lol) I have been able to find out how i READ it into the user id / username / password
WHEN i have it as a variable ($userinfo):
PHP Code:
$user = base64_decode($userinfo);
$cookie = explode(":", $user);
$user_id = $cookie[0];
$username = $cookie[1];
$md5_password = $cookie[2];
// Login stuff goes here IF the cookie is correct,
// Else
// setcookie("usercookie");
this is basically a MUST have thing for my "Exchange" as i really doubt users wanna have to login every page etc.
Ne one help plz?
TNX
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|