Can someone offer any help with the code below? I have a cookie that is
set and is separated by pipes (|). For each segment, I have to look up
the id in a text file. I can loop through the cookie and get each segment,
but when I open the text file and loop through it, it only matches the
first segment.

Any help is appreciated.

         setcookie("test", "43|50|77|84|", time()+31536000); /* expire in 1 
year */

$myCookie = explode("|",$HTTP_COOKIE_VARS["test"]);
foreach ($myCookie as $v){
         echo $v . " ";

         $links_database = "c:\\program

         $fd = fopen($links_database, "r");
         $contents = fread($fd, filesize($links_database));

         $cookieInfo = explode("|", $contents);

         //foreach ($cookieInfo as $a){
         while(list($key, $value) = each($cookieInfo)){
                 if($v == $cookieInfo[0]){
                         print "Link Info: $cookieInfo[1]\n<br>";



PHP General Mailing List (
To unsubscribe, visit:

Reply via email to