Here is a simpler way: setcookie('username', null, 0); time() will always be greater than 0 so there is no need to call time() when unsetting. The second parameter is also not needed so it can be null.
@markonikolicphoto8 жыл бұрын
That 0 instead of deleting time with minus operator will set unlimited time.
@pola5876 жыл бұрын
@Marko Nikolic true
@cjvaans448411 жыл бұрын
Thank goodness for a short 2 minute clip. 5 clips feels so long.
@Dalwanaage13 жыл бұрын
Thank you for sharing your knowledge with us.
@pancake19113 жыл бұрын
@LetsSpotIt it seems like that would be okay. cause time() is the current time and it's constantly changing. So even if you did time() by itself, it would expire instantly.
@lex2009007 жыл бұрын
finished 76 tutorials in one day:) Thought could go for 200 :(
@nizaral-assi31736 жыл бұрын
You learnt absolutely NOTHING!
@vswyt Жыл бұрын
goat @@nizaral-assi3173
@UHDking12 жыл бұрын
He Alex, what about is to setcookie(' username' , '', time()+1000); If I will use this, I used this in my first cms and its worked. Is it unproper? Thanks
@LetsSpotIt13 жыл бұрын
do i have to use the same amount of time when unsetting it? i think it would be fine as long as the timestamp is earlier than current time (so time()-1 is ok?)
@mariellevaldez8 жыл бұрын
I have a question, surely when you log out you can also use session_destroy()?
@victoriarglez8 жыл бұрын
That just will work if you are using $_SESSION's session_start();
@vyuutuube9 жыл бұрын
@iam4eversmart8812 жыл бұрын
I think any value that is
@gregorkovacic98068 жыл бұрын
in case anyone wondered how set, delete and view cookie as sessions in previous videos: set.php: setcookie('username', 'gregor', time()+1000); unset.php: setcookie('username', 'gregor', time()-1000); view.php: if (isset($_COOKIE['username'])) { echo 'Welcome, '.$_COOKIE['username']; } else { echo 'Please log in.'; }
@MegaMalik908 жыл бұрын
Hi Mr. Kovacic, I'm a total noob at this things. But I want to learn something, and I don't have anything to begin with, html, mysql whatsoever. My question is, will I really learn something if I follow this tutorial from beginning to end? I only want to make a club membership website actually, so I can arrange my database, photos etc via a web based application. Do You have any suggestion? Thank You so much in advance, Sir.
@retronexusio13 жыл бұрын
hahahaha... an sunset cookie would be great as well!
@010arman01012 жыл бұрын
instead of time()-1000 I just put in time(). Is there anything wrong with that? Thanks for the vids, btw.
@soltysss12 жыл бұрын
if you echo some html before setting cookie you will get error!