[PHP] Re: Setting Cookies in netscape and explorer?
Martin Johansson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi! Cookies makes me go AGHH!! Please help me with this: I am setting a cookie like this in my loginscript: setcookie(devProcCookie, cookie value.|.time(), 31536000); // Set cookie header(Location: inside.php); exit; So far it works! But when I go to the inside.php page that looks like this: $cookie_life = 30; // The cookie lives for 1 hour $tok = explode(|, $HTTP_COOKIE_VARS[devProcCookie]); $cookie_value = $tok[0]; $creation_time = $tok[1]; if((time()-$creation_time) $cookie_life) // If time expires go to cookie_expired.php { // cookie has expired so delete it. setcookie(devProcCookie, ); header (Location: cookie_expired.php); exit; } setcookie(devProcCookie, cookie value.|.time(), 31536000); // If time hasnt expired update the cookie time Something happens in netscape. Everything works fine in IExplorer. Netscape says: Notice: Undefined index: devProcCookie in c:\inetpub\wwwroot\devproc\beta\inside.php on line 2 Notice: Undefined offset: 1 in c:\inetpub\wwwroot\devproc\beta\inside.php on line 4 Warning: Cannot add header information - headers already sent by (output started at c:\inetpub\wwwroot\devproc\beta\inside.php:4) in c:\inetpub\wwwroot\devproc\beta\inside.php on line 9 Warning: Cannot add header information - headers already sent by (output started at c:\inetpub\wwwroot\devproc\beta\inside.php:4) in c:\inetpub\wwwroot\devproc\beta\inside.php on line 10 What is wrong! Please help me someone!!! /Martin --- Ditt utgående mail är virusfritt. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.371 / Virus Database: 206 - Release Date: 2002-06-13 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Setting Cookies in netscape and explorer?
As opposed to using the Cookies Array HTTP_COOKIES_VAR could you not just use explode the $devProcCookie using if (isset($devProcCookie)){ $tok = explode(|, $devProcCookie); } //Note this will only work if the global variables in your php.ini files are turned on... I have no idea why it can't read the index $devProcCookie in the Cookies Array if you figure it out though please post up... Kondwani Martin Johansson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi! Cookies makes me go AGHH!! Please help me with this: I am setting a cookie like this in my loginscript: setcookie(devProcCookie, cookie value.|.time(), 31536000); // Set cookie header(Location: inside.php); exit; So far it works! But when I go to the inside.php page that looks like this: $cookie_life = 30; // The cookie lives for 1 hour $tok = explode(|, $HTTP_COOKIE_VARS[devProcCookie]); $cookie_value = $tok[0]; $creation_time = $tok[1]; if((time()-$creation_time) $cookie_life) // If time expires go to cookie_expired.php { // cookie has expired so delete it. setcookie(devProcCookie, ); header (Location: cookie_expired.php); exit; } setcookie(devProcCookie, cookie value.|.time(), 31536000); // If time hasnt expired update the cookie time Something happens in netscape. Everything works fine in IExplorer. Netscape says: Notice: Undefined index: devProcCookie in c:\inetpub\wwwroot\devproc\beta\inside.php on line 2 Notice: Undefined offset: 1 in c:\inetpub\wwwroot\devproc\beta\inside.php on line 4 Warning: Cannot add header information - headers already sent by (output started at c:\inetpub\wwwroot\devproc\beta\inside.php:4) in c:\inetpub\wwwroot\devproc\beta\inside.php on line 9 Warning: Cannot add header information - headers already sent by (output started at c:\inetpub\wwwroot\devproc\beta\inside.php:4) in c:\inetpub\wwwroot\devproc\beta\inside.php on line 10 What is wrong! Please help me someone!!! /Martin --- Ditt utgående mail är virusfritt. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.371 / Virus Database: 206 - Release Date: 2002-06-13 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Setting Cookies in netscape and explorer?
I tried your stuff but it didnt help me! Still works in explorer but when I tried it in netscape It says ERROR!!! in netscape if (isset($devProcTailorCookie)) { $tok = explode(|, $devProcTailorCookie); } else { echo ERRROR!!!; } I have global_variables turned on in my php.ini /Martin Kondwani Spike Mkandawire [EMAIL PROTECTED] skrev i meddelandet [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... As opposed to using the Cookies Array HTTP_COOKIES_VAR could you not just use explode the $devProcCookie using if (isset($devProcCookie)){ $tok = explode(|, $devProcCookie); } //Note this will only work if the global variables in your php.ini files are turned on... I have no idea why it can't read the index $devProcCookie in the Cookies Array if you figure it out though please post up... Kondwani Martin Johansson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi! Cookies makes me go AGHH!! Please help me with this: I am setting a cookie like this in my loginscript: setcookie(devProcCookie, cookie value.|.time(), 31536000); // Set cookie header(Location: inside.php); exit; So far it works! But when I go to the inside.php page that looks like this: $cookie_life = 30; // The cookie lives for 1 hour $tok = explode(|, $HTTP_COOKIE_VARS[devProcCookie]); $cookie_value = $tok[0]; $creation_time = $tok[1]; if((time()-$creation_time) $cookie_life) // If time expires go to cookie_expired.php { // cookie has expired so delete it. setcookie(devProcCookie, ); header (Location: cookie_expired.php); exit; } setcookie(devProcCookie, cookie value.|.time(), 31536000); // If time hasnt expired update the cookie time Something happens in netscape. Everything works fine in IExplorer. Netscape says: Notice: Undefined index: devProcCookie in c:\inetpub\wwwroot\devproc\beta\inside.php on line 2 Notice: Undefined offset: 1 in c:\inetpub\wwwroot\devproc\beta\inside.php on line 4 Warning: Cannot add header information - headers already sent by (output started at c:\inetpub\wwwroot\devproc\beta\inside.php:4) in c:\inetpub\wwwroot\devproc\beta\inside.php on line 9 Warning: Cannot add header information - headers already sent by (output started at c:\inetpub\wwwroot\devproc\beta\inside.php:4) in c:\inetpub\wwwroot\devproc\beta\inside.php on line 10 What is wrong! Please help me someone!!! /Martin --- Ditt utgående mail är virusfritt. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.371 / Virus Database: 206 - Release Date: 2002-06-13 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Setting Cookies in netscape and explorer?
Another thing! when I look in netscape/preferences/privacysecurity/cookies/view Stored Cookies.. there is no cookie for my website.. isnt that strange? /Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Setting Cookies in netscape and explorer?
Yes!!! I got it to work! The problem was the expirationdate in the cookie: setcookie(devProcTailorCookie, cookie value.|.time(), 31536000); Now I set it like this: setcookie(devProcTailorCookie, cookie value.|.time(), time()+10); But now it doesnt work in explorer. But I would be able to fix that. Thanks /Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php