26 | Session Security Basics in PHP for Beginners | 2023 | Learn PHP Full Course For Beginners

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 พ.ย. 2024

ความคิดเห็น • 58

  • @Greg8872
    @Greg8872 ปีที่แล้ว +16

    Old dog (23 years of PHP coding) learned a new trick with the regenerate offering a more secure version. Thanks.

    • @RoterFruchtZwerg
      @RoterFruchtZwerg 5 หลายเดือนก่อน +1

      after 23 years you should know where the PHP documentation is. read it. session_regenerate_id just generates a new ID. It is by no means any more secure or fancier than the ID you started with. Generating a new ID, e.g. after login, is a good measure against session fixation though. But the explanation in the video is just wrong. Same for the strict_mode.

    • @morvaysincumark
      @morvaysincumark 9 วันที่ผ่านมา

      @@RoterFruchtZwerg would it not still be more secure given the fact it's an entirely new id? Where is all this hostility coming from?

  • @akashgola2153
    @akashgola2153 8 หลายเดือนก่อน +5

    And here we go making our website more and more secure with every passing session.

  • @teemos2732
    @teemos2732 8 หลายเดือนก่อน +3

    Thanks, as always. V glad I found your channel.

  • @cooki3cutt3r13
    @cooki3cutt3r13 ปีที่แล้ว +6

    awesome video sir

  • @ElizabethOmokhaye
    @ElizabethOmokhaye ปีที่แล้ว +5

    thank you for being such an amazing teacher

  • @bluecafe509
    @bluecafe509 ปีที่แล้ว +2

    Great video. Appreciated.

  • @SundayChindo-u4y
    @SundayChindo-u4y ปีที่แล้ว +11

    Hello Dani, thanks for all your amazing videos. Can you please, do a full course on laravel? I've seen tones of videos on youtube on laravel and I feel I'll get a better understanding if you taught the course. I am really looking forward to it. Gracias

    • @akashgola2153
      @akashgola2153 8 หลายเดือนก่อน

      I feel the same way, he should do that.

    • @jasonramirez6182
      @jasonramirez6182 6 หลายเดือนก่อน

      waiting for this

  • @mosesbentum3125
    @mosesbentum3125 7 หลายเดือนก่อน +1

    You're a good teacher. Keep doing the good job!

  • @sonamohialdin3376
    @sonamohialdin3376 ปีที่แล้ว +2

    Excellent tutorial thank you

  • @MagdalenaLaszlo
    @MagdalenaLaszlo 7 หลายเดือนก่อน +1

    you showed me a lot of things, I am new. BTW you are a fantastic speaker! Thanks!!!

  • @janx963
    @janx963 ปีที่แล้ว +4

    Can you make us a long episode talking about all security mesures we could take please?

  • @Gryningen360
    @Gryningen360 7 หลายเดือนก่อน +1

    Lambda is a naming convenience

  • @randomthings12973
    @randomthings12973 ปีที่แล้ว +3

    Laravel tutorial please. You explain very well

  • @danskkat1164
    @danskkat1164 ปีที่แล้ว

    meget tak.

  • @AxxionMarketPlace-iu6ri
    @AxxionMarketPlace-iu6ri ปีที่แล้ว

    Thank you

  • @owusuafriyiemorrison8541
    @owusuafriyiemorrison8541 10 หลายเดือนก่อน

    Dani thanks
    If want make result system, have to create table for both level in the database, and if you view it too using php

  • @georgekyalo1804
    @georgekyalo1804 ปีที่แล้ว

    You are real Dan

  •  ปีที่แล้ว

    tomorrow i have my first technical interview on a junior php dev job offer, since i just finished my studies. i am obviously not prepared for that and will take it as an interesting experience - i am not very proficient at php and i spent most of my previous days panicking and procastinating. anyways, your recent videos have been very helpful and in time, thank you

    • @Dani_Krossing
      @Dani_Krossing  ปีที่แล้ว +2

      I’m glad you found the videos helpful. Good luck on the interview! 🙂

  • @somalifreelancer6196
    @somalifreelancer6196 ปีที่แล้ว +2

    Iam first

  • @jediampm
    @jediampm ปีที่แล้ว +1

    Hi, great tips but still missing about csrf. and xss ( when outputting something) in php. ;)

    • @Dani_Krossing
      @Dani_Krossing  ปีที่แล้ว +1

      We did cover a bit of XSS protection earlier in this course, but you are right about there not being a "XSS specific lesson", as well as an episode on CSRF protection. 🙂
      Before getting into more security, I'd like to create a small exercise video to get people more comfortable with what we have learned up until now. Maybe even put security on hold for a few videos, since some complete beginners may find it overwhelming, when too much security is being covered right after one another. 🙂

    • @jediampm
      @jediampm ปีที่แล้ว

      @@Dani_Krossing Hi, yes it best learning doing something with specific context.
      Now, i didn't see all previous videos of this series, but i think is missing show alternative syntax of control flow like if, "foreach" , etc and as well as separate business logic from presentation (html).

  • @Alpha-c3q
    @Alpha-c3q 9 หลายเดือนก่อน

    ❤❤❤

  • @seanjager6069
    @seanjager6069 ปีที่แล้ว +2

    Can u make a video about your membership, like what can i when i have a membership=

    • @Dani_Krossing
      @Dani_Krossing  ปีที่แล้ว

      Members have access to my lesson notes, as well as the option to download my lesson videos for offline use. 🙂 As well as simply support what I do here on TH-cam, to help me continue to make lessons.

    • @seanjager6069
      @seanjager6069 ปีที่แล้ว +1

      @@Dani_Krossing Legend, wednesday i join your membership! I like ur videos about HTML & CSS i learn more then at school. thank you very much!!!

  • @1stopmotivation1
    @1stopmotivation1 ปีที่แล้ว +2

    first woohoo!
    nvm i'm second 😢

  • @KAREKINFPV
    @KAREKINFPV ปีที่แล้ว

    Would you say it's dangerous after following these precautions to use a user "role" passed through session to identify which part of a multi_auth a user has access to? if so I can't think of another way to do it. I'd love your input.

  • @basilistigris640
    @basilistigris640 ปีที่แล้ว

    like that you make Procedural PHP series for 2023, i wish you make a real world projects with Procedural PHP and vanilla js, i am so tired of try to learn complex frameworks, and OOP MVC, etc, where to find something is split inside files inside files.... Thank you!

    • @Dani_Krossing
      @Dani_Krossing  ปีที่แล้ว +3

      Procedural PHP is always great for learning the fundamentals thoroughly 🙂 it’s just important to remember, that it isn’t practical to use PHP procedurally in real life projects, unless we are talking about just implementing a very basic feature.
      So if a person just wants to learn PHP for their own sake, then Procedural is great. But professionally, it is mandatory to learn OOP PHP, as well as at least one framework. 🙂

  • @normbograham
    @normbograham ปีที่แล้ว +2

    One trick, is not to use the sessions as you've defined. Meaning, create two or three hidden keys, which define the current session, which will eventually expire.

    • @RMadaraPlay
      @RMadaraPlay 10 หลายเดือนก่อน

      How to do that?

    • @normbograham
      @normbograham 10 หลายเดือนก่อน

      @@RMadaraPlay Let the backend maintain the "session", by keeping some keys, defining the session, in a db, or even text files. Then have other sessions, or a cron job define when the session is up, and go delete the keys. The front end, gets the keys, via hidden fields. Therefore, you can also have finer control, even controlling how many sessions a user can have, etc. Or assert that the user has actually gotten somewhere validly.

    • @RMadaraPlay
      @RMadaraPlay 10 หลายเดือนก่อน

      @@normbograham lot of words I don't understand, I'm a beginner on PhP, a shame Dani doesn't make videos anymore

  • @adrianf.5847
    @adrianf.5847 2 หลายเดือนก่อน

    First of all, that's not at all a bad video. A small remark would be that session_regenerate_id a priori should only be called at the authentication transitions (for else an attacker may also lock the real user out) and possibly periodically, and I don't think it influences the complexity of the actual session ID itself, but only makes a new one.
    Don't hurt me dude!

    • @adrianf.5847
      @adrianf.5847 2 หลายเดือนก่อน

      I haven't tried it, but in theory ini_set('session.sid_length', 256); should do.

  • @isyrafismail7801
    @isyrafismail7801 หลายเดือนก่อน

    Hi Dani I just become the member for your youtube channel to get the material but I can't find it. Do I need to do patreon instead?

  • @mentarioallen572
    @mentarioallen572 ปีที่แล้ว

    11:02 hey there, if i use these security configurations, do i have to fire them again when i want to use session information from a php file called by ajax?

  • @olgala2023
    @olgala2023 ปีที่แล้ว

    🥰

  • @Escko
    @Escko 5 หลายเดือนก่อน

    will this file run each time the page opens or is refreshed? in other words, this code will refresh the session id every 30 minutes, but only if the page is refreshed? Thanks in advance.

  • @anusharajendra389
    @anusharajendra389 7 หลายเดือนก่อน

    Did not understand how this config page will be triggered I mean for the session id to be regenerated after certain interval of time, it must be checked multiple times right? Like once the if condition fails, we should come back after certain time right and how are we coming back? Who is making sure to trigger the config file ?

    • @RaymondWade
      @RaymondWade 6 หลายเดือนก่อน +1

      It triggers every time the user visits any page (assuming you included it on every page). So if a person doesn't visit for 6 months, as soon as they do . . . the page will trigger the math and regenerate. If a user is on your page for an hour (clicking around) as soon as the time is up, it will trigger regenerating their id.

    • @Escko
      @Escko 5 หลายเดือนก่อน +1

      @@RaymondWade Was just looking for this same answer. Thanks for taking the time to explain. Much love.

  • @enryunto8087
    @enryunto8087 ปีที่แล้ว

    Does this also apply when php is only an api ? Context: i have to make request to the backend in php, but me front-end is nextjs, session id comes from php, but cookie management is from nextjs, is that alright ?

  • @WilliamAlex
    @WilliamAlex ปีที่แล้ว

    I shaved my head like you 😁

  • @Gonga94tz
    @Gonga94tz 10 หลายเดือนก่อน

    Kutokea Tanzania nimeelewa vyema

  • @felipepena4081
    @felipepena4081 ปีที่แล้ว

    Laravel already use all of that?

    • @dragansimeunovic4176
      @dragansimeunovic4176 8 หลายเดือนก่อน

      Yes, Laravel has built-in functionality to protect sessions, which means you don't need to manually implement most of the example code. Laravel uses the Laravel Session component for session management, which offers the following features:
      CSRF protection: Laravel automatically generates and validates a CSRF token for all forms, which prevents CSRF attacks.
      Session encryption: Laravel encrypts session data, preventing unauthorized reading.
      Access restriction: Laravel allows you to define which users have access to sessions and configuration settings.
      Adjustable session duration: Laravel allows you to set session duration and auto-timeout.
      Session ID regeneration: Laravel offers easy session ID regeneration, which helps prevent session hijacking.
      In addition to the built-in functionality, Laravel also offers a number of packages and tools to further improve session security, such as:
      Laravel-Session-Hijacking-Prevention: Additional protection against session hijacking.
      Laravel-Secure-Sessions: Extended functionality for securing sessions.
      In short, Laravel offers comprehensive session protection and does not require manual implementation of most of the example code. Using the packages and tools available in the Laravel ecosystem can further improve the security of your sessions.
      Additional notes:
      Laravel uses the config/session.php file to configure sessions.
      Laravel automatically loads configuration files, so you don't need to use require_once.
      Laravel also offers a number of helper functions for working with sessions, such as session(), auth(), csrf_token().

    • @Escko
      @Escko 5 หลายเดือนก่อน

      @@dragansimeunovic4176 That sounds amazing. As a new PHP dev I am going to have to stay away from Laravel for a while so I can get a better grasp on how things work in the background.

  • @margaretfloyd5405
    @margaretfloyd5405 ปีที่แล้ว

    'promo sm'

  • @macarthyeyimofe820
    @macarthyeyimofe820 ปีที่แล้ว

    im already lost 🤨