Re: [PHP-DB] cookies multiple pages
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
Re: [PHP-DB] cookies multiple pages
Banging my head against a wall with this ! Hope someone can help ! Using MySQL Trying to list cities with events for that month I've correctly (i think) formatted my date to a datetime style for MySQL $month is there chosen one $tosearch = date(Y-$month-d 00:00:00); And then this is my inquiry -(although this just would be 60 days in advance but it doesn't work) And what I really want is just for that month ? SO if its already 20th of the month it only looks a the next 11 days SELECT distinct t_city_name,t_city_id_city, t_event_date FROM t_city,t_zipcodecity,t_location,t_event WHERE (t_city_id_city = t_zipcodecity_id_city) AND (t_zipcodecity_zipcode = t_location_zipcode ) AND (t_location_sex = 2) AND (t_location_id_location = t_event_id_location) AND (t_event_date = (DATE_ADD('2002-07-03 00:00:00', INTERVAL 60 day)) ) ORDER by t_city_name Can anyone help please -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] cookies multiple pages
1) no, the commented setcookie(user_data,,time()+(3600));// set for 6 weeks *24*7*6 I would move the *24*7*6 back into the (3600) to make it so. I just want to test for an hour 2) so maybe this is a problem with the server? I've been tearing my hair out because neither cookies nor sessions are acting the way that I have done them in the past on a different server. **sigh** On Wednesday, July 3, 2002, at 10:05 AM, [EMAIL PROTECTED] wrote: 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] cookies multiple pages
as in if (!isset($_COOKIE['user_data'])) { setcookie(user_data,,time()+(3600));// set for 6 weeks *24*7*6 } ?? nah.. that doesn't work either. It still creates a new cookie. On Wednesday, July 3, 2002, at 10:05 AM, [EMAIL PROTECTED] wrote: Is this a issue with register _globals = off. try referencing it with $_COOKIE['user_data']. [EMAIL PROTECTED] said: Trust me this does not work with php 4.2.1 and apache 2.0.39 from what I am told if you get the cvs for apache 2.0.4 it should but I just down graded to apache 1.3.26 and php 4.0.6 and eveything works like a champ. Just my .02 of course if you get it working let me know what you did as I spent a week on it... but since this isn't my server, I can't downgrade or reset settings. *sigh* Thanks, so far.. Terry
Re: [PHP-DB] cookies multiple pages
One thing I did find was to look at your php.ini file and see where the session.save_path=/tmp this is now pointing to your server /tmp not the apache directory anymore so you will either have to change the permissions on that folder so apache can write there or make a directory somewhere else and do the same. That is how I got my sessions to work again and or court to make sure it is enabled. As for the mulitple cookies that is still a somthing I have not been able to get to work. When I posted it in the bugs. section of php.net they said to use the cvs apache 2.0.4 version and it should work...but I am not in a position to put non-stable things in production. HTH-- Khris Terry Romine [EMAIL PROTECTED] 07/03/2002 11:32 AM To: [EMAIL PROTECTED] cc: php-db [EMAIL PROTECTED] Subject:Re: [PHP-DB] cookies multiple pages 1) no, the commented setcookie(user_data,,time()+(3600));// set for 6 weeks *24*7*6 I would move the *24*7*6 back into the (3600) to make it so. I just want to test for an hour 2) so maybe this is a problem with the server? I've been tearing my hair out because neither cookies nor sessions are acting the way that I have done them in the past on a different server. **sigh** On Wednesday, July 3, 2002, at 10:05 AM, [EMAIL PROTECTED] wrote: 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] cookies multiple pages
just checked and the server is running Apache 1.6.19 and PHP 4.0.6 Terry On Wednesday, July 3, 2002, at 09:52 AM, [EMAIL PROTECTED] wrote: Trust me this does not work with php 4.2.1 and apache 2.0.39 from what I am told if you get the cvs for apache 2.0.4 it should but I just down graded to apache 1.3.26 and php 4.0.6 and eveything works like a champ. Just my .02 of course if you get it working let me know what you did as I spent a week on it...