View Single Post
Old 08-04-2005, 10:17 PM   #2 (permalink)
teknomage1
Jack of all trades
 
teknomage1's Avatar
 
Join Date: Feb 2005
Location: Los Angeles
Posts: 598
teknomage1 is on a distinguished road
Send a message via AIM to teknomage1
When I ran this is firefox as
Code:
<html>
  <head>
    <title></title>
    <meta content="">
    <style></style>
  </head>
  <body>

<?php 
 if(isset($_COOKIE['cart_id'])) { 
     $cart_id = $_COOKIE['cart_id']; 
	  } else { 
     $cart_id = md5(uniqid(rand())); 
     setcookie("cart_id", $cart_id, time() + 3600); 
}

echo ($_COOKIE['cart_id']); ?>

</body>
</html>
I got an error form firefox saying the headers had already been set and thus the cookie couldn't be added. But after changing it to
Code:
<?php 
 if(isset($_COOKIE['cart_id'])) { 
     $cart_id = $_COOKIE['cart_id']; 
	  } else { 
     $cart_id = md5(uniqid(rand())); 
     setcookie("cart_id", $cart_id, time() + 3600); 
}
<html>
  <head>
    <title></title>
    <meta content="">
    <style></style>
  </head>
  <body>

<?PHP
echo ($_COOKIE['cart_id']); ?>

</body>
</html>
It worked fine.
__________________
Stop intellectual property from infringing on me
teknomage1 is offline   Reply With Quote