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:
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