Cookies .. first time
| From: | Buis, Hans | Date: | Mon, 30 Oct 2000 12:22:04 +0000 |
| Subject: | Cookies .. first time | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-22669@lists.php.net to get a copy of this message | ||
Hiya all,
Today is my first day with cookies .. (jihaa :)
I'm running Apache, PHP's latest version, on a W2K pro system.
I've copied this source from devshed or phpbuilder:
===================================================
<?php
// setcookie.php
//
// set cookie if not already set
if (!isset($id)) {
srand((double)microtime()*1000000);
$randval = rand();
setcookie("id",$randval,1003842401,"/","localhost",0);
}
setcookie("id",$randval,1003842401,"/","localhost",0);
// a cookie to expire for 4 hours -> time()+14400
?>
====================================================
Wanting to show the content with:
====================================================
<html>
<head>
<title>Show Cookie</title>
</head>
<body>
<?
// showcookie.php
//
// Shows what ID cookie is
//
echo $HTTP_COOKIE_VARS["id"];
?>
</body>
</html>
======================================================
Though this doesn't seem to work. No vars are being echo'd to the browser... :(
Any ideas?
Regards,
Hans Buis