note 72473 added to function.session-set-cookie-params

From: Date: Sat, 20 Jan 2007 03:58:39 +0000
Subject: note 72473 added to function.session-set-cookie-params
Groups: php.notes 
Request: Send a blank email to php-notes+get-121945@lists.php.net to get a copy of this message
Regarding trukin@gmail.com's note, it is errant. ============================== trukin at gmail dot com 31-Dec-2006 03:31 There is something that the php manual does not explain very well, the lifetime of the cookie is not the sum of time() + whatever you want. It should be whatever you want: CORRECT: $life = 60 * 60 * 24 * 30; // 30 days WRONG: $life = time() + (60 * 60 * 24 * 30); ============================== Sir, according to the manual here: http://sg.php.net/manual/en/function.setcookie.php, the correct syntax is indeed time()+seconds. The lifetime is determined as the number of seconds passed since the Unix Epoch. Therefore, time()+60*60*24*30 is correct. ---- Server IP: 202.79.178.91 Probable Submitter: 202.156.13.1 (proxied: 222.164.112.166) ---- Manual Page -- http://www.php.net/manual/en/function.session-set-cookie-params.php Edit -- https://master.php.net/note/edit/72473 Del: integrated -- https://master.php.net/note/delete/72473/integrated Del: useless -- https://master.php.net/note/delete/72473/useless Del: bad code -- https://master.php.net/note/delete/72473/bad+code Del: spam -- https://master.php.net/note/delete/72473/spam Del: non-english -- https://master.php.net/note/delete/72473/non-english Del: in docs -- https://master.php.net/note/delete/72473/in+docs Del: other reasons-- https://master.php.net/note/delete/72473 Reject -- https://master.php.net/note/reject/72473 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#121945) next »