Complete OOP PHP Login Registration System & Logout Login Session | Object Oriented PHP Tutorial

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024

Комментарии • 61

  • @shebajournal
    @shebajournal Год назад +3

    WOWW this the best php tutorial ive got keep it up broo , perfect

    • @DavidGTech
      @DavidGTech  Год назад +1

      Hey Simon],
      Thank you so much for your kind words and support! I'm thrilled to hear that you found the PHP tutorial helpful and that you enjoyed it. Your encouragement means a lot to me, and it motivates me to keep creating more valuable content for you and others.
      If you have any specific topics or requests for future tutorials, feel free to let me know. I'm always looking to provide content that helps my viewers succeed in their programming journey.

  • @hoorhazem6414
    @hoorhazem6414 5 месяцев назад +1

    Thank Youuuu❤❤❤

    • @DavidGTech
      @DavidGTech  4 месяца назад

      Hi @hoorhazem6414,
      You're welcome! ❤❤❤ So glad you found it helpful!

  • @stefanambrus6190
    @stefanambrus6190 2 года назад +2

    Hello , great tutorial! I just got one question , i did everything like you , checked twice , my registration data is not showing in database. How should i check for errors ? Thanks

    • @DavidGTech
      @DavidGTech  2 года назад +2

      Make sure that your database and table name is same with database name in your php connection

    • @truegenesis2790
      @truegenesis2790 Год назад +1

      having the same problem how did you fix it?

    • @DavidGTech
      @DavidGTech  Год назад +1

      Hello,
      I'm sorry to hear that you're facing an issue with the registration data not showing in the database. Let's try to figure out what might be causing this problem. Here are some troubleshooting steps you can follow:
      - Double-check the Database Connection:
      Ensure that your PHP script has the correct database connection credentials, such as the database host, username, password, and database name. A typo or incorrect information in the connection settings can prevent data from being stored in the database.
      - Verify Form Submission:
      Check if the registration form is submitting the data correctly to the PHP script. You can add some debugging code at the beginning of the PHP script to see if it receives the form data. For example:
      - Error Handling:
      Implement error handling in your PHP script to catch any potential errors or exceptions that might be occurring during the database insertion process. You can use try and catch blocks to capture and log any errors that happen during the database operation.
      - Table Structure and Columns:
      Ensure that your database table has the correct structure and columns to store the registration data. For example, make sure there are columns for the username, email, password (hashed), etc.
      Please go through these steps, and if you encounter any specific errors or issues, let me know, and I'll be more than happy to assist you further. Also, make sure you have followed all the steps in the video correctly to set up the registration process.

  • @yotsusan_machi
    @yotsusan_machi 2 года назад +1

    Saran bang mending pake static function aja biar rapi contoh
    Class db{
    Static function insert(){}
    }
    Cara Panggilnya
    db::insert();
    Jadi gak perlu capek capek buat objek dari classnya lebih praktis dann efisien . .. jadi mirip sama framework laravel (route::get();)

    • @DavidGTech
      @DavidGTech  2 года назад

      Sip, makasih banyak info dan sarannya, nanti saya akan pelajari lebih lanjut tentang static function. Thank you 🙏🏼

  • @skanderlandolsi6182
    @skanderlandolsi6182 Год назад +1

    Hello , thanks for the video but how to make log in work with admin and user , i have table in database with user role either admin or user and i want the admin to login in other page and user in other page aswell how to do that ?

    • @DavidGTech
      @DavidGTech  Год назад

      Hi there! I'm glad you found the video helpful. To create a login system with separate pages for admin and user, you will need to first create a login form where users can enter their credentials (username and password) to log in.
      Next, you will need to create a session variable upon successful login, which will store the user's role (either "admin" or "user") in the database. You can then use this session variable to control access to different pages.
      To create separate pages for admin and user, you can use PHP (or another backend language) to check the user's role in the session variable and redirect them to the appropriate page based on their role.

  • @mahirmesanovic7822
    @mahirmesanovic7822 2 года назад +1

    thx bro great video

    • @DavidGTech
      @DavidGTech  Год назад

      You're much welcome! Thanks for watching!!!

  • @vladtul4606
    @vladtul4606 2 года назад +1

    Hello. Thank you for the lesson. There is only one question. How can I implement and apply password hashing in this script. For example password_hash

    • @dawnstar24
      @dawnstar24 Год назад +1

      Hello. You can use packages for that. There's a md5 function in php that encrypts passwords. You can also use google to find functions for hashing or use your own.

    • @CodeBroRob
      @CodeBroRob Год назад +1

      @@dawnstar24 md5 depricated long ago!
      use password_hash instead

    • @DavidGTech
      @DavidGTech  Год назад

      Hello @vladtul4606,
      Thank you for watching the tutorial and for your question! Implementing password hashing is an essential security measure in any login registration system, and I'm glad you brought it up.
      To apply password hashing in your PHP script, you can use PHP's built-in password_hash() function to securely hash the user's password before storing it in the database. When a user attempts to log in, you can then use password_verify() to compare the hashed password in the database with the entered password.

  • @harvey8695
    @harvey8695 10 месяцев назад

    could you pass the $_POST global to the registration class rather than passing each field? Any drawbacks to doing that?

    • @DavidGTech
      @DavidGTech  9 месяцев назад +1

      Hi @harvey8695,
      That's an interesting idea! While you can pass the entire $_POST global to the registration class, there are a few things to consider:
      - Encapsulation and Dependency:
      Passing the entire $_POST may expose more data than necessary to the registration class. It could break encapsulation and create a tighter coupling between the registration logic and the global request data.
      - Security Concerns:
      Depending on the implementation, passing the entire $_POST might expose sensitive information or allow unwanted data manipulation. It's crucial to validate and sanitize input data, and passing only the required fields can be a security best practice.
      - Flexibility and Maintenance:
      By passing individual fields explicitly, you have more control over the registration process. It can make the code more maintainable and flexible, especially when dealing with changes in the future.
      - In the end, the decision depends on your specific use case and design preferences. If your registration class can handle the $_POST data securely and without sacrificing maintainability, it might be a valid approach.
      Thanks for the suggestion! Feel free to share your thoughts or any further questions you might have.

  • @deekshaca003
    @deekshaca003 11 месяцев назад +1

    Thank u

    • @DavidGTech
      @DavidGTech  11 месяцев назад

      You're very welcome!

  • @mariomoa36
    @mariomoa36 2 года назад +1

    Ijin tanya bang..sy sdh mengikuti tuturial seperti video tersebut..sy mengalami kendala dalam file function.php erornya seperti ini bang :
    Warning : mysqli_connect() expects parameter 5 to be int, string given in...
    Apakah ada solusinya ya bang..makasih🙏

    • @DavidGTech
      @DavidGTech  2 года назад

      Ada yang salah berarti di koneksi databasenya mysqli_connect(), coba copas dari sourcenya aja dah langsung yang ada di deskripsi 🙏

    • @mariomoa36
      @mariomoa36 2 года назад +1

      Baik bang..makasih

    • @DavidGTech
      @DavidGTech  2 года назад

      Sama2 :)

  • @anandaganesha1966
    @anandaganesha1966 2 года назад +1

    Mantp bang

  • @dimasvigiarta
    @dimasvigiarta 2 года назад +1

    Fatal error: Uncaught ArgumentCountError: Too few arguments to function Login::login(), 0 passed in C:\xampp\htdocs\WEBL\tugas kelompok\New folder\login.php on line 8 and exactly 2 expected in C:\xampp\htdocs\WEBL\tugas kelompok\New folder\function.php:40 Stack trace: #0 C:\xampp\htdocs\WEBL\tugas kelompok\New folder\login.php(8): Login->login() #1 {main} thrown in C:\xampp\htdocs\WEBL\tugas kelompok\New folder\function.php on line 40
    gitu erornya bang mohon bantuannya
    🙏

    • @DavidGTech
      @DavidGTech  2 года назад

      Kayanya kamu ada nulis kode yang salah/kurang. Coba pakai source code yang ada di deskripsi video dah

    • @dimasvigiarta
      @dimasvigiarta 2 года назад

      @@DavidGTech udah bang udah aku copy paste

    • @DavidGTech
      @DavidGTech  2 года назад

      Ok, tunggu yah, nanti bakal saya coba dengan source code yang saya berikan

    • @DavidGTech
      @DavidGTech  2 года назад

      Saya tadi udah coba sih dan hasilnya bisa, sama sekali tidak ada error seperti yang ada di video

  • @simowndynasty6648
    @simowndynasty6648 Год назад

    THANK YOUUU

    • @DavidGTech
      @DavidGTech  Год назад

      You're welcome! Thanks for watching...

    • @s.paavai29
      @s.paavai29 9 месяцев назад

      Log in form error varuthu

  • @Douglas-Heffernan
    @Douglas-Heffernan Год назад

    2022 and u still use mysqli. no router no templatesystem no models no controllers and redundant code. thats not the power of oop. try it again

    • @DavidGTech
      @DavidGTech  Год назад +1

      Hello @doug7432,
      Thank you for taking the time to watch my video and share your feedback. I appreciate your input, and I'm always open to constructive criticism to improve my content.
      I understand your concern about using mysqli and the absence of certain advanced features like a router, template system, models, and controllers. You make valid points, and I completely agree that there are more sophisticated approaches to building PHP applications.
      The purpose of this video was to introduce beginners to OOP concepts in PHP and provide a foundation for understanding how to create a basic login registration system using OOP principles. I aimed to keep the code simple and easy to grasp for learners who might be new to object-oriented programming.
      However, I completely acknowledge that PHP has evolved, and there are more advanced frameworks and design patterns available to create robust applications. As a creator, my goal is to continue improving and exploring new topics, including implementing more advanced concepts in future tutorials.
      To address your concerns and deliver more comprehensive content, I'll take your feedback into account and consider creating videos that delve into modern PHP frameworks, advanced design patterns, and best practices for building scalable applications.
      Once again, thank you for your feedback. Your input helps me understand what my viewers are interested in, and it motivates me to provide even better content in the future.
      If you have any specific topics or suggestions for future tutorials, please feel free to share them, and I'll do my best to incorporate them into my upcoming videos.

  • @yotsusan_machi
    @yotsusan_machi 2 года назад +1

    Aki sudah buat source crud php mysql pake static function bang kalo berminat bisa download source codenya di website ku

  • @saran_decoder
    @saran_decoder 2 года назад +2

    Bro Your Code is This Error Bro-----------> Uncaught ArgumentCountError: Too few arguments to function Login::login(), 0 passed in C:\xampp\htdocs\photogram\signin.php on line 11 and exactly 3 expected in C:\xampp\htdocs\photogram\libs\includes\User.class.php:40 Stack trace: #0 C:\xampp\htdocs\photogram\signin.php(11): Login->login() #1 {main} thrown in C:\xampp\htdocs\photogram\libs\includes\User.class.php on line 40

    • @DavidGTech
      @DavidGTech  2 года назад

      Actually, there is no error, maybe in your code there are some missing codes in your code. Download the source code (link in the description)

    • @saran_decoder
      @saran_decoder 2 года назад +1

      @@DavidGTech no bro i try your code is error please send your instagram or telegram @username i send screenshot and video proof bro please reply bro

    • @DavidGTech
      @DavidGTech  2 года назад

      Instagram => @davidgrcias

    • @saran_decoder
      @saran_decoder 2 года назад +1

      @@DavidGTech bro i am dm you

    • @saran_decoder
      @saran_decoder 2 года назад +1

      @@DavidGTech come to instagram online

  • @hungvuongdinh9120
    @hungvuongdinh9120 2 года назад +1

    please give me the code

    • @DavidGTech
      @DavidGTech  2 года назад +1

      Source code in the description of video

  • @user-ui4ph6pj9i
    @user-ui4ph6pj9i 2 года назад +1

    Tu vivi nell aria

  • @coderswat
    @coderswat Год назад +1

    Bro your Instagram page showing invalid please give your new id

    • @DavidGTech
      @DavidGTech  Год назад

      I temporarily deactive my Instagram account due to I've got a lot going on

    • @coderswat
      @coderswat Год назад

      @@DavidGTech 🥲🥲

    • @DavidGTech
      @DavidGTech  Год назад

      Just give your Instagram username, I will follow you after I activate my Instagram back, thanks!

  • @letswritecode2372
    @letswritecode2372 2 года назад +2

    thank you

    • @DavidGTech
      @DavidGTech  2 года назад

      You're welcome!!! Thank you for watching...