27: Session and Cookies in PHP | PHP Tutorial | Learn PHP Programming | PHP for Beginners

preview_player
Показать описание
Session and Cookies in PHP | PHP Tutorial | Learn PHP Programming | PHP for Beginners. Cookies and sessions are used when we want to collect or store data from users. An example could be if we want to make a login system or a shopping cart since these require user interaction. So if you are interested in having users on your website, then you need to learn this.

➤ GET ACCESS TO MY LESSON MATERIAL HERE!

First of all, thank you for all the support you have given me!

I am really glad to have such an awesome community on my channel. It motivates me to continue creating and uploading content! So thank you!

I am now using Patreon to share improved and updated lesson material, and for a small fee you can access all the material. I have worked hard, and done my best to help you understand what I teach.

I hope you will find it helpful :)

Рекомендации по теме
Комментарии
Автор

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 🙏💕

anvinawalgaria
Автор

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

alexanderer_
Автор

Daniel....great set of videos, thanks for taking the time to make them. Small point - the number after time() is seconds not mili-seconds

no_short_circuit
Автор

This guy is on point. I've been trying to learn this stuff for a while now. Great job on explaining the semantics.

esu
Автор

Great explanation, bro! Best PHP series on Youtube man! :)

yannik
Автор

Now as I watched your video, I understand now what is cookie. Thanks!

funixer
Автор

Thanks for all the videos man, one of the best channels explaining PHP really good ..

starkandjack
Автор

You've said my name so many times.

senju
Автор

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!

rgryczan
Автор

Thanks man for sharing your knowledge. Cheers! God bless you!

samuelkaka
Автор

I'm here! 😎 Great video, just posting a comment to show some support! Keep up the good work. 🤙

BornDoubleUp
Автор

I´ve been watching your videos for a week and seems to be longer! great job!

seifcocksucker
Автор

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?

ricekrissy
Автор

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?

cmd
Автор

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 instead.

atmian
Автор

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 ?

sharifabahar
Автор

sessions are stored in server then how can closing chrome delete session?

collegestudy
Автор

if u want delete session you can use
session_unset('your session name');
or
session_unset();
clear everything

jackywong
Автор

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!

adriandinca
Автор

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.

a.yashwanth
visit shbcf.ru