Re: [PHP-DB] Cookies with databases
Run the setcookie code, and open the folder where your browser stores its cookies. Look for your cookie and see it whats in it is what you expect. Another suggestions is to echo out the code before you execute it to see if the values you expected are there echo setcookie ('USERcookie', $user);; Bastien From: Jason T. Davidson [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Cookies with databases Date: Thu, 21 Oct 2004 22:38:02 -0500 Bastien- I took out the quotes (as I noticed after the fact that I didn't need them) however this did not help. is the user cookie set This I do not know as I am trying to test this on that second page. I get nothing, so I am assuming that it isn't set, however the first one $cid is working just fine, but it's variable doesn't come from a database. -- Jason Davidson Bastien Koert wrote: Hi Jason, 1. I don't think you need the quotes around the values. 2. is the user cookie set? bastien From: Jason T. Davidson [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP-DB] Cookies with databases Date: Wed, 20 Oct 2004 19:54:54 -0500 I am trying to set a cookie with a value from a database. Here is my script: ? //Setting Cookies setcookie ('CIDcookie', $cid); setcookie ('USERcookie', $user); ? ? //Database connection require (../../db_connect.php); //Table Name $main_tbl = MAIN ? ? //Check the Password against the CID $query=SELECT * FROM $main_tbl WHERE CID='$cid'; $result=mysql_query($query) or die(mysql_error()); $check=mysql_fetch_array($result); if($Message == NoAccess){ echo(BCENTERFONT COLOR=REDYou do not have access to that page!/FONT/CENTER/B\n); include (staff_code/admin_links.php); } if($check[PASSWORD] != $_REQUEST[password]){ header(Location:staff_login.php?Message=Invalid); } if(($check[PASSWORD] == $_REQUEST[password]) AND ($check[USER] == A)) { include (staff_code/admin_links.php); $user = $check[USER]; } else{ include (staff_code/controller_links.php); } ? Then on the second page it is reading the cookies, but it will display the CIDcookie, but not the USERcookie. Here is the script on the second page: ? //Retrieve Cookies $cid = $_COOKIE['CIDcookie']; $user = $_COOKIE['USERcookie']; ? html head titleZMP ARTCC: Staff To Do List/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head ? echo (My CID is $cid); echo ($user); ? body text=#66 link=#66 vlink=#66 alink=#66 table width=600 tr tddiv align=centerfont size=4strongZMPs Staff TO Do List/strong/font/div/td /tr /table br table width=600 tr td colspan=3 bgcolor=#99div align=centerstrongfont size=3Completed Tasks/font/strong/div/td /tr tr bgcolor=#CC td width=100div align=centerDate Finished/div/td td width=250div align=centerTask/div/td td width=250div align=centerStatus/div/td /tr tr tddiv align=center10-13-04/div/td tddiv align=centerDLH SOP (new)/div/td tddiv align=centerAwaiting finish of other projects/div/td /tr tr tddiv align=center10-18-04/div/td tddiv align=centerZMP Policies/div/td tddiv align=centerquot;/div/td /tr /table br table width=600 tr td colspan=3 bgcolor=#99div align=centerstrongfont size=3 Tasks Awaiting VATUSA Approval/font/strong/div/td /tr tr bgcolor=#CC td width=100div align=centerDate Sent/div/td td width=250div align=centerTask/div/td td width=250div align=centerStatus/div/td /tr tr tddiv align=center10-09-04/div/td tddiv align=centerLNK SOP (new)/div/td tddiv align=centerAwaiting approval/div/td /tr tr tddiv align=center10-19-04/div/td tddiv align=centerM98 SOP/div/td tddiv align=centerAwaiting Approval/div/td /tr tr tddiv align=center10-19-04/div/td tddiv align=centerGeneral SOP/div/td tddiv align=centerAwaiting Approval/div/td /tr /table /body /html So I am assuming that somewhere in my first page that my cookie isn't actually gettting set properly. I have tried many varitites and can't find any help sections on cookies from a database. Any help would be appreciated! -- Jason Davidson -- 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Cookies with databases
Bastien- I took out the quotes (as I noticed after the fact that I didn't need them) however this did not help. is the user cookie set This I do not know as I am trying to test this on that second page. I get nothing, so I am assuming that it isn't set, however the first one $cid is working just fine, but it's variable doesn't come from a database. -- Jason Davidson Bastien Koert wrote: Hi Jason, 1. I don't think you need the quotes around the values. 2. is the user cookie set? bastien From: Jason T. Davidson [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP-DB] Cookies with databases Date: Wed, 20 Oct 2004 19:54:54 -0500 I am trying to set a cookie with a value from a database. Here is my script: ? //Setting Cookies setcookie ('CIDcookie', $cid); setcookie ('USERcookie', $user); ? ? //Database connection require (../../db_connect.php); //Table Name $main_tbl = MAIN ? ? //Check the Password against the CID $query=SELECT * FROM $main_tbl WHERE CID='$cid'; $result=mysql_query($query) or die(mysql_error()); $check=mysql_fetch_array($result); if($Message == NoAccess){ echo(BCENTERFONT COLOR=REDYou do not have access to that page!/FONT/CENTER/B\n); include (staff_code/admin_links.php); } if($check[PASSWORD] != $_REQUEST[password]){ header(Location:staff_login.php?Message=Invalid); } if(($check[PASSWORD] == $_REQUEST[password]) AND ($check[USER] == A)) { include (staff_code/admin_links.php); $user = $check[USER]; } else{ include (staff_code/controller_links.php); } ? Then on the second page it is reading the cookies, but it will display the CIDcookie, but not the USERcookie. Here is the script on the second page: ? //Retrieve Cookies $cid = $_COOKIE['CIDcookie']; $user = $_COOKIE['USERcookie']; ? html head titleZMP ARTCC: Staff To Do List/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head ? echo (My CID is $cid); echo ($user); ? body text=#66 link=#66 vlink=#66 alink=#66 table width=600 tr tddiv align=centerfont size=4strongZMPs Staff TO Do List/strong/font/div/td /tr /table br table width=600 tr td colspan=3 bgcolor=#99div align=centerstrongfont size=3Completed Tasks/font/strong/div/td /tr tr bgcolor=#CC td width=100div align=centerDate Finished/div/td td width=250div align=centerTask/div/td td width=250div align=centerStatus/div/td /tr tr tddiv align=center10-13-04/div/td tddiv align=centerDLH SOP (new)/div/td tddiv align=centerAwaiting finish of other projects/div/td /tr tr tddiv align=center10-18-04/div/td tddiv align=centerZMP Policies/div/td tddiv align=centerquot;/div/td /tr /table br table width=600 tr td colspan=3 bgcolor=#99div align=centerstrongfont size=3 Tasks Awaiting VATUSA Approval/font/strong/div/td /tr tr bgcolor=#CC td width=100div align=centerDate Sent/div/td td width=250div align=centerTask/div/td td width=250div align=centerStatus/div/td /tr tr tddiv align=center10-09-04/div/td tddiv align=centerLNK SOP (new)/div/td tddiv align=centerAwaiting approval/div/td /tr tr tddiv align=center10-19-04/div/td tddiv align=centerM98 SOP/div/td tddiv align=centerAwaiting Approval/div/td /tr tr tddiv align=center10-19-04/div/td tddiv align=centerGeneral SOP/div/td tddiv align=centerAwaiting Approval/div/td /tr /table /body /html So I am assuming that somewhere in my first page that my cookie isn't actually gettting set properly. I have tried many varitites and can't find any help sections on cookies from a database. Any help would be appreciated! -- Jason Davidson -- 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 with databases
Tyler- I have been to that section of php.net many times. My first cookie ($cid) doesn't have them domain listed and works just fine. Don't see I would need it for the cookie ($user)? -- Jason Davidson Tyler Replogle wrote: Yes you need to set the string domain http://us2.php.net/manual/en/function.setcookie.php that url should help you From: Jason T. Davidson [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP-DB] Cookies with databases Date: Wed, 20 Oct 2004 19:54:54 -0500 MIME-Version: 1.0 Received: from pb1.pair.com ([216.92.131.4]) by mc8-f21.hotmail.com with Microsoft SMTPSVC(5.0.2195.6824); Wed, 20 Oct 2004 18:10:29 -0700 Received: (qmail 42118 invoked by uid 1010); 21 Oct 2004 01:10:20 - Received: (qmail 95202 invoked by uid 1010); 21 Oct 2004 00:55:20 - X-Message-Info: JGTYoYF78jECeNGc3phkjLz5nkZbete3 Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Precedence: bulk list-help: mailto:[EMAIL PROTECTED] list-unsubscribe: mailto:[EMAIL PROTECTED] list-post: mailto:[EMAIL PROTECTED] Delivered-To: mailing list [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] Message-ID: [EMAIL PROTECTED] Organization: UND Aerospace Foundation User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en X-Posted-By: 24.197.179.243 Return-Path: [EMAIL PROTECTED] X-OriginalArrivalTime: 21 Oct 2004 01:10:29.0559 (UTC) FILETIME=[C167FC70:01C4B70A] I am trying to set a cookie with a value from a database. Here is my script: ? //Setting Cookies setcookie ('CIDcookie', $cid); setcookie ('USERcookie', $user); ? ? //Database connection require (../../db_connect.php); //Table Name $main_tbl = MAIN ? ? //Check the Password against the CID $query=SELECT * FROM $main_tbl WHERE CID='$cid'; $result=mysql_query($query) or die(mysql_error()); $check=mysql_fetch_array($result); if($Message == NoAccess){ echo(BCENTERFONT COLOR=REDYou do not have access to that page!/FONT/CENTER/B\n); include (staff_code/admin_links.php); } if($check[PASSWORD] != $_REQUEST[password]){ header(Location:staff_login.php?Message=Invalid); } if(($check[PASSWORD] == $_REQUEST[password]) AND ($check[USER] == A)) { include (staff_code/admin_links.php); $user = $check[USER]; } else{ include (staff_code/controller_links.php); } ? Then on the second page it is reading the cookies, but it will display the CIDcookie, but not the USERcookie. Here is the script on the second page: ? //Retrieve Cookies $cid = $_COOKIE['CIDcookie']; $user = $_COOKIE['USERcookie']; ? html head titleZMP ARTCC: Staff To Do List/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head ? echo (My CID is $cid); echo ($user); ? body text=#66 link=#66 vlink=#66 alink=#66 table width=600 tr tddiv align=centerfont size=4strongZMPs Staff TO Do List/strong/font/div/td /tr /table br table width=600 tr td colspan=3 bgcolor=#99div align=centerstrongfont size=3Completed Tasks/font/strong/div/td /tr tr bgcolor=#CC td width=100div align=centerDate Finished/div/td td width=250div align=centerTask/div/td td width=250div align=centerStatus/div/td /tr tr tddiv align=center10-13-04/div/td tddiv align=centerDLH SOP (new)/div/td tddiv align=centerAwaiting finish of other projects/div/td /tr tr tddiv align=center10-18-04/div/td tddiv align=centerZMP Policies/div/td tddiv align=centerquot;/div/td /tr /table br table width=600 tr td colspan=3 bgcolor=#99div align=centerstrongfont size=3 Tasks Awaiting VATUSA Approval/font/strong/div/td /tr tr bgcolor=#CC td width=100div align=centerDate Sent/div/td td width=250div align=centerTask/div/td td width=250div align=centerStatus/div/td /tr tr tddiv align=center10-09-04/div/td tddiv align=centerLNK SOP (new)/div/td tddiv align=centerAwaiting approval/div/td /tr tr tddiv align=center10-19-04/div/td tddiv align=centerM98 SOP/div/td tddiv align=centerAwaiting Approval/div/td /tr tr tddiv align=center10-19-04/div/td tddiv align=centerGeneral SOP/div/td tddiv align=centerAwaiting Approval/div/td /tr /table /body /html So I am assuming that somewhere in my first page that my cookie isn't actually gettting set properly. I have tried many varitites and can't find any help sections on cookies from a database. Any help would be appreciated! -- Jason Davidson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Check out Election 2004 for up-to-date election news, plus voter tools and more! http://special.msn.com/msn/election2004.armx -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http
[PHP-DB] Cookies with databases
I am trying to set a cookie with a value from a database. Here is my script: ? //Setting Cookies setcookie ('CIDcookie', $cid); setcookie ('USERcookie', $user); ? ? //Database connection require (../../db_connect.php); //Table Name $main_tbl = MAIN ? ? //Check the Password against the CID $query=SELECT * FROM $main_tbl WHERE CID='$cid'; $result=mysql_query($query) or die(mysql_error()); $check=mysql_fetch_array($result); if ($Message == NoAccess){ echo(BCENTERFONT COLOR=REDYou do not have access to that page!/FONT/CENTER/B\n); include (staff_code/admin_links.php); } if ($check[PASSWORD] != $_REQUEST[password]){ header(Location:staff_login.php?Message=Invalid); } if (($check[PASSWORD] == $_REQUEST[password]) AND ($check[USER] == A)) { include (staff_code/admin_links.php); $user = $check[USER]; } else{ include (staff_code/controller_links.php); } ? Then on the second page it is reading the cookies, but it will display the CIDcookie, but not the USERcookie. Here is the script on the second page: ? //Retrieve Cookies $cid = $_COOKIE['CIDcookie']; $user = $_COOKIE['USERcookie']; ? html head titleZMP ARTCC: Staff To Do List/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head ? echo (My CID is $cid); echo ($user); ? body text=#66 link=#66 vlink=#66 alink=#66 table width=600 tr tddiv align=centerfont size=4strongZMPs Staff TO Do List/strong/font/div/td /tr /table br table width=600 tr td colspan=3 bgcolor=#99div align=centerstrongfont size=3Completed Tasks/font/strong/div/td /tr tr bgcolor=#CC td width=100div align=centerDate Finished/div/td td width=250div align=centerTask/div/td td width=250div align=centerStatus/div/td /tr tr tddiv align=center10-13-04/div/td tddiv align=centerDLH SOP (new)/div/td tddiv align=centerAwaiting finish of other projects/div/td /tr tr tddiv align=center10-18-04/div/td tddiv align=centerZMP Policies/div/td tddiv align=centerquot;/div/td /tr /table br table width=600 tr td colspan=3 bgcolor=#99div align=centerstrongfont size=3 Tasks Awaiting VATUSA Approval/font/strong/div/td /tr tr bgcolor=#CC td width=100div align=centerDate Sent/div/td td width=250div align=centerTask/div/td td width=250div align=centerStatus/div/td /tr tr tddiv align=center10-09-04/div/td tddiv align=centerLNK SOP (new)/div/td tddiv align=centerAwaiting approval/div/td /tr tr tddiv align=center10-19-04/div/td tddiv align=centerM98 SOP/div/td tddiv align=centerAwaiting Approval/div/td /tr tr tddiv align=center10-19-04/div/td tddiv align=centerGeneral SOP/div/td tddiv align=centerAwaiting Approval/div/td /tr /table /body /html So I am assuming that somewhere in my first page that my cookie isn't actually gettting set properly. I have tried many varitites and can't find any help sections on cookies from a database. Any help would be appreciated! -- Jason Davidson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Cookies with databases
Yes you need to set the string domain http://us2.php.net/manual/en/function.setcookie.php that url should help you From: Jason T. Davidson [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP-DB] Cookies with databases Date: Wed, 20 Oct 2004 19:54:54 -0500 MIME-Version: 1.0 Received: from pb1.pair.com ([216.92.131.4]) by mc8-f21.hotmail.com with Microsoft SMTPSVC(5.0.2195.6824); Wed, 20 Oct 2004 18:10:29 -0700 Received: (qmail 42118 invoked by uid 1010); 21 Oct 2004 01:10:20 - Received: (qmail 95202 invoked by uid 1010); 21 Oct 2004 00:55:20 - X-Message-Info: JGTYoYF78jECeNGc3phkjLz5nkZbete3 Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Precedence: bulk list-help: mailto:[EMAIL PROTECTED] list-unsubscribe: mailto:[EMAIL PROTECTED] list-post: mailto:[EMAIL PROTECTED] Delivered-To: mailing list [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] Message-ID: [EMAIL PROTECTED] Organization: UND Aerospace Foundation User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en X-Posted-By: 24.197.179.243 Return-Path: [EMAIL PROTECTED] X-OriginalArrivalTime: 21 Oct 2004 01:10:29.0559 (UTC) FILETIME=[C167FC70:01C4B70A] I am trying to set a cookie with a value from a database. Here is my script: ? //Setting Cookies setcookie ('CIDcookie', $cid); setcookie ('USERcookie', $user); ? ? //Database connection require (../../db_connect.php); //Table Name $main_tbl = MAIN ? ? //Check the Password against the CID $query=SELECT * FROM $main_tbl WHERE CID='$cid'; $result=mysql_query($query) or die(mysql_error()); $check=mysql_fetch_array($result); if ($Message == NoAccess){ echo(BCENTERFONT COLOR=REDYou do not have access to that page!/FONT/CENTER/B\n); include (staff_code/admin_links.php); } if ($check[PASSWORD] != $_REQUEST[password]){ header(Location:staff_login.php?Message=Invalid); } if (($check[PASSWORD] == $_REQUEST[password]) AND ($check[USER] == A)) { include (staff_code/admin_links.php); $user = $check[USER]; } else{ include (staff_code/controller_links.php); } ? Then on the second page it is reading the cookies, but it will display the CIDcookie, but not the USERcookie. Here is the script on the second page: ? //Retrieve Cookies $cid = $_COOKIE['CIDcookie']; $user = $_COOKIE['USERcookie']; ? html head titleZMP ARTCC: Staff To Do List/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head ? echo (My CID is $cid); echo ($user); ? body text=#66 link=#66 vlink=#66 alink=#66 table width=600 tr tddiv align=centerfont size=4strongZMPs Staff TO Do List/strong/font/div/td /tr /table br table width=600 tr td colspan=3 bgcolor=#99div align=centerstrongfont size=3Completed Tasks/font/strong/div/td /tr tr bgcolor=#CC td width=100div align=centerDate Finished/div/td td width=250div align=centerTask/div/td td width=250div align=centerStatus/div/td /tr tr tddiv align=center10-13-04/div/td tddiv align=centerDLH SOP (new)/div/td tddiv align=centerAwaiting finish of other projects/div/td /tr tr tddiv align=center10-18-04/div/td tddiv align=centerZMP Policies/div/td tddiv align=centerquot;/div/td /tr /table br table width=600 tr td colspan=3 bgcolor=#99div align=centerstrongfont size=3 Tasks Awaiting VATUSA Approval/font/strong/div/td /tr tr bgcolor=#CC td width=100div align=centerDate Sent/div/td td width=250div align=centerTask/div/td td width=250div align=centerStatus/div/td /tr tr tddiv align=center10-09-04/div/td tddiv align=centerLNK SOP (new)/div/td tddiv align=centerAwaiting approval/div/td /tr tr tddiv align=center10-19-04/div/td tddiv align=centerM98 SOP/div/td tddiv align=centerAwaiting Approval/div/td /tr tr tddiv align=center10-19-04/div/td tddiv align=centerGeneral SOP/div/td tddiv align=centerAwaiting Approval/div/td /tr /table /body /html So I am assuming that somewhere in my first page that my cookie isn't actually gettting set properly. I have tried many varitites and can't find any help sections on cookies from a database. Any help would be appreciated! -- Jason Davidson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Check out Election 2004 for up-to-date election news, plus voter tools and more! http://special.msn.com/msn/election2004.armx -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Cookies ?
Friends Is there a way to read a cookie's with php , that were generated with javascript ? I am now usign : $xidp=$_COOKIE; print Xidp $xidp; Thank you for your help in advanced. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Cookies ?
Try using $_COOKIE['cookie_name'] - Original Message - From: Omelin Morelos [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, February 10, 2004 12:55 AM Subject: [PHP-DB] Cookies ? Friends Is there a way to read a cookie's with php , that were generated with javascript ? I am now usign : $xidp=$_COOKIE; print Xidp $xidp; Thank you for your help in advanced. -- 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
[PHP-DB] Cookies ?
-Mensaje original- De: Omelin Morelos [mailto:[EMAIL PROTECTED] Enviado el: Monday, February 09, 2004 4:56 PM Para: [EMAIL PROTECTED] Asunto: Cookies ? Friends Is there a way to read a cookie's with php , that were generated with javascript ? I am now usign : $xidp=$_COOKIE; print Xidp $xidp; Thank you for your help in advanced. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Cookies ?
I have already tried it , It's not working. Thanks -Mensaje original- De: Chris Wright [mailto:[EMAIL PROTECTED] Enviado el: Monday, February 09, 2004 5:09 PM Para: Omelin Morelos; [EMAIL PROTECTED] Asunto: Re: [PHP-DB] Cookies ? Try using $_COOKIE['cookie_name'] - Original Message - From: Omelin Morelos [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, February 10, 2004 12:55 AM Subject: [PHP-DB] Cookies ? Friends Is there a way to read a cookie's with php , that were generated with javascript ? I am now usign : $xidp=$_COOKIE; print Xidp $xidp; Thank you for your help in advanced. -- 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Cookies ?
Did you refresh the page after setting the cookie? mt At 05:00 PM 2/9/2004 -0800, Omelin Morelos wrote: I have already tried it , It's not working. Thanks -Mensaje original- De: Chris Wright [mailto:[EMAIL PROTECTED] Enviado el: Monday, February 09, 2004 5:09 PM Para: Omelin Morelos; [EMAIL PROTECTED] Asunto: Re: [PHP-DB] Cookies ? Try using $_COOKIE['cookie_name'] - Original Message - From: Omelin Morelos [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, February 10, 2004 12:55 AM Subject: [PHP-DB] Cookies ? Friends Is there a way to read a cookie's with php , that were generated with javascript ? I am now usign : $xidp=$_COOKIE; print Xidp $xidp; Thank you for your help in advanced. -- 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 -- 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 ?
yes , i tried accesing the cookie from an other page. thank you -Mensaje original- De: Miles Thompson [mailto:[EMAIL PROTECTED] Enviado el: Monday, February 09, 2004 5:37 PM Para: [EMAIL PROTECTED] Asunto: RE: [PHP-DB] Cookies ? Did you refresh the page after setting the cookie? mt At 05:00 PM 2/9/2004 -0800, Omelin Morelos wrote: I have already tried it , It's not working. Thanks -Mensaje original- De: Chris Wright [mailto:[EMAIL PROTECTED] Enviado el: Monday, February 09, 2004 5:09 PM Para: Omelin Morelos; [EMAIL PROTECTED] Asunto: Re: [PHP-DB] Cookies ? Try using $_COOKIE['cookie_name'] - Original Message - From: Omelin Morelos [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, February 10, 2004 12:55 AM Subject: [PHP-DB] Cookies ? Friends Is there a way to read a cookie's with php , that were generated with javascript ? I am now usign : $xidp=$_COOKIE; print Xidp $xidp; Thank you for your help in advanced. -- 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 -- 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Cookies with fopen
Hi all, Attempting to use PHP to navigate a foreign website, to collect data. This is thus only tangentially related to databases, so I apologize if some feel it's too off-topic. Is there any way to do something similar to fopen() except to also have PHP present a cookie to the foreign webserver as credentials during the HTTP GET? Anyone done something similar? -P Peter Westergaard ICQ#: 10294457 [EMAIL PROTECTED] http://www.westergaard.ca http://courtly.livejournal.com ---TECHNOLOGY--- Human history becomes more and more a race between education and catastrophe. - H.G. Wells -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] cookies
Let's assume that we have an html page where we plant a call to cookie registering php script. This is done by the following html line which is placed on that page we would like to have cookies stats for: html ... body .. img nocache border=0 width=2 height=1 src=http://www.cookiedomain.com/cookies/cookies.php .. /body /html Php cookie registering script has the following cookie set operation: setcookie(test, 1, time() + 3600, /, ); The problem is that when executing HTML above, everything works fine as long as page and php script are on the same domain But as soon as page is for example www.pagedomain.com and cookie script is still on www.cookiedomain.com No cookies are set no more. My understanding is that with line img nocache border=0 width=2 height=1 src=http://www.synchrodat.com/sdcookies/cookies.php we simply execute php script the same way as it would be typed in url line and executed, why there's a difference? Could you share with your experience and point out where is the problem here. I tried different variations for domain parameter in setcookie command but it didnt help Is this construction usable in this case with different domains at all? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] cookies
Hello Maris, Thursday, December 4, 2003, 10:40:33 AM, you wrote: MK Could you share with your experience and point out where MK is the problem here. I tried different variations for MK domain parameter in setcookie command but it didnt help It's a security mechanism built into cookies. They cannot be cross-domain. They can cross sub-domains (i.e. *.launchcode.co.uk) but a cookie set for one domain cannot be read by another. Think of the anarchy that would happen if they could (being able to read and mess with say Hotmail cookies from your own site for example). -- Best regards, Richardmailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] cookies
Right, but in my example HTML line img nocache border=0 width=2 height=1 src=http://www.cookiedomain.com/cookies/cookies.php isnt it refering and setting cookie for www.cookiedomain.com even if this HTML file is on another domain? Maris Richard Davey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello Maris, Thursday, December 4, 2003, 10:40:33 AM, you wrote: MK Could you share with your experience and point out where MK is the problem here. I tried different variations for MK domain parameter in setcookie command but it didnt help It's a security mechanism built into cookies. They cannot be cross-domain. They can cross sub-domains (i.e. *.launchcode.co.uk) but a cookie set for one domain cannot be read by another. Think of the anarchy that would happen if they could (being able to read and mess with say Hotmail cookies from your own site for example). -- Best regards, Richardmailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP-DB] cookies
Hello Maris, Thursday, December 4, 2003, 12:24:10 PM, you wrote: MK img nocache border=0 width=2 height=1 MK src=http://www.cookiedomain.com/cookies/cookies.php MK isnt it refering and setting cookie for www.cookiedomain.com MK even if this HTML file is on another domain? No, because by that point the Header has already been sent. You can't issue a cookie after a header has gone and use it in the same page session. As the PHP manual so elegantly puts it - this is a protocol restriction. Your browser will look for cookies at the start of the page request, not in the middle of it (where your image is). At that point, the header is already sent. -- Best regards, Richardmailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP-DB] cookies
thanks a lot Richard, now it's completely clear for me! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Cookies problems
on 1/21/03 10:37 PM, Sabina Alejandr Schneider at [EMAIL PROTECTED] appended the following bits to my mbox: Hello people!!! This time I have a problem with cookies. I tried to send a cookie from one page with the function sendcookie(chat,$mail) to a page in another directory, but when I tried to prine echo($chat) or echo($_COOKIE[chat]) I got notheing. So I put the second page where it was the page that sent the cookie and tried again. This last time I got the cookie in the echo($chat) but not in the echo($_COOKIE[chat]) I need to send a cookie to a page in another path and I need that the cookie stays in the client browser so I can see if I can recognize him/ her next time he/she enters the chat. Was I clear? Thank you very much for all of your help and time!!! I really appreciate your help in times I'm desesperated like this time :-) Because this question doesn't have anything to do with databases, it should be posted to PHP-General. You can sign up here: http://www.php.net/mailing-lists.php It is under general user list FYI, cookies won't be seen until the next time you view the page. If your setcookie command and echo $cookie commands are in the same file, you won't see the echo unless you reload. You may also wish to look at the documentation for the setcookie (not sendcookie) function: http://www.php.net/manual/en/function.setcookie.php HTH. Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Cookies problems
Hello people!!! This time I have a problem with cookies. I tried to send a cookie from one page with the function sendcookie(chat,$mail) to a page in another directory, but when I tried to prine echo($chat) or echo($_COOKIE[chat]) I got notheing. So I put the second page where it was the page that sent the cookie and tried again. This last time I got the cookie in the echo($chat) but not in the echo($_COOKIE[chat]) I need to send a cookie to a page in another path and I need that the cookie stays in the client browser so I can see if I can recognize him/ her next time he/she enters the chat. Was I clear? Thank you very much for all of your help and time!!! I really appreciate your help in times I'm desesperated like this time :-) _ Tutopia - Acceso a Internet rápido, fácil y a los mejores precios. http://www.tutopia.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] cookies multiple pages
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
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...
[PHP-DB] cookies and Global variables
Hello 1) I want to use cookies for my site, how can I do it? My browser warn me that headers are already sent!! 2) How can I use the same variables on all pages: for example: $login, I need this variable on all pages to send requests to a MySQL database. Thanks DIB Walid -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] cookies and Global variables
When you get the Header already sent error, that means that you are trying to send header info, e.g. cookie info AFTER you've already sent some header info. This is usually seen when your php script has an include in it (above your cookie stuff) that contains some html. Check your includes, and make sure that the header info is the first thing sent. Gary Every Sr. UNIX Administrator Ingram Entertainment (615) 287-4876 Pay It Forward mailto:[EMAIL PROTECTED] http://accessingram.com -Original Message- From: Dib, Walid (MED, Stagiaire GEMS) [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 06, 2002 2:06 AM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] cookies and Global variables Hello 1) I want to use cookies for my site, how can I do it? My browser warn me that headers are already sent!! 2) How can I use the same variables on all pages: for example: $login, I need this variable on all pages to send requests to a MySQL database. Thanks DIB Walid
RE: [PHP-DB] Cookies ???
He's not trying to set multiple cookies...only one. -Original Message- From: Mark Collin [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 18, 2001 4:01 PM To: Rick Emery; 'Jason Caldwell'; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Cookies ??? instead of setting multiple cookies, why not start using seassions its dead easy with php4 and you can then do all your security stuff with sessions, much easier, much more secure etc - Original Message - From: Rick Emery [EMAIL PROTECTED] To: 'Jason Caldwell' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, September 17, 2001 6:29 PM Subject: RE: [PHP-DB] Cookies ??? Q1. If you simply wish to READ the cookie from each web page, you need do nothing. It is created atuomatically as a variable for you. For instance, a cookie named mycookie is available as $mycookie. Q2. The Cookie Path is the reference point on the web server. I creates a context for the cookie. It allows the cookie to be read when a web page comes from that specific directory. If you want it to be available from all directories, use /. Q3. The cookie can store multiple values that you concatenate together. For instance, to store username/password: setcookie( cookiename, $user#$password, time()+3600, /, .mydomain.com ); Then, upon reading the cookie: list($user,$password) = explode( #, $cookiename ); FYI...setcookie() has worked for me on IE 5.x and NN 5.x. -Original Message- From: Jason Caldwell [mailto:[EMAIL PROTECTED]] Sent: Monday, September 17, 2001 11:35 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Cookies ??? I've been reading the threads under SETCOOKIE (from php.net) -- some people are saying that setcookie doesn't seem to work for all browsers all of the time. Then some others go into how it seems to actually be the TIME format (unix time vs. GMT time) -- Should I just stick to the HEADER version instead of setcookie? Also -- I'm not completely clear on how cookies work in the first place... Q1: When I set a cookie, is that cookie automatically called from *each* page on my website? Or, do I need to add the HEADER to each page where I want to call the cookie? Q2: The 'Cookie Path' -- is this the PATH on my websever -- someone please explain what this is exactly, and how it works. Q3: The scenario I would like to use cookies in is to have users automatically be logged in when they come to my home page... so I will need to store the Username and Password in the cookie... should I store these in an Array, or can I create multiple cookies -- in other words, a cookie can only store one value, correct? So, I can use Serialize / Unserialize to store Array information in my cookies? Thanks. Jason -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Cookies ???
instead of setting multiple cookies, why not start using seassions its dead easy with php4 and you can then do all your security stuff with sessions, much easier, much more secure etc - Original Message - From: Rick Emery [EMAIL PROTECTED] To: 'Jason Caldwell' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, September 17, 2001 6:29 PM Subject: RE: [PHP-DB] Cookies ??? Q1. If you simply wish to READ the cookie from each web page, you need do nothing. It is created atuomatically as a variable for you. For instance, a cookie named mycookie is available as $mycookie. Q2. The Cookie Path is the reference point on the web server. I creates a context for the cookie. It allows the cookie to be read when a web page comes from that specific directory. If you want it to be available from all directories, use /. Q3. The cookie can store multiple values that you concatenate together. For instance, to store username/password: setcookie( cookiename, $user#$password, time()+3600, /, .mydomain.com ); Then, upon reading the cookie: list($user,$password) = explode( #, $cookiename ); FYI...setcookie() has worked for me on IE 5.x and NN 5.x. -Original Message- From: Jason Caldwell [mailto:[EMAIL PROTECTED]] Sent: Monday, September 17, 2001 11:35 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Cookies ??? I've been reading the threads under SETCOOKIE (from php.net) -- some people are saying that setcookie doesn't seem to work for all browsers all of the time. Then some others go into how it seems to actually be the TIME format (unix time vs. GMT time) -- Should I just stick to the HEADER version instead of setcookie? Also -- I'm not completely clear on how cookies work in the first place... Q1: When I set a cookie, is that cookie automatically called from *each* page on my website? Or, do I need to add the HEADER to each page where I want to call the cookie? Q2: The 'Cookie Path' -- is this the PATH on my websever -- someone please explain what this is exactly, and how it works. Q3: The scenario I would like to use cookies in is to have users automatically be logged in when they come to my home page... so I will need to store the Username and Password in the cookie... should I store these in an Array, or can I create multiple cookies -- in other words, a cookie can only store one value, correct? So, I can use Serialize / Unserialize to store Array information in my cookies? Thanks. Jason -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Cookies ???
I've been reading the threads under SETCOOKIE (from php.net) -- some people are saying that setcookie doesn't seem to work for all browsers all of the time. Then some others go into how it seems to actually be the TIME format (unix time vs. GMT time) -- Should I just stick to the HEADER version instead of setcookie? Also -- I'm not completely clear on how cookies work in the first place... Q1: When I set a cookie, is that cookie automatically called from *each* page on my website? Or, do I need to add the HEADER to each page where I want to call the cookie? Q2: The 'Cookie Path' -- is this the PATH on my websever -- someone please explain what this is exactly, and how it works. Q3: The scenario I would like to use cookies in is to have users automatically be logged in when they come to my home page... so I will need to store the Username and Password in the cookie... should I store these in an Array, or can I create multiple cookies -- in other words, a cookie can only store one value, correct? So, I can use Serialize / Unserialize to store Array information in my cookies? Thanks. Jason -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Cookies ???
On Mon, 17 Sep 2001, Jason Caldwell wrote: I've been reading the threads under SETCOOKIE (from php.net) -- some people are saying that setcookie doesn't seem to work for all browsers all of the time. Then some others go into how it seems to actually be the TIME format (unix time vs. GMT time) -- Should I just stick to the HEADER version instead of setcookie? Take a look at the comment dates; the earliest ones date back to 1998, which IIRC was around version 3.0.12 of PHP if not earlier. Given PHPs open source nature I'd imagine any wrong-doings of setcookie() have been fixed but perhaps a PHP deveoper would be better able to comment on this. I'd try it with setcookie() first, test it out with your target browsers and only change to header() if needed. Also -- I'm not completely clear on how cookies work in the first place... Q1: When I set a cookie, is that cookie automatically called from *each* page on my website? Or, do I need to add the HEADER to each page where I want to call the cookie? Yes, the browser will shove back all cookies if they're viewable by that script. That's just how HTTP works, it shoves a request over with all supporting data, awaits the request and kills the connection(^*). Q2: The 'Cookie Path' -- is this the PATH on my websever -- someone please explain what this is exactly, and how it works. Yep, path on the webserver. If you set a cookie with domain www.yourdomain.com and path /scripts only request to www.yourdomain..com/scripts and below will see it. Q3: The scenario I would like to use cookies in is to have users automatically be logged in when they come to my home page... so I will need to store the Username and Password in the cookie... should I store these in an Array, or can I create multiple cookies -- in other words, a cookie can only store one value, correct? So, I can use Serialize / Unserialize to store Array information in my cookies? Using serialize/unserialize isn't a bad idea, but neither is setting two cookies in my opinion. I'd say take your pick, choose whatever's most comfortable for you. I'd recommend only looking at the username/password cookies if a PHP session hasn't been established though to save you from takeing a quick query to your DB for every hit on each page though. I'll skip the security mumbo-jumbo for now on passing stuff around in plaintext because I'm not sure if that's really of any concern for your project. If it is, and you're clueless as to what I'm talking about, let me know and I'll try and elaborte a bit more. [*] HTTP -used- to kill the connection after every request but now sessions can be held open to save overhead. The ramifications of this change in design have absolutely no effect on application design though because it's not guaranteed behavior. Justin Buist Trident Technology, Inc. 4700 60th St. SW, Suite 102 Grand Rapids, MI 49512 Ph. 616.554.2700 Fx. 616.554.3331 Mo. 616.291.2612 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Cookies ???
Q1. If you simply wish to READ the cookie from each web page, you need do nothing. It is created atuomatically as a variable for you. For instance, a cookie named mycookie is available as $mycookie. Q2. The Cookie Path is the reference point on the web server. I creates a context for the cookie. It allows the cookie to be read when a web page comes from that specific directory. If you want it to be available from all directories, use /. Q3. The cookie can store multiple values that you concatenate together. For instance, to store username/password: setcookie( cookiename, $user#$password, time()+3600, /, .mydomain.com ); Then, upon reading the cookie: list($user,$password) = explode( #, $cookiename ); FYI...setcookie() has worked for me on IE 5.x and NN 5.x. -Original Message- From: Jason Caldwell [mailto:[EMAIL PROTECTED]] Sent: Monday, September 17, 2001 11:35 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Cookies ??? I've been reading the threads under SETCOOKIE (from php.net) -- some people are saying that setcookie doesn't seem to work for all browsers all of the time. Then some others go into how it seems to actually be the TIME format (unix time vs. GMT time) -- Should I just stick to the HEADER version instead of setcookie? Also -- I'm not completely clear on how cookies work in the first place... Q1: When I set a cookie, is that cookie automatically called from *each* page on my website? Or, do I need to add the HEADER to each page where I want to call the cookie? Q2: The 'Cookie Path' -- is this the PATH on my websever -- someone please explain what this is exactly, and how it works. Q3: The scenario I would like to use cookies in is to have users automatically be logged in when they come to my home page... so I will need to store the Username and Password in the cookie... should I store these in an Array, or can I create multiple cookies -- in other words, a cookie can only store one value, correct? So, I can use Serialize / Unserialize to store Array information in my cookies? Thanks. Jason -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Cookies
this doesnt work :echo $HTTP_COOKIE_VARS[nameCookie] code to set cookie: setcookie(newsLogin,$value,time()+ 3348000); if i ask from the same page I get the values I need but not from a different page... You are asking the wrong variable name. If you set a cookie variable named newsLogin, you have to query it with $HTTP_COOKIE_VARS[newLogin], or, if you enabled track_vars, you can simply do it by $newsLogin. PHP gives you all cookie, post and get variables as global variables in your scripts. Kristian -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Cookies
How can I request a persistant cookie from the clients computer (to make a autologin) this doesnt work :echo $HTTP_COOKIE_VARS[nameCookie] code to set cookie: setcookie(newsLogin,$value,time()+ 3348000); if i ask from the same page I get the values I need but not from a different page... thx
[PHP-DB] Cookies
Hi !! I'm trying to but down 2 variables ($iCount and $sPhone) into a cookie and I used the code example from the php manual from php.net put I only get the error messages (down below) And how do i get back the var in to the page or is there another beter way to save the variables when reloading the page ___ setcookie (cookie[two], $iCount); setcookie (cookie[one], $sPhone); if (isset ($cookie)) { while (list ($name, $value) = each ($cookie)) { echo $name == $valuebr\n; } } __ Warning: Cannot add header information - headers already sent by (output started at c:\program files\apache group\apache\htdocs\masscot\delete.php:5) in c:\program files\apache group\apache\htdocs\masscot\delete.php on line 51 Warning: Cannot add header information - headers already sent by (output started at c:\program files\apache group\apache\htdocs\masscot\delete.php:5) in c:\program files\apache group\apache\htdocs\masscot\delete.php on line 52 Thanks / Tobbe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Cookies
I believe that the cookie part needs to be sent to the browser before the html. You can put the set cookies any where in the php portion as long as the first thing you send is the cookie stuff setcookie.. html header info... html not html header info. setcookie html.. Hopes this helps John On Wed, 25 Apr 2001, Tobbe wrote: Hi !! I'm trying to but down 2 variables ($iCount and $sPhone) into a cookie and I used the code example from the php manual from php.net put I only get the error messages (down below) And how do i get back the var in to the page or is there another beter way to save the variables when reloading the page ___ setcookie (cookie[two], $iCount); setcookie (cookie[one], $sPhone); if (isset ($cookie)) { while (list ($name, $value) = each ($cookie)) { echo $name == $valuebr\n; } } __ Warning: Cannot add header information - headers already sent by (output started at c:\program files\apache group\apache\htdocs\masscot\delete.php:5) in c:\program files\apache group\apache\htdocs\masscot\delete.php on line 51 Warning: Cannot add header information - headers already sent by (output started at c:\program files\apache group\apache\htdocs\masscot\delete.php:5) in c:\program files\apache group\apache\htdocs\masscot\delete.php on line 52 Thanks / Tobbe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Cookies
Tobbe, The cookie information has to the first thing sent to the browser, ahead of everything else. You sometimes get trapped by having a single empty line at the top of your file. The page has to be reloaded for content of cookies to be read by the browser. Netscape has a short article on cookies; you can probably find it by searching for Netscape cookies using google. Miles At 10:59 AM 4/25/01 +0200, Tobbe wrote: Hi !! I'm trying to but down 2 variables ($iCount and $sPhone) into a cookie and I used the code example from the php manual from php.net put I only get the error messages (down below) And how do i get back the var in to the page or is there another beter way to save the variables when reloading the page ___ setcookie (cookie[two], $iCount); setcookie (cookie[one], $sPhone); if (isset ($cookie)) { while (list ($name, $value) = each ($cookie)) { echo $name == $valuebr\n; } } __ Warning: Cannot add header information - headers already sent by (output started at c:\program files\apache group\apache\htdocs\masscot\delete.php:5) in c:\program files\apache group\apache\htdocs\masscot\delete.php on line 51 Warning: Cannot add header information - headers already sent by (output started at c:\program files\apache group\apache\htdocs\masscot\delete.php:5) in c:\program files\apache group\apache\htdocs\masscot\delete.php on line 52 Thanks / Tobbe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Cookies Stuff
Hi everybody, I am trying to use cookies in my website and want to ask you these questions: 1. Header("Set-Cookie") or SetCookie() is better? as the setcookie manual comments said that Header("Set-Cookie") is better. 2. Domain=myserver.com OR domain=.myserver.com OR skip the domain argument is better? (to make the cookie available whether visitors are coming to my site with http://www.myserver.com or http://myserver.com ) 3. What SetCookie statement must I use to make the cookie available in the entire website? Is it Header(SetCookie: cookiename=cookievalue; expires=Friday, 16-Jan-2037 00:00:00 GMT; path=/; domain=.myserver.com); ? Thank you! Lisa Elita -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] cookies, email and passwords
Sorry for putting three topics in one but they all go together so I thought I would. I am setting up a user login/members area! * Firstly how do I generate a random password? * Then how do I email it to the user? * And now I need to know how to set a cookie with their username and password so that when they log in they don't have to keep entering their username and password for the hour that the cookie is active? * How do I also call the cookie into each page? If anyone can help with any of these I would be really grateful! _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] cookies, email and passwords
Sorry for putting three topics in one but they all go together so I thought I would. I am setting up a user login/members area! * Firstly how do I generate a random password? * Then how do I email it to the user? * And now I need to know how to set a cookie with their username and password so that when they log in they don't have to keep entering their username and password for the hour that the cookie is active? * How do I also call the cookie into each page? If anyone can help with any of these I would be really grateful! Hi have a look at phplib http://phplib.netuse.de It may be a bit more than you need but it's good M@ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] cookies, email and passwords
Thanks! Is there anyone who can actually give me little bits of code that I need cause I am in a rush with this _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Cookies on a Macintosh
No luck with that I'm afraid. The Mac IE still refuses to use the cookie. Cookies are on, it will use cookies on other sites, just not on the one I've created using PHP. I've tried making other cookies to test it, but still no go. There's no bugs in PHP3 with respect to making cookies are there? I just don't understand why it will work in netscape on the mac, but not any versions of IE... Any other ideas? Thanks very much, Best Regards, Bob Irwin Domain Server Admin Planet Netcom -Original Message- From: Andrew Rush [mailto:[EMAIL PROTECTED]] Sent: Saturday, 20 January 2001 2:07 AM To: Noodles Grizzly Subject: Re: [PHP-DB] Cookies on a Macintosh On Thursday, January 18, 2001, at 06:39 PM, Noodles Grizzly wrote: setcookie("randint", "$ran3", time()+9000); snip It sets the cookie, but refuses to use the variable contained within. I can't find any reference to it in the books I have, nor in the online manual. you aren't setting a domain in your setcookie(). setcookie("randint", "$ran3", time()+9000, "/", "www.mydomain.com"); have a great day, andy :: Andrew Rush :: Lead Systems Developer :: MaineToday.com :: ** "Crippled but free, blind all the time, i was learning to see" - J. Garcia / R. Hunter ** The views expressed herein are not necessarily those of my employer, but they let me have them anyway. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Cookies on a Macintosh
In article [EMAIL PROTECTED], [EMAIL PROTECTED] ("Noodles Grizzly") wrote: I'm using the setcookie function with the follwing. setcookie("randint", "$ran3", time()+9000); It sets the cookie, but refuses to use the variable contained within. I can't find any reference to it in the books I have, nor in the online manual. Anyone know why this might be happening? What does "$ran3" contain, and why is it enclosed in quotes? (It shouldn't matter, but I'm interested.) Also, how do you know it sets the cookie if it refuses to use the variable? How does it refuse to use the variable in a manner that lets you know it set the cookie? Jerry -- http://www.hoboes.com/jerry/ "Give a man a fish and you feed him for a day. Teach him to fish, and you've depleted the lake."--It Isn't Murder If They're Yankees (http://www.hoboes.com/jerry/Murder/) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]