Login system using PHP with MYSQL database
Вставка
- Опубліковано 18 вер 2015
- 🚀Download Complete blog Source Code for only $2: awamelvine.gumroad.com/l/blog...
✨ Get notified when I release my upcoming premium course: codingpoets.com/
In this login video, I create a users table with fields id, username, and password. Then I inserted a user whose credentials I used to log in.
UPDATE: User registration with email verification on localhost: goo.gl/nRADcM
Check out my other videos:
Learn how to build a complete blog with PHP and MySQL: goo.gl/Ru41Tw
Tips for Junior developers: • Practical tips for Jun...
💥🚀Download Complete blog Source Code for only $2: awamelvine.gumroad.com/l/blog-source-code
can I use this for android studio
Hi Awa. Checkout my tool Filly - it will make your coding & lessons even better: fill.ly
we can use www.pl61.fr to learn 2020
ua-cam.com/video/d1PdlScCVOo/v-deo.html
I learned more in 20 min with no chat than those 1hrs vid with guys talking a lot.... THANK YOUUU
Thank you! You exactly showed what I've been looking for after hours of searching! I went to almost every forum there is and no one even tried to explain this exact, "$result"-"$row" technique and the comparison from database to php-variables, to me. Very nice. You deserve a thumbs up ^^
'Screams internally' -me as a professional front end dev watching a back-end developer create html/css.
Just kidding, thank you for taking the time to make this video, it's been helpful.
Bro, my code don't work, could you help me...
Here is my code :
Login
Username:
Password:
@@zariaa3794 First its
not
there is no body tag in your code how will hit work??
it should be like
Login
Username:
Password:
@@zariaa3794 You should spend some more time in Html First, I was there, travers video are pretty good you can learn from it.
Im a backend developer and see no problem with this man's html/css. lol.
@@acos21 then you're a shitty back end dev then
Great instructional video!!
It took me some time to tweak the code to suit my existing database. This initially gave me a result of "Failed to query database No database selected" until I worked out that I needed to change "login" in Row 14 of process.php to my own database name.
As a starter in mysql and php, some voice-over would be helpful in explaining such things.
my database name is "login" although its giving me the same"Failed to query database No database selected"
Meenakshi Panyam maby the database isnt a localhost of urs?
This is one of the most depressing but productive video i have seen
he should have used the voice
This this video make you the depressed child that you are now?
#Rondytech on iG just got my ps4 account back in less than no time, I appreciate her good works 🙌🙌🙌🙌
Finally I found the best video on UA-cam
Thank you for taking the time do complete this video.. much appreciated.
Thanks to the author of this tutorial: I couldn't with other tutorials using mysql_num_rows.....and stuff.
:)
I really like his voice. It's so calm
I could not hear anything, issue with the video
@Just Sliqq hello I can not hear anything issue with the video, any fix?
@@user-md3nv8he7x Try refresh it, or connect to the bigger speaker in the basement. Special voice need special treatment
@@difanaufalpratama8765 hello I don't think this video has a sound I can hear on the other videos, thanks for the reply
@@user-md3nv8he7x oh wait so you are being serious? I thought you joking too. This video really dont have sound sir
most of the videos skip the process of creating cd: but after I hve watched this I understood one basic function that I had stuck for days great one
this tutorial just helped me a lot with my homework!
thanks steff!
ua-cam.com/video/d1PdlScCVOo/v-deo.html
Thanks for this video. Was exactly what I needed.
Please noooooooo! everything is bad drom this video!
The code worked for me.. Thank you !!
It worked well enough.. Perfectly working. Thanks a lot!
This code is insecure.
This was a very useful and helpful video understanding. Thank you so much for creating this one. keep it up and all the best.
I was searching for the movie "A Quiet Place 2". And then I found this.
LOL
Dont be shy buddy! Nothing can be worse than a tutorial without voice!
Hahaha I've grown out of my shyness. My recent videos now have voice.
Thanks by the way
@@AwaMelvine Awa you're best my friend .
THANKS A LOT! Helped me with our final project hahaha
Amazing Awa , lots I learned from ur tutorials best teacher style. I 😘 it
Thank you very much for this tutorial: Great!
Your tutorial is clearly showing how and where to create the files code and how to display them for testing in a browser, Well Done.
Nevertheless, there is a problem with error handling. I just tried to do a test by entering a wrong username and password to see the result. And then it created a big issue!
you have to forget everything from this video because its horrible, horrible and very horrible
is this the renaissance of janky 2008 youtube tutorials?
Only Missing NCS song ;-;
Thanks! Dude you saved my project :)
without saying a word... taught a great lesson...
ua-cam.com/video/d1PdlScCVOo/v-deo.html
This login is easy to bypass. If a empty post-body is sent, then it won't find a row in the database. This let $row['username'] be undefined, like $_POST['username'], too. So you're able to login with an empty post-request. There is also no reason for comparing the post with the databse result, because if the user / password - combination is invalid, then the database will find no row and the function mysql_num_rows() returns 0. Then some thinkings. It's a real good option to use PDO. Because the c-style mysql api is deprecaded and was removed in php 7. With PDO it's possible to use prepared statements for re-using queries and for letting the database escape the user input.
Good video, but pro-tip. Set it to playback 2x the original speed.
Bro! it's Amazing You slove my problem! Thanks!!!
Awesome video! Thank you.
Hey
Are the names correct you are using in $POST[' ']; statement."
as you have used user for $username and pass for $password in the form.
Please check and reply soon.
Thanks
Yaa bro it’s not correct I stucked there almost 40 min
why didn't u use MySQLI commands
and for what versions of php this code works
Thank You I got it to work because of you and a few changes
Much Appreciated Mate
didn't work :/, got an error on line 9 of process.php regarding the mysql_real_escape_string. Anyone know what to do?
mine too
@@trixiesherlacpregil4036 This is really late but his code is obsolete so eithier you downgrade your php version or you update the code yourself.
18 mins of silence...... in my life
you forgot ads
fuck off
@@gustavomeatto365 Gustav streesemann???
Jajajajajajaja
@@zhaoqinyin5480loooooooooooooooooooooool
Thanks for example. It was very sample and very useful
thank you and keep uploading more....
nice, but there is one very important issue. if you do not place any value and hit login button, the message is still 'Login successful!'. There is missing logic in php for this event.
Therefore:
$row = mysql_fetch_array($result);
if ($row["username"] == $username && $row["password"] == $password *_&& ("" !== $username || "" !== $password)_*) {
echo "Login successful! Welcome " . $row["username"];
} else {
echo "Failed to login!";
}
_===_ means *identical*, _!==_ means *not identical*
Thanks!
fixed by isset() and !empty() functions
yup you are correct man they have not done the proper validation.
Just add "required" in html input tags
kindly past below code. I have check its working fine
if($_POST['username']=='' && $_POST['password']==''){
echo "Please fill all the details";
}
else if($rows['username']==$username && $rows['password']==$password){
echo " login successfully ".$rows['username'];
}
else
{
echo "incorrect password";
}
?>
I literally copied everything from the beginning to end, there is always an error.
It was very helpful
Thanks Mate!
Exlent tutorial....THQ Sir........
iam facing an issue amd it shows 'uncaught error: Call to undefined functions mysql_real_escape_string($username);'
i checked each and every code but still facing a that issue
same... and idk why
@@mohamedhassani160 mysql stopped being used for php greater than 7 so you need to use mysqli syntax
Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in C:\xampp\New folder\htdocs\process.php:10 Stack trace: #0 {main} thrown in C:\xampp\New folder\htdocs\process.php on line 10 how to solve this error
I also see this information. How to solve it?
me to
Awesome video. II had to try it And can do so thanks very much, I will follow you to the next video.
simple, easy and u r great & thank u.
it's old PHP Syntax "mysql " is deprecated.
that is not true. MySQL is still updated as of today, but it got aquired by Oracle.
@@Kasrasfriedchicken soreplac all instances of mysql with stupidoraclething
@@Orincaby idk man what this even was, it's two years old. I was trying to be smart even when I have no SQL knowledge. Forget about this statement
@@Kasrasfriedchicken me neither
its not working, failed to query database No database selected
change the database with the name from yours
Thanks Awa!!! A good video.
I will download it right now, thanks for your always so good and quality work.
ua-cam.com/video/d1PdlScCVOo/v-deo.html
DO NOT FOLLOW THIS TUTORIAL FOR A REAL-WORLD PROJECT
If you want to see what a developers workflow is like, this video does a great job of demonstrating.
But the actual code is very likely to break and it uses really outdated procedures, even for 2015.
Please find yourself another tutorial made in the last 6 months or so.
Preferably one that teaches you about password hashing, prepared statements, and writing functions to reduce messy duplicate code.
Or better yet, find a framework you can use that takes care of database stuff for you. There's no sense in re-inventing the same thing all the time when there's hundreds of options out there to make your job easier, your code more secure, and your time better spent. For free.
@@kevintran2516 Your age might be starting to show somewhat then
@@itsmarsu oof
@@kevintran2516 you mean ur not even using password hashing.
Fatal error: Uncaught Error: Call to undefined function mysql_escape_string() in C:\xampp\htdocs\login\process.php:8 Stack trace: #0 {main} thrown in C:\xampp\htdocs\login\process.php on line 8
Ya, I have same Issue. My is :
Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in C:\xampp\htdocs\login\process.php:8 Stack trace: #0 {main} thrown in C:\xampp\htdocs\login\process.php on line 8.
@@sumanclick2979 Yep same
@@er4nyx did you found a solution?
Salaam There is not actually. Old syntax used in the video, not compatible with the new versions.
In new version php, now we use mysqli, not mysql again...
$dbname = mysqli_connect("localhost", "root", "", your-database_name");
$username = mysqli_real-escape_string($dbname, $_POST['username']);
Thanks my friend. Great video. I'm from Brazil. Your video help me. My english is not so good, but I can understand your video.
super knowledgeable this video is ..thank you
i got error, pls help thanks.
Fatal error: Call to undefined function mysql_real_escape_string() in C:\xampp\htdocs\login\process.php on line 9
you can change the mysql to mysqli in all the functions. cause newer versions of PHP doesn't actually supports the mysql function.
@@aarushsharma5966 actually by keeping mysqli it is also not working
@@kirankumar-kz4kc hi, did u find a solution?
How to solve it?
same
Wait what? Are you storing passwords in plain text?
you can just find an online password encrytor..
invalid cross php comes with a built in function called md5 (which is an hashing algorithm) so when you create the register page before inserting the user infos you do $pass = md5($pass); and then on the login page, before checking if the password is the same as the one in the database you do the same thing to check if the hash of the password is the same
It was really helpful. Thanks!
Thank u, it is very informative for me, it is more better when audio voice is included to this video tutorial
Thanks for watching. I will try to use audio next time.
Sorry to say, but its so unfinished and not safe at all.
1. If the POST is empty the user is still able to log in although this can be solved with "if($_POST == null)"
2. The password isnt salted/hashed, which means if someone logs in on the databse it will be pretty insecure
+Direct Gaming To check if post is set:
if(isset($_POST["name of input"])){
Do the stuff here;
}
To encrypt/hash:
hash: $password = md5($password);
encrypt: $password = crypt($password);
and then use the MySQL Query, but the password has to be stored in the database as a hash/encryption.
+Direct Gaming imgur.com/a/JLsIv < I made these two screenshots of my code with as much documentation as possible, if you have any other questions. Ask me on skype: itzthesimon
+Sn11p33r Thanks for your feedback. I'll make a better version soon
I made a better version of this video. Here, check it out: ua-cam.com/video/lGYixKGiY7Y/v-deo.html and thanks for watching!
Can you help me !!
Uncaught Error: Call to undefined function mysql_real_escape_string() in C:\xampp\htdocs\login\process.php:7 Stack trace: #0 {main} thrown in C:\xampp\htdocs\login\process.php on line 7
I have the same error. Did you find a solution?
@@user-vt1pv6ci1i Try mysqli_real_escape_string() instead
Génial ,grand merci
Very useful ,thnx, keep upthe good work...
Parse error: syntax error, unexpected '$username' (T_VARIABLE) in C:\xampp\htdocs\login\process.php on line 20
PLEASE HELP ME
echo "Login success, welcome! ".row['username'];
Maybe you missed a ";"
you have missed a semicolon
Uncaught Error: Call to undefined function mysql_real_escape_string()
Got the same error ...
How to fix this....
same
Same for me
Same error. Pls help
BIG THANKS TO YOU MAN!
Thank you so much...Your Video is so much useful. I am always grateful to you....Best of luck...........
When I press login nothing shows up there is no writing?
lol i realized that it was blank for me coz i entered the html into the process.php folder rather then login.php
same for me
haoh
haoh h
haoh hc
thank you for sharing this useful tutorial !
Thanks for the videos.
Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in C:\xampp\htdocs\login\process.php:9 Stack trace: #0 {main} thrown in C:\xampp\htdocs\login\process.php on line 9 please help me
same problem
thank you so much mannnnnn you saved my life
this tutorial just helped me
The page isn’t working
is currently unable to handle this request.
HTTP ERROR 500 getting error
same
same here. did you solve?
because guys he is using the old commands for MySQL if u have newer version of PHP it won't work
it will work for the connection but some codes are written differently it won't work even if you change it because other error will pop up
look I don't need to do it cuz I can write it myself this video showed up in the suggestion bar and I click it just from pure interest to see how many people will have errors and I was right almost 90% of the comments is about the same issue that is occurring
getting this error
Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in C:\xampp\htdocs\login\process.php:7 Stack trace: #0 {main} thrown in C:\xampp\htdocs\login\process.php on line 7
Me too
mine too
@Rainiel Gwapo Could you explain why?
@Rainiel Gwapo so the i behind mysql isn't like made up. It really is needed and can't be another letter? Thanks for the quick reply!
@Rainiel Saclay like how i change it to mysqli but still not working ):
thank you very much. very helful tutorial for beginner
hai awa melvine ... very inspired sir.
got an HTTP Error 500
same
Have u installed PHP?
This video is severely outdated, unhashed passwords and old deprecated mysql extension, and old methods
p.s. i know there's a better version out there
can't you see it was uploaded 2015...what do you expect hater?
ขอบคุณมาก Thank you so much from thailand.
thank you bro you help me a lot for my project ....
This video really help me a lot
O! it Amazing You really help me Well done !
suwun yo pak,wis mantab tenan lek mu nyampekne....
An amazing work man even without a voice you make it easy to understand and read, many thanks man'
weldone keep it up its really helpful to me Thanks
wow perfect and to the point
ignoring the fact there's no audio in this tutorial, this is a great tutorial. 1 thousand people who dislike this is a spoiled brat
an excellent job well done
Just what I needed
ua-cam.com/video/d1PdlScCVOo/v-deo.html
it was like watching a good Charles Chaplin movie. Applause!
Nice instructions thanks for the trouble :)
Thank you so much this helped me so!!!!!
Very helpful. Thank-you.
helpful for a beginner
thanx
Thanks for watching
you are great! thank you!
Perfect work!!!
Cool You really help me Well done !
thanks..it helped me out
cool, it's work perfectly
YOU ARE AWESOME BRO
Great tutorial, however just to point out. It was actually the name attribute that is used, rather than the id in $Post[' ']; that caused the undefined index notice in your script.Very helpful though giving you a thumbs up.
defined in easy way thanks