RE: [PHP] Cookies
what is an infinite cookie? do you mean one that lasts after the browser is closed and can be re-examined at a later date? Already there... -Original Message- From: Steffan Harris [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 1:57 PM To: [EMAIL PROTECTED] Subject: [PHP] Cookies hi, is there a way of setting an infinite cookie using PHP? Is there a special command for it? If not, I suggest adding that function in to PHP. Thanks, Steffan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Cookies
First: cookies are a function of the HTTP protocol and each browser's implementation thereof. This is not a PHP issue. Second: I would recommend simply setting cookie to 10 years in the future. It is inconceivable that the application and/or data would not have changed in that time. To believe otherwise would allow many of us an opportunity for off-list humor at the believer's expense. -Original Message- From: Steffan Harris [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 2:13 PM To: Rick Emery Subject: RE: [PHP] Cookies sorry, I was in a rush when I wrote that. I mean a cookie that will never expire, and will always remain there, and be called back at any later date, even if it is the year 3456 :) >what is an infinite cookie? do you mean one that lasts after the browser is >closed and can be re-examined at a later date? > >Already there... > >-Original Message- >From: Steffan Harris [mailto:[EMAIL PROTECTED]] >Sent: Tuesday, April 02, 2002 1:57 PM >To: [EMAIL PROTECTED] >Subject: [PHP] Cookies > > >hi, is there a way of setting an infinite cookie using PHP? Is there a >special command for it? If not, I suggest adding that function in to PHP. >Thanks, > >Steffan > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Cookies
There is no such thing as an "infinite cookie". About the closest thing to infinity in PHP is year 2038. setcookie("test", "val", 2147483647); -Original Message- From: Steffan Harris [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 11:57 AM To: [EMAIL PROTECTED] Subject: [PHP] Cookies hi, is there a way of setting an infinite cookie using PHP? Is there a special command for it? If not, I suggest adding that function in to PHP. Thanks, Steffan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookies
On Saturday 11 May 2002 19:20, Nookie wrote: > Hi. > > Is there any way to check is it cookies enabled browser? Set a cookie then try to read it, if it fails then cookies are disabled. This needs to be done using 2 pages, one to set, the 2nd to read. Or you can use the same page, first time to set, then refresh to read. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* "Nuclear war would really set back cable." -- Ted Turner */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Cookies
Set a cookie, redirect to same page, and see if cookie is sent to you. ---John Holmes... > -Original Message- > From: Nookie [mailto:[EMAIL PROTECTED]] > Sent: Saturday, May 11, 2002 4:21 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Cookies > > Hi. > > Is there any way to check is it cookies enabled browser? > > Regards, > Szymon Kosok > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cookies
This is sometimes a confusing issue for people, but remember that cookies work like this: 1) client requests a resource from a Web server 2) Web server returns a response to the client including a request to set cookies ("Set-Cookie" header) 3) client requests another page from the Web server and includes the cookies ("Cookie" header) in the request Some people want to know how they can tell whether the client accepts cookies after step 1 (during the processing that results in step 2). This is simply impossible. However, you can adequately tell whether someone has cookies enabled after you receive a second HTTP request from that person. On this "second" page, simply test to see whether the cookie that you previously set exists (isset is a good function for this). If it doesn't exist, the client does not accept cookies. Some developers want this "check" to appear as if it were performed on a single transaction and force the client to make the second request. Chris Paul O'Neil wrote: >If a browser has cookies blocked , anyone have code if unable to set cookie >then goto another page. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] cookies
isset worked for me thanks. -Original Message- From: Chris Shiflett [mailto:[EMAIL PROTECTED]] Sent: Saturday, June 22, 2002 4:37 PM To: Paul O'Neil Cc: [EMAIL PROTECTED] Subject: Re: [PHP] cookies This is sometimes a confusing issue for people, but remember that cookies work like this: 1) client requests a resource from a Web server 2) Web server returns a response to the client including a request to set cookies ("Set-Cookie" header) 3) client requests another page from the Web server and includes the cookies ("Cookie" header) in the request Some people want to know how they can tell whether the client accepts cookies after step 1 (during the processing that results in step 2). This is simply impossible. However, you can adequately tell whether someone has cookies enabled after you receive a second HTTP request from that person. On this "second" page, simply test to see whether the cookie that you previously set exists (isset is a good function for this). If it doesn't exist, the client does not accept cookies. Some developers want this "check" to appear as if it were performed on a single transaction and force the client to make the second request. Chris Paul O'Neil wrote: >If a browser has cookies blocked , anyone have code if unable to set cookie >then goto another page. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookies
ðÒÉ×ÅÔ! Varsha Agarwal wrote: > Hi, > Can anyone tell me what a cookie is in simple language > with an example?? > -Varsha A web connection is made by two machines: 1) the server, where the site is 2) the client, that is, the machine at which sits the user Once the client sends a request for a web page (an URL, in tech language) some sort of program gets executed on the server. At the very least a program called "Web Server" will receive the request, look for a file that has that name and send it back to the client. But usually the file does not end in .html, so something more gets executed, like PHP. Well, this new thing being executed may need to write data somewhere, and it usually does write it in a database (that is, a set of tables). When it does so, it writes data on the server, that is, the very same machine it is running on. But for some reasons it is sometimes useful to write data on the remote machine, that is, the client. This process of writing data on the client machine is called "sending a cookie". The client machine may actually accept or refuse doing so, the server cannot know that, so no important data should ever be written in a cookie, as it may not get written. Now suppose I (the program coder) need to now that you like to receive pages with lots of flowers and hate to receive pages with lots of machine code diagrams. I put a menu on my page and let you choose, right? Only it would be nice, if the next time you come to visit the site you were immediately presented the pages you like. But, unfortunately, I have no way to stock this information on the server, because I cannot associate it with you in anyway (thank god, otherwise bye bye privacy). So what I do is writing on a cookie that you like flower pages and hate machine code diagrams. Next time the client machine (your comp) will connect to my site it will first look in its cookies list. It will find that there is a cookie for this particular site and send it to the server along with the request. Bingo! now I know you hate machine code diagrams. I oversimplified, of course, cookies have much more than just this. Thay have expiration dates, limits on directory tree validity and so on, but that's the root of it. ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ× @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@ LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? lOrD i'M sHiNiNg... YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE tHe TeSt, YeS iT iS ThE tEsT, yEs It Is tHe TeSt, YeS iT iS ThE tEsT, yEs It Is... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cookies
Set the cookies expiration to a date that has already passed. The cookie will only last until the browser is closed, since the browser must have just created it. Then it's deleted from the computer since it's past due. Martin >>> "Alexander Ross" <[EMAIL PROTECTED]> 07/10/02 09:43AM >>> How can I set a cookie which expires when the borwser is closed?? How can I delete a cookie via PHP? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cookies
To set a session cookie (one that is deleted when the browser window is closed) set a cookie without any expire date/time. To delete a cookie set a cookie of the same name with an expire date in the past. HTH Danny. - Original Message - From: "Alexander Ross" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, July 10, 2002 2:43 PM Subject: [PHP] cookies > How can I set a cookie which expires when the borwser is closed?? How can I > delete a cookie via PHP? > > Thanks > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cookies
Hi Urb Can you not just set the cookie again [using the updated expiry date]. If I remember correctly, this should work.. -- Shane On Tuesday 27 Nov 2001 5:45 pm, Urb LeJeune wrote: > Speaking of cookies, is there a way using session control > to modify the expiration date of a cookie? I would like to add > a check box in a login dialog that says "remember me" > > Thanks > > Urb -- PHP General 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] cookies
On 27 November 2001 12:45, Urb LeJeune wrote: > Speaking of cookies, is there a way using session control > to modify the expiration date of a cookie? I would like to add > a check box in a login dialog that says "remember me" The checkbox is a form field, and thusly passes it's value to the page that loads when you submit the form. So in the page that sets the cookie: if ($checkbox == 1 ) { setcookie (whatever); } else { setcookie (whateverelse); } -- Casey Allen Shobe [EMAIL PROTECTED] GCS/CM d+ s+:->+: a-- C++() ULU$ P- L+++> E- W++ N++ !o K- w-- !O M V- PS++ PE Y+ PGP>++ t+ 5+ X R>+ tv-- b++ DI+ D G++ e h-(*) r--- z-- -- PHP General 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] cookies
Thanks Shane, >Can you not just set the cookie again [using the updated expiry date]. Problem is that session_register() automatically sets a cookie which is set to expire when the browser is closed. Now that I think about it, the default cookie expiration is set in the php.ini file and I suspect could be changed with a: ini_alter("session.cookie_lifetime","seconds to expire"); Urb -- PHP General 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] Cookies
Hi I also faced the problem once. the cookie not being read by either of the browsers The cause of the problem was traced back to a wrong setting of the date on the client machine as compared with the server. you cancheck thjis up to confirm. Another reason can be the path in the cookie but i believe you have already tried it up. Hope that helps regards Ankur Verma - Original Message - From: "Matt" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, February 09, 2001 3:32 PM Subject: [PHP] Cookies > I am having major problems with cookies, it's been stressing me out for > over 9 hours. > > I have a script that can set cookies, and it does that, just fine. > > What it doesn't do is READ the cookies off the hard drive when the page is > reloaded. > I have tried everything, messing with the domains, expiration time, setting > it to the root, > using the php setcookie function as well as doing it through http headers. > In each case the > script WILL set the cookie on the computer, but it absolutely REFUSES to > read it back up, > even when called in the same exact scope. > > Yes, I've checked the spelling too, and the page is rather complex, with > various nested includes and so forth. > PHP version is 4.0 > I use both IE 5.5 and Netscape 6, it does the same thing in both of them. > > Any help or suggestions would be greatly appreciated, this has been bugging > the hell out of me. > > Thanks. > --Matt > > > > -- > PHP General 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 General 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] Cookies
lets see some code.. > -Original Message- > From: Matthew Bean [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 09, 2001 5:01 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Cookies > > > I am having major problems with cookies, it's been stressing me out for > over 9 hours. > > I have a script that can set cookies, and it does that, just fine. > > What it doesn't do is READ the cookies off the hard drive when > the page is > reloaded. > I have tried everything, messing with the domains, expiration > time, setting > it to the root, > using the php setcookie function as well as doing it through http > headers. > In each case the > script WILL set the cookie on the computer, but it absolutely REFUSES to > read it back up, > even when called in the same exact scope. > > Yes, I've checked the spelling too, and the page is rather complex, with > various nested includes and so forth. > PHP version is 4.0 > I use both IE 5.5 and Netscape 6, it does the same thing in both of them. > > Any help or suggestions would be greatly appreciated, this has > been bugging > the hell out of me. > > Thanks. > --Matt > > > > -- > PHP General 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 General 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] Cookies
when the cookie is not set, the $HTTP_COOKIE_VARS will not have an index 'getdwgnum' maybe you should try it this way "") { $str = "where Cook = $cookieinfo"; $cx=odbc_pconnect("doc","",""); } else setcookie ("getdwgnum", $cook,time()+28800); ?> this code is not checked by executing. but I guess this should be the reason. hope that helps best regards Ankur Verma HCL Technologies A1CD, Sec -16 Noida, UP India. "Gary" <[EMAIL PROTECTED]> wrote in message 96bo38$1j7$[EMAIL PROTECTED]">news:96bo38$1j7$[EMAIL PROTECTED]... > I am getting the following error message from the code below. > > Warning: Undefined index: getdwgnum in d:\apache\htdocs/getdwgnum.php on > line 4 > > > > $cook = mt_rand (5, 5) ; > $cookieinfo = $HTTP_COOKIE_VARS["getdwgnum"]; > if ($cookieinfo > "") > { > $str = "where Cook = $cookieinfo"; > $cx=odbc_pconnect("doc","",""); > } > else > setcookie ("getdwgnum", $cook,time()+28800); > > ?> > > > I want to look for a cookie and if it is not there I want to set one. Any > ideas? > > Thanks, Gary > > > > -- > PHP General 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 General 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] Cookies
Using PHP4 I think u should store your vars on session and pass the session_id() for all your web pages ... take a look at the sess-cap on the php man I hope this help max --- Please Help Puppies --- x On Thu, 15 Feb 2001, kaab kaoutar wrote: > Hi! > I'm about to use cookies in my application, and i'm intersted in using > baskets, i mean while the user surfing in my web site, he can select items > and it will be added to the basket etc (like the classical shopping) ! > can u point me to a url with details information about cookies(i've read the > one of the manual) and php samples about cookies and baskets stuff ... > what about if cookies are disactivated in a user browser ? > > Thanks a lot ! > > > _ > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. > > > -- > PHP General 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 General 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] Cookies
instead of using cookies to store the informatioon about the stuff selected by the user while browsing your site, I would suggest that you use sessions to manage the user basket. Go through the information available at http://www.devshed.com/Server_Side/PHP/ and http://www.phpbuilder.com/columns/mattias2312.php3 for information on implementing sessions and shopping carts in PHP hope that helps best regards Ankur Verma HCL Technologies A1CD, Sec -16 Noida, UP India - Original Message - From: "kaab kaoutar" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 15, 2001 3:15 PM Subject: [PHP] Cookies > Hi! > I'm about to use cookies in my application, and i'm intersted in using > baskets, i mean while the user surfing in my web site, he can select items > and it will be added to the basket etc (like the classical shopping) ! > can u point me to a url with details information about cookies(i've read the > one of the manual) and php samples about cookies and baskets stuff ... > what about if cookies are disactivated in a user browser ? > > Thanks a lot ! > > > _ > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. > > > -- > PHP General 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 General 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] Cookies
Ok ! So it has nothing to do with cookies ?! and i should focus on session part ? in the manual there is only one chapter called Session handling functions ! Thanks a lot ! >From: "Netbrain di M.L." <[EMAIL PROTECTED]> >To: kaab kaoutar <[EMAIL PROTECTED]> >CC: [EMAIL PROTECTED] >Subject: Re: [PHP] Cookies >Date: Thu, 15 Feb 2001 03:53:09 -0600 (CST) > > >Using PHP4 I think u should store your vars on session and pass the >session_id() for all your web pages ... > >take a look at the sess-cap on the php man > >I hope this help >max >--- >Please Help Puppies >--- >x > >On Thu, 15 Feb 2001, kaab kaoutar wrote: > > > Hi! > > I'm about to use cookies in my application, and i'm intersted in using > > baskets, i mean while the user surfing in my web site, he can select >items > > and it will be added to the basket etc (like the classical shopping) ! > > can u point me to a url with details information about cookies(i've read >the > > one of the manual) and php samples about cookies and baskets stuff ... > > what about if cookies are disactivated in a user browser ? > > > > Thanks a lot ! > > > > > > >_ > > Get Your Private, Free E-mail from MSN Hotmail at >http://www.hotmail.com. > > > > > > -- > > PHP General 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 General 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] > _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. -- PHP General 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] Cookies
On Thu, 15 Feb 2001, kaab kaoutar wrote: > So it has nothing to do with cookies ?! No, I did not say this ... I think u need to associate a unique_id for each client/customer and store the basket's vars on it ... u know that the session_id is passed on all your pages: - via cookies - via get/post method if cookies failed (cookies that store the session_id) 'cause the client browser doesn't accept them, you always have the session_id() passed on the query string or post data ... Anyway I suggest u to read a very interesting column about this topic that u can find at phpbuilder.com (".. A simple shopping cart using session ..") ... > and i should focus on session part ? > in the manual there is only one chapter called Session handling functions ! max -- PHP General 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] Cookies
http://php.net/setcookie Not sure why you want to put them in a cookie, though. The browser is going to keep representing the $HTTP_AUTH_USER and password variables as long as they don't quit their browser... - Original Message - From: "David Smith" <[EMAIL PROTECTED]> Newsgroups: php.general Sent: Thursday, January 11, 2001 3:14 AM Subject: [PHP] Cookies > > > How cn I make the following code set a cookie for vars username and > password?? > > > $auth = false; // Assume user is not authenticated > > if (isset( $PHP_AUTH_USER ) && isset($PHP_AUTH_PW)) > > > // Connect to MySQL > > mysql_connect( 'localhost', 'root', '*' ) > or die ( 'Unable to connect to server.' ); > > // Select database on MySQL server > > mysql_select_db( 'cfsforums' ) > or die ( 'Unable to select database.' ); > > // Formulate the query > > $sql = "SELECT * FROM user WHERE > username = '$PHP_AUTH_USER' AND > password = '$PHP_AUTH_PW'"; > > // Execute the query and put results in $result > > $result = mysql_query( $sql ) > or die ( 'Unable to execute query.' ); > > // Get number of rows in $result. > > $num = mysql_numrows( $result ); > > if ( $num != 0 ) > > > // A matching row was found - the user is authenticated. > > $auth = true; > > } > > } > > if ( ! $auth ) > > > header( 'WWW-Authenticate: Basic realm="Combat Flight Center Members > Area"' ); > header( 'HTTP/1.0 401 Unauthorized' ); > echo 'Authorization Required.'; > exit; > > } else > > > echo ''; > } > > ?> > > WreckRman2 > Combat Flight Center > http://www.combatfs.com > > > -- > PHP General 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 General 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] Cookies...
> Currently my cookie expires in 1 hour, How can I make it expire in 1 day? > > setcookie("MemberLogin",$value,time()+3600); /* expire in 1 hour */ > setcookie("MemberLogin",$value,time()+3600,"/",".combatfs.com",1); 24*3600 -Rasmus -- PHP General 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] Cookies...
time()+86400? - Original Message - From: "WreckRman2" <[EMAIL PROTECTED]> To: "'Php-General@Lists. Php. Net'" <[EMAIL PROTECTED]> Sent: Saturday, January 20, 2001 4:56 PM Subject: [PHP] Cookies... > > Currently my cookie expires in 1 hour, How can I make it expire in 1 day? > > setcookie("MemberLogin",$value,time()+3600); /* expire in 1 hour */ > setcookie("MemberLogin",$value,time()+3600,"/",".combatfs.com",1); > > WreckRman2 > Combat Flight Center > http://www.combatfs.com > > -- > PHP General 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 General 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] Cookies
Ola, utiliza um numero mui grande! :) ;) Nuno Francesc Lladó wrote: > > > Utilizo este código para depositar una cookie en el cliente, lo único > que me caduca al cabo de un tiempo, ¿alguién sabe qué es lo que tengo > que poner para que la cookie no caduque nunca? > > Gracias > > -- > Francesc Lladó i Dardet > [EMAIL PROTECTED] > > Interkonet Publishers s.l. > Atenes 22 > 08006 Barcelona > Tel. 932 530 866 > Fax. 932 530 866 > http://www.interkonet.com > [EMAIL PROTECTED] -- PHP General 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] cookies
you may find that your expiry of four hours may be less then the time difference between your server and your client. are the tims on the two boxes set different ? on another note, I wouldnt bother with cookies, sessions are easier and simpler. you can use sessions in php3 with phplib. on yet another note (yat) is why do you use php3? Ive seen a few people still using php3 vs php4. I coulndt see any reasn for staying. just alot of reasons to switch. -- Chris Lee [EMAIL PROTECTED] "Louis Brooks" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Okay, I have tried every example in the PHP Essentials book and on the php.net site that I can find on setting cookies using php3. Is there a problem with Netscape 4.x and setting cookies or is there something I have missed in setting up setcookie()? Here is the code I am using: I do not get any errors, it just does not set a cookie. Any help would be greatly appreciated. Thanks, Louis -- PHP General 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] Cookies
Hi, You should look into output buffering: http://www.php.net/manual/en/ref.outcontrol.php There's a few tutorials listed in the user contributed notes at the end too. Simon At 10:10 14/05/01 +0100, Sascha Andres wrote: >hi, >i want to set cookies. >cookies can only be set before >and tags. i think this is >because php sends all output immediatly. >is there a statement that stops sending >immediatly and a statement that tells >to send now (at the end of the doc)? > >ciao sascha -- PHP General 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] cookies
Hi Jon, Dealing with expiry dates and cookies is often a PITA! Rasmus suggested a way around this a few weeks ago - here is a rehash of what he said: Do this: setcookie ('expiry', time ()); This call will have created a session cookie - this means that the session will expire when the browser closes the client. Now you have a cookie var called expiry that has the unix timestamp of when the user first accessed the site. Check this value when deciding to expire the user's session. ie. $timeout = 3600;// Set an expiry date of an hour if ($expiry + $timeout > time ()) { // handle that the cookie has expired } (Actually, you easily do this with sessions too.) HTH, --zak Jon Yaggie wrote: [...] > I have set up a user login so that it will assign a cookie for one > hour - setcookie("cookie_id", $id, time()+3600); > The manner in which i suse the expiration is copied form the manual but > i have actually tried several alteratives. The problem is the > expiration works perfectly locally (i am running apache 1.3 for windows) > but once i upload it (linux red hat 5.2 (why so old i dont know)/ apache > 1.3.19.) The expiration will not work on my browser(s) unless i > increase the expiration to +5000 or above. My client tests it using the > same version of IE i have and it will not set the cookie still at +5000 > for him. > Now i understand from browser to browser there can be differences but > why can i set a cookie for +200 locally but not for less than +5000 > uploaded when i am most certainly checking it with the same browser (IE > 5.5) -- PHP General 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] cookies
Hi Pat, @ 6:13:20 PM on 4/16/2001, Pat Hanna wrote: > I'm setting cookies for a shopping cart and they are setting fine > but they will not delete. I've tried every way of deleting them and > they just won't go away. Someone please help. http://www.php.net/manual/en/function.setcookie.php Read Example 2. -Brian -- PGP is spoken here: 0xE4D0C7C8 Please, DO NOT carbon copy me on list replies. -- PHP General 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] cookies
I've tried that but they still don't go away. - Original Message - From: "Brian Clark" <[EMAIL PROTECTED]> To: "PHP is not a drug." <[EMAIL PROTECTED]> Sent: Monday, April 16, 2001 6:23 PM Subject: Re: [PHP] cookies > Hi Pat, > > @ 6:13:20 PM on 4/16/2001, Pat Hanna wrote: > > > I'm setting cookies for a shopping cart and they are setting fine > > but they will not delete. I've tried every way of deleting them and > > they just won't go away. Someone please help. > > http://www.php.net/manual/en/function.setcookie.php > > Read Example 2. > > -Brian > -- > PGP is spoken here: 0xE4D0C7C8 > Please, DO NOT carbon copy me on list replies. > > > > -- > PHP General 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 General 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] cookies
Hi Pat, @ 6:21:59 PM on 4/16/2001, Pat Hanna wrote: > I've tried that but they still don't go away. Look for the cookie on your disk and remove it manually then. Look in (making assumptions again that you're using Windows and IE) c:\windows\cookies In Netscape it's a single file, I believe, called cookies.txt in a sub-directory of Netscape's installation directory. In Opera, I have no idea. -Brian -- PGP is spoken here: 0xE4D0C7C8 Please, DO NOT carbon copy me on list replies. -- PHP General 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] cookies
Are you using IE 5.01 by chance? I was having very strange problems with cookies and headers. 5.00 and 5.5 both worked without problems, however 5.01 has some real bugs. Some of the problems I was having included: cookies not deleting, executing headers caused PHP to behave abnormally and other unexplainable random problems. I had these problems on both Win9x and NT but after upgrading to 5.5 all of the problems went away. Just for the heck of it I tested 5.00 as well and had no problems. Good luck, Dean -Original Message- From: Pat Hanna [mailto:[EMAIL PROTECTED]] Sent: Monday, April 16, 2001 5:13 PM To: php help Subject: [PHP] cookies I'm setting cookies for a shopping cart and they are setting fine but they will not delete. I've tried every way of deleting them and they just won't go away. Someone please help. -- Patrick Hanna Database integration--E-commerce solutions The Wentworth Company -- PHP General 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] Cookies
rather than using time(), try using one of the GMT time functions. Check under date/time in the manual, which is the same section that time is under. -- Plutarck Should be working on something... ...but forgot what it was. ""Chi Wa Au"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I use cookie to protect my web pages: > > setcookie("cookiename", "cookievalue", time()+1800); // set the expiry > time to 30 minutes > > The time zone of my server is set to GMT+8. > The server is running on a Redhat 7, apache and PHP 4 as a apache module. > > Now some users always get cookie expired error. I found that they are from > different time zones, i.e. GMT+6, GMT+5. > The users use IE to access my web pages. > > Could anyone tell me how to set the cookie independent of the time zone? > > Thanks! > > Au Chi Wa > ERG HK > > > ERG Group -- > The contents of this email and any attachments are confidential > and may only be read by the intended recipient. > - > > > -- > PHP General 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 General 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] Cookies
You can't set a cookie for a different domain or subdomain. If you set a cookie for a domain and then goto to SSL then the cookie will still be presented. Regards Jon -- Jon Farmer Systems Programmer, Entanet www.enta.net Tel 01952 428969 Mob 07968 524175 PGP Key available, send blank email to [EMAIL PROTECTED] - Original Message - From: "Jason Radley" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, August 31, 2001 4:11 PM Subject: [PHP] Cookies > Does anyone know how to share cookies between servers. > What I want to do is set a cookies on non secure server for a > secure server. > Here is > setcookie("SessionID","$sessid",time() + 7200,"https://domainname.com";); > Thanks > > > -- > PHP General 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 General 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] Cookies
Ignore my previous post it is incorrect Sorry Jon -- Jon Farmer Systems Programmer, Entanet www.enta.net Tel 01952 428969 Mob 07968 524175 PGP Key available, send blank email to [EMAIL PROTECTED] - Original Message - From: "Jon Farmer" <[EMAIL PROTECTED]> To: "Jason Radley" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, August 31, 2001 4:31 PM Subject: Re: [PHP] Cookies > You can't set a cookie for a different domain or subdomain. If you set a > cookie for a domain and then goto to SSL then the cookie will still be > presented. > > Regards > > Jon > -- > Jon Farmer > Systems Programmer, Entanet www.enta.net > Tel 01952 428969 Mob 07968 524175 > PGP Key available, send blank email to [EMAIL PROTECTED] > > - Original Message - > From: "Jason Radley" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, August 31, 2001 4:11 PM > Subject: [PHP] Cookies > > > > Does anyone know how to share cookies between servers. > > What I want to do is set a cookies on non secure server for a > > secure server. > > Here is > > setcookie("SessionID","$sessid",time() + 7200,"https://domainname.com";); > > Thanks > > > > > > > -- -- > > > > > -- > > PHP General 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 General 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 General 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] Cookies
http://www.phpbuilder.com/columns/chriskings20001128.php3 - Original Message - From: Jason Radley <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, August 31, 2001 5:11 PM Subject: [PHP] Cookies > Does anyone know how to share cookies between servers. > What I want to do is set a cookies on non secure server for a > secure server. > Here is > setcookie("SessionID","$sessid",time() + 7200,"https://domainname.com";); > Thanks > > > -- > PHP General 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 General 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] cookies
> Don't they taste great? > > Okay okay.. Someone at IGN has a sense of humour. They send cookies named "h2" with a value of "o" (water), and "oatmeal" with a value of "yumyum". :) Jason -- PHP General 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] cookies
Heh, sure not related to PHP but one search engine in finland sends a variable "e" with value "mc2". :) Niklas -Original Message- From: Jason Murray [mailto:[EMAIL PROTECTED]] Sent: 14. syyskuuta 2001 8:59 To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] Subject: RE: [PHP] cookies > Don't they taste great? > > Okay okay.. Someone at IGN has a sense of humour. They send cookies named "h2" with a value of "o" (water), and "oatmeal" with a value of "yumyum". :) Jason -- PHP General 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 General 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] Cookies reprise...
You can't set a cookie and do a header("Location:") on the same page. It will work in some versions of some browsers, and not in others. -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm - Original Message - From: Matt <[EMAIL PROTECTED]> Newsgroups: php.general Sent: Friday, February 09, 2001 9:07 AM Subject: [PHP] Cookies reprise... > At 08:12 AM 2/9/2001, you wrote: > lets see some code.. > > > Okay, for those so inclined > > I did say the page the cookie script was included on was rather complex. > I will say that I double checked and made sure the cookie variables weren't > overwritten in another include file. > > You can see what I mean by going to http://www.yaysoft.com (use IE if at > all possible) and on the right side bar where it says "User Status" and has > a message saying "You are not logged in" you can click on the login link > below it. > I created an account for anyone who wants to try (everything works except > the login cookie) so you don't have to waste your time signing up with the > script, note it is case sensitive: > user name: php > password: php > after you click the login thing the cookies will be set and the page will > not view them. > > If you used IE and you navigate to c:\windows\temporary internet files or > wherever your cookies are stored, you should notice that a cookie has been > set... with the path set to the root "/" and the domain set to > "www.yaysoft.com" but the cookies will not show up in the browser. > > I have copied the script to a text file at http://www.yaysoft.com/yaylogin.txt > > And for any who want to quickly glance at it, here is the code snippet > where the cookies are set: >if ($item[0]>0) { > setcookie("ucrumb", $uname, time()+31536000, "/", "www.yaysoft.com", 0); > setcookie("pcrumb", $pass, time()+31536000, "/", "www.yaysoft.com", 0); > header("Location: http://www.yaysoft.com"); >} else > header("Location: $PHP_SELF?l_action=login&bad=1"); > > And here is a slice from where they are supposedly supposed to be accessed: >// Now check to see if we are currently logged in to the Yaysystem... >// First check to see if the variables plain out don't exist... >if ((!$ucrumb)||(!$pcrumb)) { > echo "You are not logged in."; > echo ""; > echo "[ href=\"http://www.yaysoft.com/yaylogin.php?l_action=login\">Login] "; > echo "[ href=\"http://www.yaysoft.com/yaylogin.php?l_action=new\">New]"; > echo ""; >// If they DO exist make sure they are a correct pair as per the database... >} else { > > However, I've outputted the contents of $ucrumb and $pcrumb once I get to > the little segment where they are supposed to be accessed and they contain > nothing, so it seems to me that they aren't being sent to the script (which > resides in the root path where the cookie is set to!) I've used HTTP > headers to set the cookies as well, and the problem still persists. > > I know this is long and boring and tedious crap, so I don't really expect > anyone to reply, BUT if any of you have the time or inclination, any > help/suggestions/advice would be greatly appreciated. > > Regards, > Matt > > > > -- > PHP General 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 General 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] Cookies not expiring
Can't read your mind, bud. Show us your code... -Original Message- From: David McInnis [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 2:25 AM To: [EMAIL PROTECTED] Subject: [PHP] Cookies not expiring I understand that if an expiration time is not set, the cookie should expire at the end of the session (when the browser is closed). This is not happening. What is wrong here? I would actually prefer for the cookie to expire when the user left the Web site. Any ideas? Thanks, -- David A McInnis Information Technology Manager CareerPerfect.com(r) -- solutions for a perfect career(sm) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Cookies not expiring
Here is what I am using to set my cookie. $cp_sessionid = $CP_partnerid . "_" . uniqid(str_pad(getenv("REMOTE_ADDR"), 15, "0")); setcookie('cp_sessionid', $cp_sessionid); David McInnis -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 6:01 AM To: 'David McInnis'; [EMAIL PROTECTED] Subject: RE: [PHP] Cookies not expiring Can't read your mind, bud. Show us your code... -Original Message- From: David McInnis [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 2:25 AM To: [EMAIL PROTECTED] Subject: [PHP] Cookies not expiring I understand that if an expiration time is not set, the cookie should expire at the end of the session (when the browser is closed). This is not happening. What is wrong here? I would actually prefer for the cookie to expire when the user left the Web site. Any ideas? Thanks, -- David A McInnis Information Technology Manager CareerPerfect.com(r) -- solutions for a perfect career(sm) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Cookies not expiring
OK...that looks valid. Now, what indications are you getting that the cookie is not expiring when you close the browser? As far as expiring when user leaves the web-site? M.C. Hammer said it best...can't touch that -Original Message- From: David McInnis [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 9:04 AM To: 'Rick Emery'; [EMAIL PROTECTED] Subject: RE: [PHP] Cookies not expiring Here is what I am using to set my cookie. $cp_sessionid = $CP_partnerid . "_" . uniqid(str_pad(getenv("REMOTE_ADDR"), 15, "0")); setcookie('cp_sessionid', $cp_sessionid); David McInnis -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 6:01 AM To: 'David McInnis'; [EMAIL PROTECTED] Subject: RE: [PHP] Cookies not expiring Can't read your mind, bud. Show us your code... -Original Message- From: David McInnis [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 2:25 AM To: [EMAIL PROTECTED] Subject: [PHP] Cookies not expiring I understand that if an expiration time is not set, the cookie should expire at the end of the session (when the browser is closed). This is not happening. What is wrong here? I would actually prefer for the cookie to expire when the user left the Web site. Any ideas? Thanks, -- David A McInnis Information Technology Manager CareerPerfect.com(r) -- solutions for a perfect career(sm) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Cookies not expiring
Also you have to close all instances of the browser for this to occur. That is even if you close the browser that has a session to the site if you have another window open to any other site then the cookie stays. > OK...that looks valid. > > Now, what indications are you getting that the cookie is not expiring when > you close the browser? > > As far as expiring when user leaves the web-site? M.C. Hammer said it > best...can't touch that > > -Original Message- > From: David McInnis [mailto:[EMAIL PROTECTED]] > Sent: Thursday, March 14, 2002 9:04 AM > To: 'Rick Emery'; [EMAIL PROTECTED] > Subject: RE: [PHP] Cookies not expiring > > > Here is what I am using to set my cookie. > > $cp_sessionid = $CP_partnerid . "_" . > uniqid(str_pad(getenv("REMOTE_ADDR"), 15, "0")); > > setcookie('cp_sessionid', $cp_sessionid); > > David McInnis > > -Original Message- > From: Rick Emery [mailto:[EMAIL PROTECTED]] > Sent: Thursday, March 14, 2002 6:01 AM > To: 'David McInnis'; [EMAIL PROTECTED] > Subject: RE: [PHP] Cookies not expiring > > Can't read your mind, bud. > > Show us your code... > > -Original Message- > From: David McInnis [mailto:[EMAIL PROTECTED]] > Sent: Thursday, March 14, 2002 2:25 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Cookies not expiring > > > I understand that if an expiration time is not set, the cookie should > expire at the end of the session (when the browser is closed). This is > not happening. > > What is wrong here? > > I would actually prefer for the cookie to expire when the user left the > Web site. Any ideas? > > Thanks, > > -- > David A McInnis > Information Technology Manager > > CareerPerfect.com(r) -- solutions for a perfect career(sm) > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Ray Todd Stevens Specialists in Network and Security Consulting Senior ConsultantSoftware audit service available Stevens Services Suite 21 3754 Old State Rd 37 N Bedford, IN 47421 (812) 279-9394 [EMAIL PROTECTED] Thought for the day: Intuition (n): an uncanny sixth sense which tells people that they are right, whether they are or not. For PGP public key send message with subject please send PGP key If this message refers to an attachment the attachment may arrive as a seperate mail message depending on the type of mail client and gateway software you are using. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Cookies won't stick
If the cookie lifetime is set to 0, then it is a "session" cookie, and it persists until the browser is closed. Kirk > -Original Message- > From: jennyw [mailto:[EMAIL PROTECTED]] > Sent: Friday, November 02, 2001 12:48 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Cookies won't stick > > > For some reason, when I tried using setcookie(), cookies > wouldn't stick > around. When I added an expiration time, cookies started > sticking around, > but ... I thought that if you didn't provide an expiration they were > supposed to stick around indefinitely? > > Thanks! > > Jen -- PHP General 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] Cookies and Variables
$HTTP_COOKIE_VARS['someWord']; $HTTP_GET_VARS['someWord']; :P Mike Richard S. Crawford wrote: > Consider this code, in page1.php: > > setcookie("someWord","I am a cookie"); > ?> > > ...and this code, in page2.php: > > setcookie("someWord",$someWord); > print ("someWord says: $someWord"); > $someWord = "I am a variable"; > print ("< a href=\"page2.php?someWord=$someWord\" >Click here< > /a >"); > ?> > > (In the actual code, the value of $someWord is passed via POST through > a form, but the principle is the same.) > > The first time I load page2.php, the output should be: > > someWord says: I am a cookie > > Which, of course, works perfectly. > > But each subsequent time I load page2.php, I want the output to be: > > someWord says: I am a variable > > and then set the value of the cookie "someWord" to "I am a variable". > > But that's not what happens. Everytime I load page2.php, someWord > tells me that it is a cookie. > > How do I get the value of the variable to override the value of the > cookie? > > > > > Sliante, > Richard S. Crawford > > http://www.mossroot.com > AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford > MSN: [EMAIL PROTECTED] > > "It is only with the heart that we see rightly; what is essential is > invisible to the eye." --Antoine de Saint Exupéry > > "Push the button, Max!" > > -- PHP General 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] Cookies In Images...
On Wed, 2 Jan 2002 14:11:39 -0700, Matthew Walker wrote: >Can anyone give me a pointer on where to go to find out how to send >cookies through images, preferably in PHP? To do this you will have to point the HREF in your IMG tag to a PHP script. >From that script you should do this: - Pass the correct content-type header (default for PHP is text/html) for example: - Set the cookie as usual - Then send the contents of the image you would like to display, for example: bvr. -- PHP General 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] Cookies In Images...
Thanks. That's what I suspected, but I needed to make sure. Matthew Walker Ecommerce Project Manager Mountain Top Herbs -Original Message- From: Bas van Rooijen [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 02, 2002 2:28 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Cookies In Images... On Wed, 2 Jan 2002 14:11:39 -0700, Matthew Walker wrote: >Can anyone give me a pointer on where to go to find out how to send >cookies through images, preferably in PHP? To do this you will have to point the HREF in your IMG tag to a PHP script. >From that script you should do this: - Pass the correct content-type header (default for PHP is text/html) for example: - Set the cookie as usual - Then send the contents of the image you would like to display, for example: bvr. -- PHP General 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] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.310 / Virus Database: 171 - Release Date: 12/19/2001 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.310 / Virus Database: 171 - Release Date: 12/19/2001 -- PHP General 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] Cookies for Session
Once again, as I see some people complaining in here ... we got lots of ideas and we are in many. Just tell us some more! more details! more details! more details! -Original Message- From: webMax [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 08, 2001 2:55 PM To: [EMAIL PROTECTED] Subject: [PHP] Cookies for Session I am using cookies to maintain session. Now my problem is very vierd (at least for me). On the same browser, on the same server and on the same network, cookies sometimes work and some times don't. Any idea? Thanks in advance! -- PHP General 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 General 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] cookies and clocks
look at it this way: you are dealing with an INTERVAL of time, thus the only reason you really need javascript is in the construction of a date object. you can either import that object into php as a string, or you can actually go the extra mile and set the cookie in javascript. HTH, DanO "Mark Maggelet" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have a cookie that times out after an hour for security reasons. About 1 out of 200 of my users send me an email saying they can't log into my site and I find out that it's usually because their clocks are off. Has anyone had any luck using the time on the client to set cookies by instead of server time? I hate using javascript for this but I don't see much choice. thanks, - Mark -- PHP General 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 General 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] cookies and clocks
On Wed, 25 Apr 2001 17:32:44 -0700, DanO ([EMAIL PROTECTED]) wrote: >look at it this way: > >you are dealing with an INTERVAL of time, thus the only reason you >really need javascript is in the construction of a date object. as far as I know the only way to set a cookie's expiration is with an exact GMT timestamp. If there were a way to tell a browser "1 hour from now" then this would solve my problem. >you can either import that object into php as a string, or you can >actually go the extra mile and set the cookie in javascript. right. I hate to do this though. I guess I'm asking if someone out there has had this problem and found a good way around it. thanks, - Mark >HTH, >DanO > > >"Mark Maggelet" <[EMAIL PROTECTED]> wrote in message >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >I have a cookie that times out after an hour for security reasons. >About 1 out of 200 of my users send me an email saying they can't log >into my site and I find out that it's usually because their clocks >are off. Has anyone had any luck using the time on the client to set >cookies by instead of server time? I hate using javascript for this >but I don't see much choice. > >thanks, >- Mark > > >-- >PHP General 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: php-list- >[EMAIL PROTECTED] > > > > >-- >PHP General 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: php-list- >[EMAIL PROTECTED] -- PHP General 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] cookies and clocks
On Wed, 25 Apr 2001 17:48:48 -0700 (PDT), Rasmus Lerdorf ([EMAIL PROTECTED]) wrote: >> I have a cookie that times out after an hour for security reasons. >> About 1 out of 200 of my users send me an email saying they can't >>log >> into my site and I find out that it's usually because their clocks >> are off. Has anyone had any luck using the time on the client to >>set >> cookies by instead of server time? I hate using javascript for this >> but I don't see much choice. > >Just use a session cookie (by not providing an expiry time) and add >the >server's expiry timestamp to the value of the cookie. Then when you >get >that cookie sent to you, check it against your server's time and >make the >decision on whether to accept the cookie or not based on that. > >That way you are immune from people not having their system clocks >set >right. good idea. I'll do that. - Mark -- PHP General 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] cookies and clocks
> I have a cookie that times out after an hour for security reasons. > About 1 out of 200 of my users send me an email saying they can't log > into my site and I find out that it's usually because their clocks > are off. Has anyone had any luck using the time on the client to set > cookies by instead of server time? I hate using javascript for this > but I don't see much choice. Just use a session cookie (by not providing an expiry time) and add the server's expiry timestamp to the value of the cookie. Then when you get that cookie sent to you, check it against your server's time and make the decision on whether to accept the cookie or not based on that. That way you are immune from people not having their system clocks set right. -Rasmus -- PHP General 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] cookies and clocks
my advise : use that as less as possible, whatever is on the client side could be easy to hack, and not every browser understand JavaScript either. Use cookies, 1-200 is out - means they are unable to use your service : they chousen it that way. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -Original Message- From: Mark Maggelet [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 26, 2001 9:16 AM To: [EMAIL PROTECTED] Subject: [PHP] cookies and clocks I have a cookie that times out after an hour for security reasons. About 1 out of 200 of my users send me an email saying they can't log into my site and I find out that it's usually because their clocks are off. Has anyone had any luck using the time on the client to set cookies by instead of server time? I hate using javascript for this but I don't see much choice. thanks, - Mark -- PHP General 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 General 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] Cookies not expiring (RESOLVED)
OK, I guess I found the problem. RealOne Media player from real networks uses Explorer within its program and I was not closing the RealOne Player therefore it was holding onto the cookie. Thanks, David McInnis -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 7:07 AM To: 'David McInnis'; [EMAIL PROTECTED] Subject: RE: [PHP] Cookies not expiring OK...that looks valid. Now, what indications are you getting that the cookie is not expiring when you close the browser? As far as expiring when user leaves the web-site? M.C. Hammer said it best...can't touch that -Original Message- From: David McInnis [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 9:04 AM To: 'Rick Emery'; [EMAIL PROTECTED] Subject: RE: [PHP] Cookies not expiring Here is what I am using to set my cookie. $cp_sessionid = $CP_partnerid . "_" . uniqid(str_pad(getenv("REMOTE_ADDR"), 15, "0")); setcookie('cp_sessionid', $cp_sessionid); David McInnis -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 6:01 AM To: 'David McInnis'; [EMAIL PROTECTED] Subject: RE: [PHP] Cookies not expiring Can't read your mind, bud. Show us your code... -Original Message- From: David McInnis [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 2:25 AM To: [EMAIL PROTECTED] Subject: [PHP] Cookies not expiring I understand that if an expiration time is not set, the cookie should expire at the end of the session (when the browser is closed). This is not happening. What is wrong here? I would actually prefer for the cookie to expire when the user left the Web site. Any ideas? Thanks, -- David A McInnis Information Technology Manager CareerPerfect.com(r) -- solutions for a perfect career(sm) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookies creating Unwanted Problem....
Did you detect if browser's cookie is enabled?? Regards, -- Yasuo Ohgaki "Dhaval Desai" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi! > > > This website is authenticated using cookies. > I don't understand why..? Id works from some computers > and doesn't work from some computers... > > > The Operating System is Same. The Browser is also the > same one INTERNET EXPLORER 5.0. > > > Is there any reason why this is happening. > > Checck out this website URL for details. > > http://www.uaegraduate.com/jobseekers_login.php > Username: testing > Password: testing > > I have used cookies to autheticate on this one. > > > Thank You > Dhaval Desai > > > > > > __ > Do You Yahoo!? > Yahoo! Auctions - Buy the things you want at great prices. > http://auctions.yahoo.com/ > > -- > PHP General 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 General 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] Cookies and servers problems
I couldnt get php's cookies working at all, so finally I decided to send a header cookies which worked perfectly. So try this: header("Set-Cookie: Login[Email]=$Email; path=/; expires=$oneYear"); I made a function for $oneYear, but you can replace it with whatever date you would like :) I hope this answers your question. Rick > Hi All, > > I used to run a customized version of Php-Nuke (www.phpnuke.org) on a > server that had PHP 4.05, Linux and Apache. Used to run fine. > > Now I am trying to run the same, just downloaded and uploaded to the new > server, but it is a Windows, IIS, with PHP 4.0.3pl1. The phpinfo(); of the > new server can be seen here: > > http://www.arubaito.com.br/info.php > > Okay, now with the problem. I customized Nuke to allow users to be > attached to 'companies', and the articles be displayed only for certain > companies. So, only an user from a specific company can have access to the > article. > > But now, it is not working. The sql query is feed by a "WHERE > company='$user_company'" part, where the $user_company comes from another > sql query, based on the login name from a cookie. > > If I change $user_company to 1, it grabs the articles. > > So, the problem is with the cookies. The new server is not sending it > right. I tested on 2 or 3 machines, all with different Operating Systems and > browsers (win98, win2k, IE, Netscape, Opera). > > Anyone have an idea if the new server I am on and its configuration has > some kind of trouble to manage cookies properly? > > Thanks in advance, > > Julio Nobrega. > > > > -- > PHP General 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 General 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] Cookies, Sessions and Login Proceess
Just do your authentication before you send any HTML (including any whitespace). I actually recommend not sending ANY HTML from your authentication script. Authenticate them, set your cookie, and redirect the visitor to an appropriate next page, based on whether or not they've successfully authenticated. BTW - storing the username/password in the cookie makes no sense They've already authenticated ... just store a user-is-logged-in cookie which expires after X minutes/hours/etc. It's a good practice for when you'll have to deal with privacy & security concerns. ~Chris /"\ \ / September 11, 2001 X We Are All New Yorkers / \ rm -rf /bin/laden On Mon, 12 Nov 2001, Joe Van Meer wrote: > Hi there, I'm new to php coming from an asp background and would like to > know the easiest way to automate a login process. I have one page called > 'index.php' and it contains a form with 2 elements, username and password. > This page is posted to th 'login.php' and here I do a check against the > database to see if the person is who they say they are. This where I came > across a problem...I would like to set a cookie on the user's machine once I > know they are who they say they are. So I attempted to create a cookie to > hold their username and password upon successful login..I received the > following error...Warning: Cannot add header information - headers already > sent by (output started at E:\ez\codesnipits\login.php:16) in > E:\ez\codesnipits\login.php on line 66. > > So I looked up in the manual and found that I can't do it this way. I can't > send header info after the header has been sent for obvious reasons. So how > the heck do I manage to do this? What I would to do is have the user login > once, and each subsequent time they visit , skip the login process via their > username and password in the cookie. > > Any insight to this type of process would greatly be appreciated. > > Thx Joe > p.s Sorry about the bold font ;) > > > > > > -- > PHP General 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 General 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] Cookies, Sessions and Login Proceess
Thx Christopher for replying. Ok, let me see if I understand you correctly... The user enters username and password on index.php, this is posted to login.php. On login.php after I verify the user is who he/she says they are I set a cookie called "accessedbefore" to "yes" and redirect them to the main page. Am I allowed to set a cookie and redirect them after determining who the user is? How would I redirect them after setting the cookie? Header function or is there a better way? Thx Joe :) "Christopher William Wesley" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Just do your authentication before you send any HTML (including any > whitespace). I actually recommend not sending ANY HTML from your > authentication script. Authenticate them, set your cookie, and redirect > the visitor to an appropriate next page, based on whether or not they've > successfully authenticated. > > BTW - storing the username/password in the cookie makes no sense They've > already authenticated ... just store a user-is-logged-in cookie which > expires after X minutes/hours/etc. It's a good practice for when you'll > have to deal with privacy & security concerns. > > ~Chris /"\ > \ / September 11, 2001 > X We Are All New Yorkers > / \ rm -rf /bin/laden > > On Mon, 12 Nov 2001, Joe Van Meer wrote: > > > Hi there, I'm new to php coming from an asp background and would like to > > know the easiest way to automate a login process. I have one page called > > 'index.php' and it contains a form with 2 elements, username and password. > > This page is posted to th 'login.php' and here I do a check against the > > database to see if the person is who they say they are. This where I came > > across a problem...I would like to set a cookie on the user's machine once I > > know they are who they say they are. So I attempted to create a cookie to > > hold their username and password upon successful login..I received the > > following error...Warning: Cannot add header information - headers already > > sent by (output started at E:\ez\codesnipits\login.php:16) in > > E:\ez\codesnipits\login.php on line 66. > > > > So I looked up in the manual and found that I can't do it this way. I can't > > send header info after the header has been sent for obvious reasons. So how > > the heck do I manage to do this? What I would to do is have the user login > > once, and each subsequent time they visit , skip the login process via their > > username and password in the cookie. > > > > Any insight to this type of process would greatly be appreciated. > > > > Thx Joe > > p.s Sorry about the bold font ;) > > > > > > > > > > > > -- > > PHP General 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 General 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] Cookies, Sessions and Login Proceess
header(); function is fine. Another option is javascript which is dependent on the client software. But you get the picture about the login process. I just have to agree with Chris, something name 'is_logged' is better than 'accessedbefore'. -- Julio Nobrega A hora está chegando: http://toca.sourceforge.net "Joe Van Meer" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Thx Christopher for replying. Ok, let me see if I understand you > correctly... > > The user enters username and password on index.php, this is posted to > login.php. On login.php after I verify the user is who he/she says they are > I set a cookie called "accessedbefore" to "yes" and redirect them to the > main page. Am I allowed to set a cookie and redirect them after determining > who the user is? How would I redirect them after setting the cookie? Header > function or is there a better way? > > Thx Joe :) > > -- PHP General 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] Cookies, Sessions and Login Proceess
On Mon, 12 Nov 2001, Joe Van Meer wrote: > Thx Christopher for replying. Ok, let me see if I understand you > correctly... > > The user enters username and password on index.php, this is posted to > login.php. On login.php after I verify the user is who he/she says they are > I set a cookie called "accessedbefore" to "yes" and redirect them to the Exactly. > main page. Am I allowed to set a cookie and redirect them after determining > who the user is? How would I redirect them after setting the cookie? Header You can set a cookie any time before any standard output is sent to the browser (and before you send a new Location header). Your login.php can look something like this (with pseudo-ish code) ... ~Chris /"\ \ / September 11, 2001 X We Are All New Yorkers / \ rm -rf /bin/laden -- PHP General 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] Cookies, Sessions and Login Proceess
Thanx a bunch you guys! Got my login process going the way I wanted it. I appreciate your help, as I['m new to php. The first of many questions I suppose :) Cheers Joe "Christopher William Wesley" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Mon, 12 Nov 2001, Joe Van Meer wrote: > > > Thx Christopher for replying. Ok, let me see if I understand you > > correctly... > > > > The user enters username and password on index.php, this is posted to > > login.php. On login.php after I verify the user is who he/she says they are > > I set a cookie called "accessedbefore" to "yes" and redirect them to the > > Exactly. > > > main page. Am I allowed to set a cookie and redirect them after determining > > who the user is? How would I redirect them after setting the cookie? Header > > You can set a cookie any time before any standard output is sent to the > browser (and before you send a new Location header). > > Your login.php can look something like this (with pseudo-ish code) ... > > $input_ok = validate_user_input( $username, $password ); > if( $input_ok ){ > $user_ok = authenticate_user( $username, $password ); > if( $user_ok ){ > setcookie( "myuser", "ok", time()+7200, "/" ); > header( "Location: congratulations.html" ); > } else { > header( "Location: go_away.html" ); > } > } else { > header( "Location: go_away.html" ); > } > ?> > > > ~Chris /"\ > \ / September 11, 2001 > X We Are All New Yorkers > / \ rm -rf /bin/laden > -- PHP General 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] cookies - not working with Nutscrape
The complete snippet is = 5) { $val = 1; } else { $val = $ecb; $val++; } } else { $val = 1; } $expires = mktime(12, 00, 00, 12, 31, 2005); setcookie("ecb",$val,$expires,"/",".domain.com",0); ?> I've gotten around it for the moment by using a browser detection routine and delivering different methods based on that but that's kind of a dirty hack. > -Original Message- > From: Richard Lynch [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 19, 2001 7:53 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] cookies - not working with Nutscrape > > > What's the rest of your SetCookie look like? > > By Day:|By Night: > Don't miss the Zend Web Store's| There's not enough room here... > Grand Opening on January 23, 2001! | Start here: > http://www.zend.com| http://l-i-e.com/artists.htm > - Original Message - > From: Brian V Bonini <[EMAIL PROTECTED]> > To: Richard Lynch <[EMAIL PROTECTED]>; "Brian V Bonini" > <[EMAIL PROTECTED]> > Sent: Friday, January 19, 2001 4:15 PM > Subject: RE: [PHP] cookies - not working with Nutscrape > > > > That broke em both... > > > > > -----Original Message- > > > From: Richard Lynch [mailto:[EMAIL PROTECTED]] > > > Sent: Friday, January 19, 2001 4:04 PM > > > To: "Brian V Bonini" > > > Subject: Re: [PHP] cookies - not working with Nutscrape > > > > > > > > > > > > > > > > Why would this work in IE but not NN (4.08)? > > > > > > > > If I remove "/" ".mydomain.com" it works with > > > > NN but not IE. Vice versa if I leave it in. > > > > > > Keep just the "/", not the domain. > > > > > > They both suck. > > > > > > By Day:|By Night: > > > Don't miss the Zend Web Store's| There's not enough room > here... > > > Grand Opening on January 23, 2001! | Start here: > > > http://www.zend.com| http://l-i-e.com/artists.htm > > > > > > > > -- PHP General 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] cookies - not working with Nutscrape
Yup, the issue really seems to lie with the path and domain. I may just resort to; header("Set-Cookie: ..") -Brian > -Original Message- > From: DanO [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 19, 2001 7:10 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] cookies - not working with Nutscrape > > > > have you checked the date element? > > the browsers differ in how they handle post-y2k dates. > > DanO > > > -Original Message- > From: Brian V Bonini [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 19, 2001 4:09 PM > To: [EMAIL PROTECTED] > Subject: [PHP] cookies - not working with Nutscrape > > > Why would this work in IE but not NN (4.08)? > > If I remove "/" ".mydomain.com" it works with > NN but not IE. Vice versa if I leave it in. > > Thanks, > -Brian > *** > > if (isset($ecb)) { > if ($ecb >= 5) { > $val = 1; > } else { > $val = $ecb; > $val++; > } > } else { > $val = 1; > } > $expires = mktime(12, 00, 00, 12, 31, 2005); > setcookie("ecb",$val,$expires,"/",".eastcoastbicycles.com",0); > ?> > > -- > PHP General 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 General 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] cookies - not working with Nutscrape
Actually, it's excepting the time/date. It's the path/domain that is creating a problem. For some reason your original suggestion of leaving the domain out is working today. setcookie("ecb",$val,$expires,"/"); I could not get this to work for the life of me yesterday. Either I was overworked/tired or the Gremlins were out in force. ... ;-) Thank for your persistence. -Brian > -Original Message- > From: Richard Lynch [mailto:[EMAIL PROTECTED]] > Sent: Saturday, January 20, 2001 4:20 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] cookies - not working with Nutscrape > > > > $expires = mktime(12, 00, 00, 12, 31, 2005); > > I think Netscape follows the spec and there's some sort of > maximal reliable > time limit of two years or somesuch -- and anything else is assumed to be > badly-formatted time... > > Try using something a little more reasonable like a year. > > By Day:|By Night: > Don't miss the Zend Web Store's| There's not enough room here... > Grand Opening on January 23, 2001! | Start here: > http://www.zend.com| http://l-i-e.com/artists.htm > > > -- PHP General 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] Cookies still store old value(Help!!)
Hello Hendry, (HS == "Hendry Sumilo") [EMAIL PROTECTED] writes: HS> When User "A" enter ,the cookies will store User "A" name,when he HS> enters the lecturer page,he will be directed to login page HS> again(because he is not allowed to enter lecturer page) and so do HS> User "B". BUT THE PROBLEM HAPPENS LIKE THIS: When User "A" enters HS> ,and then User "B" enters,User "B" CAN ENTER THE STUDENT PAGE AND HS> THE COOKIES STORE USER USER "A" VALUE.BUT WHEN I REFRESH IT ,THE HS> COOKIES WILL STORE NOTHING AND REDIRECT TO LOGIN PAGE. Can i know HS> what the problem is? If you show us some code, maybe. *hint* :-) HS> Hendry Sumilo -Brian -- Once you understand how to write a program, get someone else to write it. -- PHP General 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]