Simple cookie usage

This is a discussion on Simple cookie usage within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I'd like to add cookies to my website but I don't understand the usage of it. I've ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-15-2003
Jaak
 
Posts: n/a
Default Simple cookie usage

I'd like to add cookies to my website but I don't understand the usage of
it. I've read and tried the examples of the tutorial but it just don't work
with me.

Does anyone have a little working write and read example?

Thanks in advance


Reply With Quote
  #2 (permalink)  
Old 12-15-2003
Poul Møller Hansen
 
Posts: n/a
Default Re: Simple cookie usage

> I'd like to add cookies to my website but I don't understand the usage of
> it. I've read and tried the examples of the tutorial but it just don't

work
> with me.
>
> Does anyone have a little working write and read example?
>



I'm not completely sure on what your intentions are, but maybe this can be
used:

setcookie ("Username", $Userid,time()+2592000); /* expire in 30 days */
setcookie ("Country", $Country,time()+2592000); /* expire in 30 days */

if (isset($_COOKIE['Username'])) {
$Username = $_COOKIE['Username'];

unset $Country;
if (isset($_COOKIE['Country'])) {
$Country = $_COOKIE['Country'];

Remember that the setcookie mus be used before any header is sent.


Poul


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:06 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0