Re: Cookie Variables Maxing Out Using IE6

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



dpgirago@xxxxxxxxxxxxxx wrote:
Does IE6 limit somehow/somewhere the number of cookie variables I can
create and store?  The following code snippet successfully creates 24
cookie variables when run in FireFox, but in IE6 it is limited to 20.  I
can provide the full code with HTML/Javascript if anyone wants to test for
themselves.

David

<?php

// populates a hidden form variable on the second submit
$somevar = "anything";

if (!IsSet($_POST['monitors']) || empty($_POST['monitors'])) {
    $_POST['monitors'] = array();
}

/*********** Manage Monitor CheckBoxes via $_POST & $_Cookie *************/

// code in here only runs the first time the page is displayed
if ($_POST['trakVisit'] == "") {
      if (IsSet($_COOKIE['cookieMeter'])) {
            foreach ($_COOKIE['cookieMeter'] as $key => $value) {
                  if ($value == 'CHECKED') {
                        $checked[$key] = 'CHECKED';
                  }
                  else
                        $checked[$key] = "";
            }
      }
}
// runs on the second and subsequent submits
elseif  ($_POST['trakVisit'] == "anything") {
      for ($i=1; $i <= 24; $i++) {
            if (in_array($i, $_POST['monitors'])) {
                  setcookie("cookieMeter[$i]", 'CHECKED', time()
+60*60*24*12, '/', ".mydomain.com", 1);
                  $checked[$i] = 'CHECKED';
            }
            elseif(!in_array($i, $_POST['monitors'])) {
                  $checked[$i] = '';
                  setcookie("cookieMeter[$i]", 'CHECKED', time()-3600, '/',
".mydomain.com", 1);
            }
      }
}

echo "<pre>";
print_r($_COOKIE);
echo "</pre>";

?>

Why do you need more than one single cookie? If you want to store multiple pieces of information, serialize the data or something similar.

Regards, Adam Zey.

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux