Registration, Password Encryption, Sessions - Part 4 | PHP MVC Framework from Scratch

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ก.พ. 2025

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

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

    Greetings from Kenya. Your are the best TH-cam Trainer in the Known universe

    • @TheCodeholic
      @TheCodeholic  4 ปีที่แล้ว

      Wow, thank you very much.

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

    Greetings from Bangladesh. Your are the best TH-cam Trainer in the Known universe

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

    Woop, Woop, part 4 and I'm really expressed by your knowlege. That's just great, you should do an Udemy course or something like that;)

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

      Thanks a lot buddy. I am thinking about Udemy course, Just I don't have time for that now

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

    Zura I'm really impressed by your knowledge, thank you for this great series. Understanding what is happening under the hood of these frameworks is so helpful.

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

      Thanks buddy

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

      @@TheCodeholic After a job interview I noticed my lack of php knowledge. Shortly after I found you roadmap and after working on it for a while I had to do another project for a job interview and I passed. They offered me a job and I'm already working as a dev. Thanks Zura!

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

      Wow...
      That's amazing.. Congrats to you buddy.
      You deserved it. Happy to hear that my roadmap helped people to get a job

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

    Hello! Your lessons are awesome! Thank You very much! Very actual and helpful information. Waiting for more lessons 😊

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

    thanks dude, probably the best curse i have ever seen.

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

    Great tutorial videos! I'm enjoying!!!!!

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

    Hello, I have two questions to ask you:
    - (Issue 1) At minute 21:10, why did you use self::class instead of $this::class?
    - (Issue 2) At minute 23:00, the tableName() method is not static, but why were you able to call it?

    • @NargisGasimli-qb1qv
      @NargisGasimli-qb1qv ปีที่แล้ว

      $this to refer to the current object. Use self to refer to the current class. In other words, use $this->member for non-static members, use self::$member for static members.

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

      In php 7.4 that was allowed, but it will not work in your version probably, so either yiu should make the tableName method static or use it with $this keyword.

  • @jordanbicanic9343
    @jordanbicanic9343 2 ปีที่แล้ว

    First of all great job, thank you for sharing your knowledge. I have a question. In 27:44 you are talking about redirecting to home page after user is successfully registered. Why not use render method with params?

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

    very modern php framework thank you Zura The Codeholic

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

    Hello Zura, great job! I'm really enjoying the video. However, whenever I try doing a var_dump($statement, $params, $attributes); as in 11:08 the $statement variable is showing up as NULL. Any ideas on why this is happening?

    • @NargisGasimli-qb1qv
      @NargisGasimli-qb1qv ปีที่แล้ว

      @user-ou3vl6ez9l Maybe you didn't provide
      public function getAttributes(): array
      {
      return ['firstname', 'lastname', 'email', 'password', 'status'];
      }
      in the User.php file

    • @Jayjwebdzine
      @Jayjwebdzine 11 หลายเดือนก่อน +1

      Thank you. I eventually found the error. There was a typo in one of the functions. Did not note which one but it was a missing arrow in this case.@@NargisGasimli-qb1qv

  • @benjaminlaunicke1256
    @benjaminlaunicke1256 2 ปีที่แล้ว

    "How ever ..." 😁 Thanks for sharing your knowledge dude!

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

    Greetings and thank you for this great series. I ran in some trouble with "Array and string offset access syntax with curly braces is no longer supported". As a workaround I added an array $values inside the Model class an stored the $data from loadData function in it. In the DBModel I changed the bindValue to: $statement->bindValue(":$attribute",$this->values[$attribute]); not really sure if this is a good solution or if it is safe. Feedback would be really nice. ANd maybe some tutorial about security, especially file uploads.

  • @anmarm.9487
    @anmarm.9487 2 ปีที่แล้ว

    finally decent tutorials. I learn alot. would you do a tutorial about creating a model with single base model with out active directory. your technique is too advance. Thank you

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

    thank you! it is great tutorial!

  • @topalek
    @topalek 4 ปีที่แล้ว

    Zura tnx a lot for your work. Keep going. Best wishes.
    p.s. where you learned english or how?

  • @АнтонВогусов
    @АнтонВогусов 2 ปีที่แล้ว

    Howdy! A question: after password_hash I have as many dots in input-password field as in hash string, but you still has the of inputted password in your input field. why?? thanx =)

    • @TheCodeholic
      @TheCodeholic  2 ปีที่แล้ว

      You probably assigned the hashed password back into the variable which outputs in the input field.

    • @АнтонВогусов
      @АнтонВогусов 2 ปีที่แล้ว

      ​@@TheCodeholic Thank you! Yes I did ) But I did it the same way you did. I see it in User class in save() method where $this->password = password_hash(...), so it goes to view from here, I guess. Should we use another property for password hash to save or what did I miss? =)

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

    Thanks. You are the best

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

    hey man how are you? really love your videos ... can you make videos on laravel .. it would be really helpfull...

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

      Thanks a lot. I definitely plan to make Laravel projects, but can not tell exactly when. But I will do...

  • @acespade4348
    @acespade4348 3 ปีที่แล้ว

    Sorry for the noob question Zura. But can you explain this line:
    $this->labels()[$attribute] ?? $attribute;
    I'm not sure about what's happening with the syntaxe here, after the call to labels() function, how are you adding the [$attribute] right after.
    Also, Thank you for this series 🙏

    • @ШейхМансур-и8ц
      @ШейхМансур-и8ц 2 ปีที่แล้ว +1

      it may be too late))) , but i will try to explain it. So he calls the function "labels" and it returns an array, after that he uses the key "$attribute" to take the value from this array.It is same as doing:
      $labels=$this->labels();
      return $labels[$attribute].

  • @1972PANI
    @1972PANI ปีที่แล้ว

    Hello, how are you, greetings. A few days ago I started this tutorial and I'm new to programming with PHP, I got this error: 'Fatal error: Uncaught Error: Call to a member function bindValue() on null in C:\xampp\htdocs\Proyectos-Canal-The -Codeholic-TH-cam\php-mcv-framework\core\DbModel.php:30' with the save() method of the DbModel.php file when trying to insert a record with the variable $statement->bindValue(":$attribute" , $this->{$attribute});. Any solution? Thank you.

  • @Gandobilis
    @Gandobilis 2 ปีที่แล้ว

    💫

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

    Nice tutorial

  • @geneartista9714
    @geneartista9714 4 ปีที่แล้ว

    Is it not safe to just use the execute when passing the values like
    pdo->execute(
    'firstname' => $firstname
    );
    and I hope that you`ll have a PHP Laravel tutorial

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

      No, it's not safe, Do no ever do that if you are inserting to database, or even if selecting, always bind it, to avoid sql injections. Imagine: you have a query like= pdo->execute(select * from users where id = $ID), in which the ID is 2 for example, so the injection can happen if a user inserted a value of like: 2 OR > 0. These will show all the users in table. This is a bad explanation, just search it.

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

      @@Akosiyawin thanks man that`s quite helpful

    • @jonasdidier7279
      @jonasdidier7279 4 ปีที่แล้ว

      @@geneartista9714 Darwin is wrong here, values of an array in the execute method are also sanitized for SQL. There are some minor differences (e.g. when you use an array, all values are passed as PDO::PARAM_STR). But for simple queries, it's a matter of preference really.

  • @rajabhishek2936
    @rajabhishek2936 4 ปีที่แล้ว

    Awosem dude

  • @AmitDas-yb3re
    @AmitDas-yb3re 4 ปีที่แล้ว

    At 23.04 How can we call a non-static method like a static method?

    • @NargisGasimli-qb1qv
      @NargisGasimli-qb1qv ปีที่แล้ว

      @AmitDas-yb3re It's Class not a object. For example User::tableName()
      You can call the class method directly

  • @hustlehustles9379
    @hustlehustles9379 2 ปีที่แล้ว

    Guys who faced the infinite action, look carefully, when Unset happens, it refers to the array and not to a specific cell of the array. I hope I can help someone, (half an hour of debugging)

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

    Session is not working

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

    Hi Zura! Great videos! I have a Warning that I can't find what is the issue even watched that video 3 times. I am sure I miss something small that I hope you can help me.
    edit:
    "error messages disappeared so I deleted them, I just cant see the message 'Thanks for registering' and
    at this code below, I am noticing that $key is grey out and says: "Unused local variable" at phpstorm. Thank you in advance!
    [code]
    public function __construct()
    {
    session_start();
    $flashMessages = $_SESSION[self::FLASH_KEY] ?? [];
    foreach ($flashMessages as $key => &$flashMessage) {
    $flashMessage['remove'] = true;
    }
    $_SESSION[self::FLASH_KEY] = $flashMessages;
    }
    [/code]

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

      Wow, same part as mine. Did you fix it?