Hi,

Richards email was kinda wierd, so I'll reply to your email directly

> Hi, all --

> I guess I need a primer on cookie usage.  I've read the manual regarding
> setcookie and have gone back to look at everything having to do with
> cookies on this list in the past few months (it seems that I'm not the
> only one with some troubles, but most of them appear to have been having
> sent some HTML output before trying to set a cookie).

The manual is all you need to know, you just need to experiment with the
information provided until it clicks in.

> I want to check to see if the user has my cookie to then log him in
> automatically, and if he doesn't then I show the login screen and he logs
> in and then I set the cookie if the box is checked.

Okay, simple:

<?php
if (isset($_COOKIE['yourcookie'])) { // they have the login cookie, so do
what you called "log them in", whatever that means }
else { // they are not logged in, so include your login page }
?>

> Of course, $_COOKIE is set, so I have to check for my cookie name.  Even
> something as simple as

>   $_COOKIE['test'] = 'tested';

> followed by a load of the page and a print doesn't show it.

The above stuff didn't really make sense, you havn't explained what you are
trying to do and what does not work.

> Do I only call setcookie if the cookie isn't set, or do i call it every
> time I load the page to initialize it?  Once I set it, how do I read it?
> Does anyone have any pointers to a basic tutorial?

setcookie() does what you would expect, sets a cookie. As explained on the
PHP manual, " setcookie -- Send a cookie "
So, logically, you only need to call it when you want to set a cookie...

If you want to read the contents of the cookie, print_r($_COOKIE); That will
show you all cookie information on their computer for your domain.

If you know the name of the cookie you set, simply print $_COOKIE['name']

There's not a lot to it, all the information you'll need is on the manual,
good luck!


> TIA & HAND


"David T-G" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to