If you note the part of the script where the cookie is set

//make unique session id and store it in Database
  $timer = md5(time());
  $sid = $UserID . "+" . $timer;
  SetCookie("Cookiename",$sid,time()+2592000); file://Set Cookie for 30 days
  $query = "update members set sid=\"$timer\" where UserID=\"$UserID\"";

I set the cookie with the user id and a Session ID I create... then when it
checks
the cookie it just does

  $sidarray = explode("+", "$Cookiename");
  $query = "select * from members where UserID = \"$sidarray[0]\" and sid =
\"$sidarray[1]\"";

So using this script you could put whatever else you wanted in the cookie.
You would just change
  $sid = $UserID . "+" . $timer;
to
  $sid = $UserID . "+" . $timer . "+" . $email;

for example.  Then when you do
  $sidarray = explode("+", "$Cookiename");

You would have
$sidarray[0] = $UserID
$sidarray[1] = $timer
$sidarray[2] = $email

You could continue adding additional variables (or plain strings for that
matter) in this manner.
The only thing to keep in mind is that cookies have a 4K file size
limitation and anything beyond
4K will be lost.  Check under additional notes on this page for details on
cookie limitations

http://www.netscape.com/newsref/std/cookie_spec.html

I hope all that is clear.  Let me know if you have any more questions

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


----- Original Message -----
From: Cato Larsen <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 13, 2001 9:06 AM
Subject: Re: [PHP-DB] Member authentication with PHP and MySQL


> Thanks a mill Sheridan!
> This was accually what I was looking for, but gave up since the other
> tutorials and script examples where too complicated for me to grasp.
>
> One question to the code on the site:
>
> Is it possible to insert info to be grabbed on other sites?
> Like
> email
> password
> name
>
> So you can grab like name, instead of having to querity the DB all the
time
> you need the name of the person and so on?
> And if yes, how do you get it from the cookie and insert it into the page
> like $name ?
>
> Best regards
>
> Cato Larsen
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to