I had my exam today and I got a question on session and cookies. I watched this video in the morning. Because of your video I could answer that question. Thank you 🙏💕
@nikosn.99323 жыл бұрын
i was like number 69.
@alexanderer_ Жыл бұрын
A tip for writing the expiration-time is to, instead of writing it in seconds, write it in a more comprehendable manner: SYNTAX: time() + seconds * minutes * hours * days Example for a cookie that lasts a week (7 days): time() + 60 * 60 * 24 * 7
@WahyuArtka Жыл бұрын
do you know how to expire cookies for the next 8 years??
@abderrahmanemessaoudene3404 Жыл бұрын
@@WahyuArtka time() + 60 * 60 * 24 * 365 * 8
@esu95917 жыл бұрын
This guy is on point. I've been trying to learn this stuff for a while now. Great job on explaining the semantics.
@no_short_circuit9 жыл бұрын
Daniel....great set of videos, thanks for taking the time to make them. Small point - the number after time() is seconds not mili-seconds
@Dani_Krossing9 жыл бұрын
+Bill Baird Thank you for pointing that out Bill :) I was calculating it on the side as I was recording the tutorial and must have gotten it wrong
@viniciusvalente3126 жыл бұрын
So should I use 86.400 or 86.400.000 for one day?
@nrnugteren6 жыл бұрын
Good question +Vinicius Valente, was wondering the same. 24 hours * 60 minutes * 60 seconds is 86.400 seconds, but how does PHP interpret that number? EDIT (found the answer): Just found the answer on php.net/manual/en/function.setcookie.php "expire The time the cookie expires. This is a Unix timestamp so is in number of seconds since the epoch. In other words, you'll most likely set this with the time() function plus the number of seconds before you want it to expire." In other words: Daniel has set the value correctly in this tutorial, if he wants the cookie to be expired after 1 day.
@danish61926 жыл бұрын
I actually was coming down to to comments section to say the same, but found this already :p
@WaliBD19 ай бұрын
@@viniciusvalente312 86400 for 1 day 👍
@funixer5 жыл бұрын
Now as I watched your video , I understand now what is cookie. Thanks!
@yannik82712 жыл бұрын
Great explanation, bro! Best PHP series on KZbin man! :)
@starkandjack64114 жыл бұрын
Thanks for all the videos man, one of the best channels explaining PHP really good ..
@senju315 жыл бұрын
You've said my name so many times.
@Born2DoubleUp2 жыл бұрын
I'm here! 😎 Great video, just posting a comment to show some support! Keep up the good work. 🤙
@samuelkaka13504 жыл бұрын
Thanks man for sharing your knowledge. Cheers! God bless you!
@rgryczan838 жыл бұрын
Your tutorials look very good; i have know some PHP and JS but i think when i watch all of your tutorials(about js/php) i would be so much better :p thanks!
@EmbellishedCreations5 жыл бұрын
Awesome Tutorial!Thanks for sharing!
@jackywong9416 жыл бұрын
if u want delete session you can use session_unset('your session name'); or session_unset(); clear everything
@seifcocksucker54578 жыл бұрын
I´ve been watching your videos for a week and seems to be longer! great job!
@tvs34974 жыл бұрын
Programming is a very powerful tool. You can create universes with it... and destroy them as well.
@rizwanhamidrandhawa80906 жыл бұрын
In one day there are 86400 seconds and 86400000 milliseconds.
@simopelle4 жыл бұрын
yeah, the third setcookie() parameter is set in seconds, not in milliseconds as he said
@xiaoti80354 жыл бұрын
bullshit, 86400 seconds and 86400000 milliseconds would be 172,800 seconds. there are only 86400 seconds in a day OR 86400000 milliseconds. Please,man your in the coding world, syntax is important. JK
@atmian10 ай бұрын
Good info. However, 1 day = 86400 seconds, not milliseconds as you said. So should seconds or milliseconds be used for cookie time? If milliseconds, you should enter 86400000 instead.
@ricekrissy97695 жыл бұрын
Great videos 👍 In this video you mentioned that usernames/passwords should be stored in sessions and that sessions end as soon as you close the browser. But When I go to a website that needs me to login, I can close the site and then go back and still be logged in. Does that mean that site is using cookies to store my username and password? Or is there something else they're using to remember my username and password?
@mariac77725 жыл бұрын
Thanks Daniel
@yongjung54336 жыл бұрын
thank you!
@ASouza-ut9kb6 жыл бұрын
Excellent videos!
@a.yashwanth4 жыл бұрын
I am using xampp on windows. I restarted my computer and started xampp but my previous logged in session stayed. Why is that so? Also it is fresh install of xampp.
@sharifabahar62577 жыл бұрын
Thank you Danial for such great series. Do we you what is the id of a user when we assign value for session ? If yes how do we know ?
@nrnugteren6 жыл бұрын
If I had to guess (not there yet, but from my previous slight experiences with MySQL): The ID (for example '12') corresponds with an ID in a database, they you either create manually or that is being assigned automatically upon user creation. In that table you will have one row with ID's (i.e. 1 to 20) and the row next to it has the usernames corresponding to those ID's. Anyone feel free to correct me if I'm wrong, but I think that's how it will work when we arrive at the tutorial about databases and login systems.
@traciss2 жыл бұрын
I'm completely new to php, well programming on a whole. However we were asked to make a cookie for our store page. We use the MVC approach, how would this be implemented using that approach.
@cmd91834 жыл бұрын
I use a cookie to remember the user so they dont have to log in every time they visit the website and I store there username in that cookie is this wrong?
@cmd91834 жыл бұрын
@HOTBOINICK i found out its bad because if you know another accounts username you can simpally change the cookie to there username and you would be logged in
@cmd91834 жыл бұрын
@HOTBOINICK lol we learn as we go
@collegestudy59775 жыл бұрын
sessions are stored in server then how can closing chrome delete session?
@siddharthgaglani44453 жыл бұрын
Which keyboard are you using ?
@RagHelen6 жыл бұрын
How is PHP on my server able to write a cookie in the client's browser?
@16991074 жыл бұрын
Would there be a reason why a session may drop before a session destroy and don't close the browser? Im using PHP 5.5.4 on xamp package 1.8.3, and I cannot for the life of me work out why sessions could drop without either of the aforementioned events happening.
@smacdsmaccers3 жыл бұрын
nice, digital baking
@sstream176 жыл бұрын
I would have appreciated explanations on retrieving the variables and performing other actions with them.
@nrnugteren6 жыл бұрын
Are you perhaps referring to the stuff that was explained in previous lessons? Hopefully you'll find there what you were looking for. The whole course starts here: kzbin.info/www/bejne/p4e4ZIlmdpVooZo And here the explanations about variables begin: kzbin.info/www/bejne/eaDSo5anl9Cjf5I
@adriandinca56827 жыл бұрын
First of all, you have the best php tutorials on youtube! :D Secondly, I was wondering if it's possible to share a session between two or more users. Here is what I mean. Let's say we have a $_SESSION['room'] (which stores a multidimensional array) is it possible to share a reference to this session between two users? I tried something like generating a random name for the room and store it inside a variable called $room_id and than I started a session $_SESSION[$room_id] but of course it didn't work :). Thanks in advance!
@kreut88174 жыл бұрын
hello, if you are still here, how are you doing three years from now? lol
@adriandinca56824 жыл бұрын
@@kreut8817 Hello AJ, I have to say your comment was a pleasant surprise, I almost shed a tear :,D. I am doing great, thanks for asking! Looking back I never expected actually become a web developer, it was more of a passion project. Although I switched from PHP to JavaScript, this channel is where my passion for web development started. I am currently working for a fin tech company and I love it. How are you doing?
@kreut88174 жыл бұрын
@@adriandinca5682 Hello Adrian, I am doing great! It's nice to know after three years, you have found a place where you can do what you love. I feel like I am where you once were before, in a stage of learning, hoping to become something in the future. Next year, I'll be a senior in high school, so I've been spending my time binge watching programming videos like these as well as coding projects. I'm so happy to hear from you! I never expected a response.
@biskutnation4 жыл бұрын
@@adriandinca5682 , are you ditching PHP completely? did you find the JS much more easier to use?
@janx963 Жыл бұрын
You wrote it wrongly, here is the correct one to start SESSION named room with a value of $room: $_SESSION["room"] = $room;
@lakshanchamod12085 ай бұрын
Nice
@ericmammburu18862 жыл бұрын
Hello mr Dani, Iam having a problem its like $_SESSIONS dont work in google chrome any help please
@GohersWay4 жыл бұрын
For me own-self X video with lesson 27 and 28 also ( search login system by mmtuts or something similar ).
@eosapril9 жыл бұрын
I'm stuck here, offfff...
@SuperTherock123456 жыл бұрын
session changed from page to page. how to rectify this problem.
@djleisheng6 жыл бұрын
Turns out you have to start a session on each new page that is executed and in the page where you are setting session variables BEFORE you set them (I think he shows this in the next video, but anyway..) -----index.php----- if (!isset($_SESSION)) { session_start(); } $_SESSION['name'] = 'Daniel; -----test.php----- if (!isset($_SESSION)) { session_start(); } echo $_SESSION['name'];
@CastleShield3 жыл бұрын
I am watching how to make cookies in php, meanwhile my wife is watching how to make chocolate cookies. I'm kidding.
@Star-hw8bh2 жыл бұрын
when the course gonna update?
@VeronaLynne3 жыл бұрын
I don't get it.. Why should we make the time negative when deleting a cookie instead of just removing the line of code??
@Dani_Krossing3 жыл бұрын
If you delete a line of code, it will get deleted for all the users using the site. And because PHP is a language used to make dynamic content on web sites, it defeats the purpose. 🙂 Look at it this way... If you have vending machine that people can get a variety of snacks from. Deleting the line of code would be the same as stopping the machine from being able to sell, let’s say chips, to ALL customers. Not just to some of the them. Instead we need the customers to be able to buy chips, but also cancel their purchase if needed. And that’s why we have statements in PHP to determine “if the customer wants chips” as well “if they want to cancel their order”.
@lakshanchamod1208Ай бұрын
for my php exam
@tusharjajodia90776 жыл бұрын
in 3:58. You saying milliseconds and adding 86400 second??? a day has 86400*1000 milliseconds
@nrnugteren6 жыл бұрын
PHP works with seconds indeed: Just found the answer on php.net/manual/en/function.setcookie.php "expire The time the cookie expires. This is a Unix timestamp so is in number of seconds since the epoch. In other words, you'll most likely set this with the time() function plus the number of seconds before you want it to expire." In other words: Daniel has set the value correctly in this tutorial, if he wants the cookie to be expired after 1 day.
@devonvermaak41015 жыл бұрын
Did I just learn how to steal to steal client data. Holy shit.
@iamchiragarora6 жыл бұрын
at 5:50 there's a sound. Can you describe that? I mean i am not mocking you with this comment but just curious to know.
@Dani_Krossing6 жыл бұрын
Probably rain in the background
@mdz73724 жыл бұрын
How to make cookie logger
@kmtsvetanov5 жыл бұрын
Start a session: session_start();
@mibrahim42455 жыл бұрын
Yea he missed this, but he targeted to manifest the main difference between cookies and sessions...
@HarryPotter-nc3vz4 жыл бұрын
wait, he doesn't actually set a cookie since the time is in negative
@Dani_Krossing4 жыл бұрын
That's exactly right. This is how you "unset a cookie" 🙂 I explained that in the video.
@SMAKIEVISUALMEDIA5 жыл бұрын
how can i download all video at once
@Dani_Krossing5 жыл бұрын
On my Patreon I have a link where you can download all my videos :)
@iamnsk88116 жыл бұрын
Pls help me i want make an asmin panel !
@shruti2981 Жыл бұрын
❤
@rafiqjarjous75423 жыл бұрын
but how do we actually use it tho
@Dani_Krossing3 жыл бұрын
My login system project video later on shows how :)
@Freelancer198413 жыл бұрын
Millisecond?
@LeonSafal6 жыл бұрын
u said lock in or login ? haha anyways thanks for the tutorial