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

UPDATED VIDEO LINK HERE: • How To Create A Login ...
In this PHP tutorial you will learn how to create a login system in PHP from, and how to show content after being logged in. You will also learn about error handlers, and MySQLi databases, which includes how to make a login form and a signup form.
I am aware that this is a very long video, but I promise it will be one of the easiest guides you will ever find on how to create a login system from scratch!
If you get any errors during this tutorial, make sure to check out my solutions at the very bottom of this description! :)
➤ IMPORTANT YOU READ THIS!
In this video I allow users to log in using either their e-mail or username. Because of this we run into an issue later.
If a user tries to sign up with multiple accounts using the same e-mail then our script gets confused when we try to log in using our e-mail because we have many users with the same e-mail in our database. However this is VERY easy to fix!
To fix this, remove the part of the "login script" where we check the database for a username AND e-mail, and instead make sure we ONLY check for the username. Do this in both the SQL statement AND the prepared statement function called mysqli_stmt_bind_param().
The SQL statement should say:
$sql = "SELECT * FROM users WHERE uidUsers=?;";
And the function should say:
mysqli_stmt_bind_param($stmt, "s", $mailuid);
➤ LINKS
Install XAMPP & a local server: • 2: Installing A Local ...
Regular expressions (search patterns): • 59: Functions Using Re...
PHP Password Recovery System: • How To Create A Forgot...
➤ CHAPTERS
(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
➤ 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 :)
Material for this lesson: / lesson-material-42361704
➤ ERRORS YOU MIGHT RUN INTO!!!
▸"signup=empty"
Make sure you wrote "mysqli_connect" and NOT "mysql_connect" in the dbh.inc.php file!
▸"unexpected }"
If you get this error message:
Parse error: syntax error, unexpected '}'
Then it is because you forgot to close a ) or ; somewhere.
▸"unexpected ;"
If you get this error message:
Parse error: syntax error, unexpected ';'
Then it is because you forgot to close a } or ) somewhere. Probably because you made a mistake with your parenthesis near the "empty()" functions in your signup script.
▸"hashed pwd error"
If you get an error in the script when you hash the password, then it is because you decided not to follow my steps exactly in the video when I created the database table. Make sure you DON'T set the varchar() to a lower value! When you hash the password it will take up a lot of space in this column, and if you set a lower number then it won't fit!
▸"signup=success but database is empty?"
Here there might be a few reasons for your error. 1st is that you made a syntax/spelling mistake in your code. And yes you will claim that your code is identical to mine, but in 90% of the cases people claim this, I still find a syntax error in their code. So check your code for errors!
2nd reason is that MAMP seems to cause a lot of issues for people. Therefore try using XAMPP and make sure you write the same as me in the dbh.inc.php file.
3nd reason might be because you didn't follow the tutorial 100% when we set up the database at the beginning.
▸"HTTP ERROR 500"
HTTP ERROR 500 is a server error, meaning that you are most likely using an outdated version of apache or mysql. Try updating your servers and make sure that you are using the latest version of PHP.

