note 33655 deleted from reserved.variables by didou

From: Date: Thu, 03 Jul 2003 08:12:52 +0000
Subject: note 33655 deleted from reserved.variables by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-51406@lists.php.net to get a copy of this message
Note Submitter: <?php echo "Jed Hunsaker" ?> ---- // This script saves all $_POST data into cookies named as $_POST's key for each. Can easily be changed to $_GET or // $_REQUEST or whatever you want. IIS on Windows XP Pro only allows 20 cookies though, so be careful. I had to play // some tricky crap with arrays and the explode() and implode() functions to get that working! if (isset($_POST['reset'])) { // Name an HTML form submit button "reset" to delete all cookies within the current domain foreach ($_COOKIE as $key => $value) setcookie($key, $value, time()-3600); } else { // Store all post data to cookies foreach ($_POST as $key => $value) { if (!empty($value)) { $_COOKIE['$key'] = addslashes($value); setcookie($key, addslashes($value), time()+60*60*24*7); } } } // You can add much more functionality to this script than I show but this gets the foundation. If you want to store // only particular variables, create an array with those variable names and foreach through their values, executing // an eval statement to store each cookie respectively. You can get quite creative. I have code for it. // Email me with any questions at str_replace("%nospam%", "lavadrop", "jed@%nospam%.com");

« previous php.notes (#51406) next »