Is this a issue with register _globals = off.  try referencing it with
$_COOKIE['user_data'].
Also isn't 3600 only an hour.  60secs * 60mins?  i think 6 weeks would
be...  151200  60 * 60 * 42days
does that work?

Jeff


                                                                                       
                                
                    Terry Romine                                                       
                                
                    <eatrom@blazing-t       To:     [EMAIL PROTECTED]               
                                
                    rails.com>              cc:                                        
                                
                                            Subject:     [PHP-DB] cookies multiple 
pages                               
                    07/03/2002 10:45                                                   
                                
                    AM                                                                 
                                
                                                                                       
                                
                                                                                       
                                




I'm having a problem with cookies over several pages. I've tried to set
them up per the manual, ie: prior to header, and using
setcookie('cookiename',$value,time()+3600). The cookie seems to be
created fine on the first page, and passed to the second page, but is
not maintained when the pages are re-viewed.

I am trying to use this to assign a user id when someone comes in, and
keep their id while they go through various searches and resulting
pages, as well as keeping their search parameters for them. But when
they go to a new search, all the data gets wiped and it starts all over.

I have the cookie set for an hour, but it is empty when the search is
run again. I thought cookies would remain in effect for the duration of
the life (an hour) and be accessible to the pages over again.

Help??

My code is as follows:

search.php:
 if (!isset($user_data)) {
  setcookie("user_data","",time()+(3600));    // set for 6 weeks *24*7*6
 }
  [snip]
 if($user_data=="") {
  $sql="insert into user (last_login) values (now())";
  mysql_query($sql);
  $myID= mysql_insert_id();
  $user_data = $myID;
 }

search_result.php:
 if (isset($user_data)) { $myID = $user_data; }


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





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

Reply via email to