Пікірлер: 2 800

  • @Dani_Krossing
    @Dani_Krossing5 жыл бұрын

    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 KZreadrs 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 жыл бұрын

    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 жыл бұрын

    Hi Jim, here is the link for that video I mentioned :) kzread.info/dash/bejne/mIGI2MtsgtzZXdI.html

  • @InfiniteThrees

    @InfiniteThrees

    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 жыл бұрын

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

  • @NewtonCazzaro

    @NewtonCazzaro

    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
    @demliquids93815 жыл бұрын

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

  • @Dani_Krossing

    @Dani_Krossing

    5 жыл бұрын

    Thanks :)

  • @bitmammothOG

    @bitmammothOG

    4 жыл бұрын

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

  • @techcanyon411

    @techcanyon411

    4 жыл бұрын

    @@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

    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

    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_Krossing5 жыл бұрын

    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

    5 жыл бұрын

    Thank you very much. Well done.

  • @alphagaming1995

    @alphagaming1995

    5 жыл бұрын

    Please make a video on Forget password in php

  • @yasmeentahir5842

    @yasmeentahir5842

    5 жыл бұрын

    Thankyou Very much

  • @BarnabyPerrinAldous

    @BarnabyPerrinAldous

    5 жыл бұрын

    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!

  • @DR9Productions

    @DR9Productions

    5 жыл бұрын

    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!

  • @oscarmartinlive
    @oscarmartinlive4 жыл бұрын

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

  • @bwf1046
    @bwf10463 жыл бұрын

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

  • @fluffyfetlocks
    @fluffyfetlocks5 жыл бұрын

    Finally, someone posted a well crafted login system guide that actually explains something. Allot of guides out there say "copy paste this" and then it is difficult to to troubleshoot. They often dont work too as they are for php5

  • @whiteavem5438

    @whiteavem5438

    5 жыл бұрын

    yes!!! exactly

  • @alexandertrists3965

    @alexandertrists3965

    4 жыл бұрын

    this IS difficult to troubleshoot! please see my comment to mmtuts $5 post.

  • @thatminivan
    @thatminivan5 жыл бұрын

    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.

  • @NoxaDreshar
    @NoxaDreshar4 жыл бұрын

    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.

  • @noumansyed5968
    @noumansyed59684 жыл бұрын

    (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

  • @erissanorma5891

    @erissanorma5891

    3 жыл бұрын

    thanks for the link!

  • @g-shubham

    @g-shubham

    3 жыл бұрын

    Thanks !!

  • @evan.5967

    @evan.5967

    3 жыл бұрын

    it's in the desc lmfao

  • @iconsworld9

    @iconsworld9

    2 жыл бұрын

    nice paying maxiumum attention.

  • @7Mirino
    @7Mirino5 жыл бұрын

    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
    @Brrrndy5 жыл бұрын

    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!

  • @NanoStudio9
    @NanoStudio94 жыл бұрын

    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!

  • @GeorgeBrotherston
    @GeorgeBrotherston4 жыл бұрын

    I am relatively new to PHP, and found your courses via a KZread 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 :/

  • @Mr_Simmons
    @Mr_Simmons5 жыл бұрын

    You my friend are a saving grace! I'm so glad that your making an updated version of logins, and I'm really looking forward to the OOP login tutorial. I'm very slowly going through your OOP playlist to help me with a project, and then at some point you will come up with an OOP login version. Awesome! Also, I don't mind the long videos, in fact a actually prefer them to one subject split up into mutable videos. I guess for me its easier to go through something in one go. Keep up the good work! Excited for the future!

  • @LayKxD
    @LayKxD4 жыл бұрын

    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.

  • @AbdellahRamadan
    @AbdellahRamadan4 жыл бұрын

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

  • @SCHNEE666
    @SCHNEE6664 жыл бұрын

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

  • @besz2189

    @besz2189

    4 жыл бұрын

    haha same here :D

  • @mounir101
    @mounir1015 жыл бұрын

    Your voice is great and very clear.

  • @0596sami

    @0596sami

    5 жыл бұрын

    As always

  • @Osuna2024
    @Osuna20244 жыл бұрын

    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.

  • @victoriagn5934
    @victoriagn59344 жыл бұрын

    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:))

  • @absterexe
    @absterexe5 жыл бұрын

    Thanks mmtuts ! GET THIS GUY A MILLION OF SUBS.

  • @Wakssbm
    @Wakssbm4 жыл бұрын

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

  • @ricardocosta5628
    @ricardocosta56283 жыл бұрын

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

  • @ruthogadina757

    @ruthogadina757

    3 жыл бұрын

    same 😂

  • @diahooh
    @diahooh3 жыл бұрын

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

  • @gosavva1
    @gosavva15 жыл бұрын

    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.

  • @Scobb447
    @Scobb4475 жыл бұрын

    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 жыл бұрын

    changed that and still getting empty fields error

  • @uvebgns8224

    @uvebgns8224

    4 жыл бұрын

    thank you !!

  • @sed10001

    @sed10001

    4 жыл бұрын

    Thanks a lot!

  • @newyorkonmusic8401

    @newyorkonmusic8401

    4 жыл бұрын

    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 жыл бұрын

    thank you man

  • @benjaminibok8003
    @benjaminibok80033 жыл бұрын

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

  • @saranghaeyo.carvz.
    @saranghaeyo.carvz.2 жыл бұрын

    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!

  • @camilabooth7397
    @camilabooth73974 жыл бұрын

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

  • @jakobkmar
    @jakobkmar4 жыл бұрын

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

  • @Maths4Everyone
    @Maths4Everyone4 жыл бұрын

    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.

  • @majidnafarabad7311
    @majidnafarabad73114 жыл бұрын

    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.

  • @angelrico640
    @angelrico6405 жыл бұрын

    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.

  • @bankoleemmanuel1088
    @bankoleemmanuel10885 жыл бұрын

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

  • @jamesoneill6183
    @jamesoneill61834 жыл бұрын

    I'm a bit late finding this and commenting, but thank you so much for making these videos, the fact that you've put this up for free is crazy, you've helped myself and thousands of others immensely. Thank you!

  • @danielmadison4451
    @danielmadison44514 жыл бұрын

    Fantastic job! Your English is great, charming and precise. I followed the whole thing and now have a great development system ready for coding. Thanks.

  • @mounir101
    @mounir1015 жыл бұрын

    Thank you a lot for this episode, Sir, it was a long episode but that's good it's really helpful. I appreciate your efforts.

  • @poorboy2400
    @poorboy24005 жыл бұрын

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

  • @besz2189
    @besz21894 жыл бұрын

    The very first tutorial video that actually helped me a lot! Thank you! You now have a new subscriber. Keep it up!

  • @mohibqureshi391
    @mohibqureshi3913 жыл бұрын

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

  • @tysonhamada6527
    @tysonhamada65275 жыл бұрын

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

  • @per1sher
    @per1sher4 жыл бұрын

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

  • @jorgetonos
    @jorgetonos4 жыл бұрын

    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.

  • @MoultonRock
    @MoultonRock4 жыл бұрын

    Excellent work mate. You are one of the best code teachers I've ever watched! You increased my understanding so much! Thank you! Keep up the great work!!

  • @farhadboy629
    @farhadboy6294 жыл бұрын

    This guy will make me an entrepreneur

  • @lepystudio8974

    @lepystudio8974

    4 жыл бұрын

    Coder maybe

  • @tr0uge962
    @tr0uge9625 жыл бұрын

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

  • @revwhyte

    @revwhyte

    5 жыл бұрын

    You're not wrong XD

  • @karmanetworkit6787

    @karmanetworkit6787

    4 жыл бұрын

    ahahaahahhahah

  • @teacuptea9155

    @teacuptea9155

    4 жыл бұрын

    Why did I find this funny lol

  • @Haider-ol7jr

    @Haider-ol7jr

    3 жыл бұрын

    Tr0uge what a 5 head move haahaha

  • @someoneontheinternetuvenev6268

    @someoneontheinternetuvenev6268

    3 жыл бұрын

    Lol dude

  • @willkelly2783
    @willkelly27834 жыл бұрын

    Thank you so much!!! It’s incredible that such high-quality content is avails for free, and the best thing is, it actually works!!!

  • @InferiPlasma
    @InferiPlasma4 жыл бұрын

    All this info in a single well-made video, thanks a lot man! You're great!

  • @didierdelay6623
    @didierdelay66235 жыл бұрын

    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"

  • @ExtraKanin
    @ExtraKanin5 жыл бұрын

    so underrated. i love you i learned so much brb gonna subscribe to my first patreon ever

  • @Sanddaisydiary
    @Sanddaisydiary2 жыл бұрын

    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.

  • @jawsstech
    @jawsstech4 жыл бұрын

    EXCELLENT TUTORIAL. This episode is EXACTLY what I needed. You have a mastery of explanations that simultaneously clear and engaging. The video and sound quality exceeded expectations. I was always interested in coding and spent some time looking at the JavaScript, but you alone made me a fan of PHP. I am going to spend a lot of time watching and liking this content. GREAT JOB!

  • @hasanajami7653
    @hasanajami76535 жыл бұрын

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

  • @sipofbruno6611
    @sipofbruno66114 жыл бұрын

    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 :/

  • @estevaobutilheiro
    @estevaobutilheiro3 жыл бұрын

    Thanks for giving this for free. Really quality content and really easy to understand. Its a bit long but its because you explain it in detail, which makes it perfect. Thanks King!

  • @androidmod183
    @androidmod1832 жыл бұрын

    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

  • @hersonbalisi4075
    @hersonbalisi40754 жыл бұрын

    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=?"

  • @MrShadyKiller
    @MrShadyKiller5 жыл бұрын

    I really like your videos! 🧔

  • @charliesmith8309
    @charliesmith83093 жыл бұрын

    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 !! :]

  • @woohootunes
    @woohootunes4 жыл бұрын

    this is an incredibly articulated tutorial! thank you for all the work you've done.

  • @bogdaniagar9431
    @bogdaniagar94315 жыл бұрын

    I love your videos. when you gonna do a complete login, register video for user and admin?

  • @paulgarcia2887
    @paulgarcia28874 жыл бұрын

    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.

  • @paulsonstechpoint773
    @paulsonstechpoint7733 жыл бұрын

    This video made my day and gave you a subscriber! So well explained and your voice is so crisp and clear that I understood everything. Thanks for this video.

  • @camuflagehugo5137
    @camuflagehugo51372 жыл бұрын

    Thank you Dani! I cannot believe that I have built a working login system after following along:) :)

  • @maddragonfurs6358
    @maddragonfurs63583 жыл бұрын

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

  • @JimfromIndy
    @JimfromIndy5 жыл бұрын

    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

    5 жыл бұрын

    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

    5 жыл бұрын

    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

    5 жыл бұрын

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

  • @angelshallom6781

    @angelshallom6781

    5 жыл бұрын

    @@brantedselnemiada4956 where should this code be placed?

  • @brantedselnemiada4956

    @brantedselnemiada4956

    5 жыл бұрын

    @@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(); }

  • @christopher7540
    @christopher75404 жыл бұрын

    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

  • @edwardkiarie2860
    @edwardkiarie28603 жыл бұрын

    You are my "HERO". 💪You taught me alot of stuff school will never teach me.

  • @amasnur79
    @amasnur794 жыл бұрын

    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 жыл бұрын

    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

  • @sebastian993
    @sebastian9934 жыл бұрын

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

  • @arzfiring3331

    @arzfiring3331

    4 жыл бұрын

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

  • @parthip998

    @parthip998

    3 жыл бұрын

    @@arzfiring3331 Same 😁

  • @bowiemtl
    @bowiemtl4 жыл бұрын

    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!

  • @farisdelic4
    @farisdelic44 жыл бұрын

    This is the best tutorial I have ever seen on youtube. Well done and thank you very much!

  • @georgelopez9356
    @georgelopez93564 жыл бұрын

    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!

  • @revanslacey
    @revanslacey4 жыл бұрын

    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 жыл бұрын

    Amusing...

  • @akachi1637

    @akachi1637

    3 жыл бұрын

    That is 4gb of password!!!!!

  • @haziqsontkraken1246

    @haziqsontkraken1246

    3 жыл бұрын

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

  • @nikaellas.6814
    @nikaellas.68143 жыл бұрын

    thank you. love how clear this tutorial is ❤️ and also it kept me watching till the end without any skips at all!

  • @mamineboudemagh12
    @mamineboudemagh124 жыл бұрын

    i really didn't expect to learn so much am so amazed of how much detailed this video is . thank you so much

  • @flaasher
    @flaasher5 жыл бұрын

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

  • @nmrisrl11

    @nmrisrl11

    5 жыл бұрын

    Ali Saleh Good suggestion.

  • @austingriner2773
    @austingriner27735 жыл бұрын

    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 жыл бұрын

    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 жыл бұрын

    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

  • @ameen.webdivers
    @ameen.webdivers4 жыл бұрын

    Thanks man I this the material we need when we have just sarted working on live projects

  • @afuwapedoyinsola844
    @afuwapedoyinsola844 Жыл бұрын

    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 🇳🇬❤

  • @78wesley67
    @78wesley675 жыл бұрын

    Your video's are awesome man. Keep it UP ! They are really helpful. but is this 100% secure ? are there no exploits in the code?

  • @method9706

    @method9706

    5 жыл бұрын

    someone will always find an exploit, but using prepared statements avoids most sql injection attacks, the other way is by configuring a firewall, but im not the best at explaining how to do that,

  • @Orincaby
    @Orincaby4 жыл бұрын

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

  • @privateger

    @privateger

    4 жыл бұрын

    Don't use it. Use PDO.

  • @OmnivorousOtter101

    @OmnivorousOtter101

    4 жыл бұрын

    dontquestionmyactions, why?

  • @privateger

    @privateger

    4 жыл бұрын

    @@OmnivorousOtter101 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.

  • @Stefan-lz1ph

    @Stefan-lz1ph

    4 жыл бұрын

    @@OmnivorousOtter101 Just read his username and everything here should be clear xD

  • @williamalesna5703

    @williamalesna5703

    4 жыл бұрын

    lol xD

  • @markedwards3780
    @markedwards37802 жыл бұрын

    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.

  • @ryanvictorotieno4231
    @ryanvictorotieno42313 жыл бұрын

    Thank you so much. Your tutorial was great easy to understand and highly professional even for a beginner. Bless!

  • @karansoni4429
    @karansoni44295 жыл бұрын

    Hey bro can u tell me the packages of ATOM you are using And what should i use for php development... Thank You.!

  • @Patrickalcerro

    @Patrickalcerro

    5 жыл бұрын

    I think he added the "autoclose-html" package available in the install section of Atom preferences.

  • @karansoni4429

    @karansoni4429

    5 жыл бұрын

    @@Patrickalcerro Ok i am having an issue with ATOM when i save the file as .php the "Tab" spacing doesn't work i have to manually give 4 spaces..

  • @samueliaconelli6943
    @samueliaconelli69434 жыл бұрын

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

  • @tokka2364
    @tokka23643 жыл бұрын

    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

  • @cookie2112
    @cookie21124 жыл бұрын

    Been using your vids to create a form. Not everything worked for me but i've learned a lot from them. Great material. Thanks

  • @fling2985
    @fling29855 жыл бұрын

    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 жыл бұрын

    Same. Anyone solved that?

  • @lightyagami3650

    @lightyagami3650

    4 жыл бұрын

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

  • @lightyagami3650

    @lightyagami3650

    4 жыл бұрын

    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!

  • @tommmmmer
    @tommmmmer4 жыл бұрын

    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

    3 жыл бұрын

    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
    @anonntsc52223 жыл бұрын

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

  • @CorporalKruger
    @CorporalKruger3 жыл бұрын

    Hey Mate. Just wanted to drop you a message to let you know how impressed I am in your tutorials and also the info you provide on Patreon! You have saved me plenty of time and hassle. Have just been through creating a login system.

  • @vahidor1540
    @vahidor15404 жыл бұрын

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

  • @crumbae1248

    @crumbae1248

    4 жыл бұрын

    You Should Keep $stmt Inside TheBrackets Of mysqli_stmt_get_result()

  • @logireloco123

    @logireloco123

    4 жыл бұрын

    or $stmt->get_result();

  • @michaltymburski8528
    @michaltymburski85285 жыл бұрын

    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 :)

  • @techcanyon411
    @techcanyon4114 жыл бұрын

    This is a wonderful tutorial and spending so much on it shows your wonderful intention and open-hearted to then-upcoming programmer's partisan.

  • @eugenedonato5688
    @eugenedonato56884 жыл бұрын

    I'm a big fan of your tutorials sir, just wanna say thank you for uploading such things.. you're helping a lot of people. : )

  • @photon2724
    @photon27245 жыл бұрын

    its a great experience getting taught by a young elon musk

  • @reistophmilkayr3215

    @reistophmilkayr3215

    4 жыл бұрын

    Yeah, dats why I kinda remember the face

  • @mrdark3903
    @mrdark39034 жыл бұрын

    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

  • @randomTVSWE

    @randomTVSWE

    4 жыл бұрын

    did you solve it?

  • @pgreenkawunga8943
    @pgreenkawunga89432 жыл бұрын

    Dani you are just amazing man, been watching and following your channel i have learnt more about php so easily. Thanks man you the best

  • @bipulhuge
    @bipulhuge4 жыл бұрын

    loved this video very much. High quality clean and clear PHP tutorial ever in youtube. love it