Login system using PHP with MYSQL database

  • Published on Sep 20, 2015
  • UPDATE: User registration with email verification on localhost: goo.gl/nRADcM
    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.
    *** Learn how to build a complete blog with PHP and MySQL: goo.gl/Ru41Tw

    - - - - - - - - - - - - - - - - - - - C O U R S E S - - - - - - - - - - - - - - - - - - -
    { B O O T C A M P S }
    - - The Web Developer Bootcamp: bit.ly/2NpDcKR
    - - The Complete Web Developer in 2018: Zero to Mastery: bit.ly/2N0ZW4F

    { P H P }
    - - PHP for Beginners - Become a PHP Master - CMS Project: bit.ly/2u5QMIw
    - - Create a REAL Social Network like Facebook in PHP + MySQL: bit.ly/2wUv3om
    - - PHP with Laravel for beginners - Become a Master in Laravel: bit.ly/2QcbeRf
    - - PHP OOP - Understand Object Oriented Programming in PHP: bit.ly/2CysNs3

    { P Y T H O N }
    - - Complete Python Bootcamp: Go from zero to hero in Python 3: bit.ly/2wSybRs
    - - Complete Python Masterclass: bit.ly/2oNWfQW

    { J A V A S C R I P T }
    - - Modern JavaScript From The Beginning: bit.ly/2wUHdwD
    - - The Complete JavaScript Course 2018: Build Real Projects!: bit.ly/2wUlZ1L
    - - Modern React with Redux: bit.ly/2QcWBx0
    - - MERN Stack Front To Back: Full Stack React, Redux & Node.js: bit.ly/2CAaeDY

Comments • 726

  • Awa Melvine
    Awa Melvine  3 months ago +22

    ✔✔✔💥UPDATE: Here is a better version of this video: ru-clip.com/video/ShbHwaiyOps/video.html
    UPDATE: User registration with Email verification: ru-clip.com/video/8K4Wt37Itc4/video.html

  • Foscam Babić
    Foscam Babić 12 hours ago

    Fucking great video, i can listen to my music and work simultaneously

  • Сергей Веселов


  • Portal Músicas M.R.A


  • Killersponge87
    Killersponge87 8 days ago +2

    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.

  • Malik Malik
    Malik Malik 8 days ago

    bio-data form using html WITH SOURCE CODE.DOWNLOAD IT FROM DESCRIPTION ......ru-clip.com/video/k0i4ZDlddlw/video.html

  • Kiarash Bahrami
    Kiarash Bahrami 8 days ago

    try 1.5x speed

  • Ben Abe
    Ben Abe 9 days ago

    the code is not safe. SQL injections are possible. is better to use escape functions to make the user input safer. mysql_real_escape_string()

  • Manisha Prasad
    Manisha Prasad 11 days ago

    thanks..it helped me out

  • W R
    W R 13 days ago

    bom dia tenho um projeto aqui em casa com arduino uno para abrir o portão de casa pelo celular, agora quero colocar a minha camera do dvr intelbras na mesma tela. para quando eu ver a camera poder apertar o botão do portão. mais não estou conseguindo, pois não consigo dar player no rtsp . o que eu faço ???

  • ChaT [Official Lyrisc]

    4T5 Rap has shared a video with you on RU-clip:
    “How to Read RSS Feed in PHP” - Learn How to Read RSS Feed with PHP. How to display XML RSS Feed by using PHP...

  • Aron Hargrove
    Aron Hargrove 16 days ago

    you are 6 years late for text tutorials bud, thanks for the laugh! :)

  • Guillermo A
    Guillermo A 16 days ago

    Hey Ian I am not familiar with the new Javascript syntax, what resource would you recommend to a person that is taking the web dev boot-camp course and wants to know how to write new javascript syntax and see how it is written now compared to before? also, another question, if a potential employer sees our version of yelp camp written with old javascript syntax from the course, would this be viewed negatively? thanks in advance brother.

  • diordiev ivan
    diordiev ivan 17 days ago

    BITSLER Я дам тебе в рот!!!! Ты заебала меня наебывать сука паршивая!!!!

  • diordiev ivan
    diordiev ivan 17 days ago

    BITSLER Я дам тебе в рот!!!! Ты заебала меня наебывать сука паршивая!!!!

  • Arpit Suman
    Arpit Suman 18 days ago

    for database named ---- webproject and table named ----- register

  • Cloud Token Reviews
    Cloud Token Reviews 18 days ago

    Great stuff Ryan. Thanks for taking the time and effort to lay it all on the line!

  • Lifa Journey
    Lifa Journey 20 days ago

    hai awa melvine ... very inspired sir.

  • DRAGONslayer043
    DRAGONslayer043 22 days ago

    Bruhhhhhhhhhhhhhhhhhhhhhhhhhhhhh, how slow do you tyyyyyppppeeee godddaammmnnn.

  • KunMail
    KunMail 22 days ago

    Free themes available here that anyone can download. www.kunmail.com/

  • Никита Самсонов

    очень популярная тема, ждем уже релиза

  • Nick Thayne
    Nick Thayne 23 days ago

    Insted of video's why don't we gain millions of people. to insist that anyone holding public office (president of us) to be evaluated not only Physically, but Emotionally as well as Mentally N.

  • Geri
    Geri 23 days ago +1

    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
    If anyone could help, I would thank you very much!!!

  • Wouter van Beijnum
    Wouter van Beijnum 24 days ago

    Do NOT use this method to create a login system. It is very unsafe. Passwords should not be stored as plain text and this implementation is vulnerable to SQL injection attacks.

  • Zakaria Noui
    Zakaria Noui 24 days ago

    thank you

  • Andrew Kassar
    Andrew Kassar 24 days ago

    easy1up.com/?id=andrew229 join me with this great opportunity!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! endless income without leaving your chair LIFE Changing

  • pushkar arora
    pushkar arora 24 days ago

    In this data in $result before using mysql_fetch_array() function is in which form ? Is it in object form?

  • Bolluwatifeh Ayomideh
    Bolluwatifeh Ayomideh 26 days ago

    make money now I got $22:000 bitcon in my account with the help of hackerdean@gmaill.com without issue you can contact him via WhatsApp +14356122777

  • Coco La noix de coco
    Coco La noix de coco 26 days ago


  • Lisandry Cuevas de Jesús

    Hola, Podrías subir mas vídeos con otras sentencias?

  • Joaquin Salas Zurita
    Joaquin Salas Zurita 28 days ago


  • Flavio Bueno
    Flavio Bueno 28 days ago


  • Johan Westerlund Granberg

    These videos without sound are so annoying. It is super boring to watch a video with no sound. Besides, it is very difficult - if not impossible - to understand what is going on when you only have the visual part. If you don't want to record your own voice, at least use a text to speech tool. If you can't even do that, don't bother making instruction videos at all. That's my opinion anyway.

    • Awa Melvine
      Awa Melvine  28 days ago

      Hey friend, thank you for your honest opinion. This video is very old and I recorded it when I was just starting out. Here's an updated version of the video with sound:
      Thanks for watching!

  • Jundy Islami
    Jundy Islami 28 days ago

    atal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in C:\xampp\htdocs\login\proces.php:9 Stack trace: #0 {main} thrown in C:\xampp\htdocs\login\proces.php on line 9

  • GNI Jazz
    GNI Jazz 28 days ago

    mysql not work mysqli worked

  • KAFL Insurance Resources

    With CSS hero if you change anything on the pages, does it change the CSS code across the site or just that page you are on? I would be afraid it could modify the whole site. Let me know.

    AM CODE Month ago



    ALl in Javascript

  • alessandro costa
    alessandro costa Month ago


  • Dim Stoin
    Dim Stoin Month ago

    Uncaught Error: Call to undefined function mysql_real_escape_string() in C:\xampp\htdocs\login\process.php:16 Stack trace: #0 {main} thrown in C:\xampp\htdocs\login\process.php on line 16
    Please help me dude!

  • ridhoazhar megantara

    suwun yo pak,wis mantab tenan lek mu nyampekne....

  • AumMM
    AumMM Month ago

    Parse error: syntax error, unexpected '$result' (T_VARIABLE) in D:\xampp\htdocs\YangDD\process.php on line 17 ,why still erro anyone can help?

    • Venkatesh Nambi
      Venkatesh Nambi 14 days ago

      u might have missed " ; " a line before it. please check that!

  • gabi lopez
    gabi lopez Month ago

    hi my name is madafaca jajajaja hablen jajaja

  • Lucas Melo
    Lucas Melo Month ago

    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

    • IamQuuick
      IamQuuick Month ago

      mysql_real_escape_string has been deprecated for a long time and was completely removed with PHP 7 (which is why you get the error it's not found). Use mysqli_real_escape_string instead, or PDO with prepared statements. Check the PHP documentation for more information

  • Wolver Hulk
    Wolver Hulk Month ago +1

    Got this error: Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in C:\XAMPP\htdocs\Login\proccess.php:7 Stack trace: #0 {main} thrown in C:\XAMPP\htdocs\Login\proccess.php on line 7


    • Akmal Hakimi
      Akmal Hakimi Month ago

      @Wolver Hulk could u pls share me ur codes

    • Wolver Hulk
      Wolver Hulk Month ago

      @Akmal Hakimi I tried changing mysql to mysqli but it said too few arguments and i looked it up i was doing everything right... pls help

    • Akmal Hakimi
      Akmal Hakimi Month ago

      Aloysius Beronque no problem 😇

    • Aloysius Beronque
      Aloysius Beronque Month ago +1

      @Akmal Hakimi Thanks alot!

  • Sergey Alexeev
    Sergey Alexeev Month ago

    Ну выручил черномазый!

  • mankinwomg mankinwomg

    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

    please help

    thank you very much

  • Mateusz Soroka
    Mateusz Soroka Month ago

    Seriously? Password as a plain text?

  • Демид Федосеев

    Excellent overview, you need to invest

  • evgenija kadlubiskij

    Интересно, приживется ли проект в данной индустрии! Вообще перспективы хорошие, да и команда что надо, видение решения проблемы - то что надо

  • Markus Studer
    Markus Studer Month ago

    Pelase note: Do never save passwords like this use md5 or better methods see: www.php.net/manual/faq.passwords.php

  • Advice for iDevice
    Advice for iDevice Month ago

    Oh my gosh i only saw $POST and left the video, trying to figure out what is the error for an hour... Just make $_POST ..

  • ForminaSage402
    ForminaSage402 Month ago

    Lol idk why this video is in my recommended but if you use Ctrl+D in Sublime Text, it will select the next instance of the highlighted text.

  • Steven Smith
    Steven Smith Month ago

    Same issue yesterday, tech support for 30 minutes... went this morning traded in cable box, it worked for 20 minutes, Please Wait, called tech support, suggested reboot, You mean where I unplug the box, wait 1 minute, plug back in, L-9, L-8, L-3... Please Wait, scheduled a noon-1pm for Tuesday tech to come out, must tell boss my tv is more important than the job. If he had his priorities straight he would understand.

  • R Z
    R Z Month ago

    I liked it.

  • Farisya & Faiqa Gacha

    Kak bagus^^

  • M-A
    M-A Month ago

    good video thanks

  • M-A
    M-A Month ago


  • Azen Kwed
    Azen Kwed Month ago

    You should use the Netscape browser while you at it.

  • Alejandro Amor Puro


  • Faruk Sariyagiz
    Faruk Sariyagiz Month ago +1

    Inceldigi yerden kopmazsa amk....!

    TEAMRALLY Month ago

    wo kann ich dir privat schreiben ??

  • JESUS The Only Way Ministry

    The Rapture

  • Long Kim
    Long Kim Month ago

    Thank You :)

  • Mikrotik Colombia TikAcademy

    Man not another notepad video

  • gregstandart limo
    gregstandart limo Month ago

    I wonder how this managed to come among my autoplay list, just how? I am a fool I watched it though.

    ELOI MUGISHO Month ago

    i like it.

  • Raaj Singh
    Raaj Singh Month ago

    error on every line!

  • center PARS NEGIN
    center PARS NEGIN Month ago

    Thanks for the videos.

  • Joachim Dietl
    Joachim Dietl Month ago

    Hi I am too dumb to use a microphone. If you want the source code, send a a scroll or an animal skin. We will tatoo the code on it and send it back!

  • VB6 Expert
    VB6 Expert Month ago

    Dear Sir can I know the platform you are using to write the code ?

    • DeafeningRoar
      DeafeningRoar Month ago

      its sublime text, if thats what you're referring to.

  • junquan su
    junquan su Month ago +1

    Alibaba Cloud HI purchases cloud products for a limited time of 50%, enterprise cloud servers as low as 3 fold, network construction as low as 14/month, cloud communication as low as 0.027/bar, quick purchase!

  • Владислав Мишин

    An interesting project, analogues have not met yet

  • Social Media Marketing y Marketing Digital

    Gracias, fácil y efectivo.

  • O 1
    O 1 Month ago

    Trung Duong, cho minh xin link down ve nhe, cam on ban

  • Johnnystam666
    Johnnystam666 Month ago

    Thank u

  • The USSR
    The USSR Month ago

    Doesn't hash passwords

  • Veerender Kumar
    Veerender Kumar Month ago

    good job. thanks

  • guapofill felle
    guapofill felle Month ago

    20/07/2019 si caducan pidanme mas

  • Rob K
    Rob K Month ago

    you uploaded this in 2015? holy fuck, if you ever learned anything from this video I'm 100% not hiring you lol

  • Miguel Nogueira
    Miguel Nogueira Month ago +4

    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

    • Seleman Class
      Seleman Class 27 days ago

      can't you see it was uploaded 2015...what do you expect hater?

  • Jessica James0596
    Jessica James0596 Month ago


  • Bin Lê
    Bin Lê Month ago +1

    Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in C:\xampp\htdocs\ASM2\login.php:6 Stack trace: #0 {main} thrown in C:\xampp\htdocs\ASM2\login.php on line 6

    • Miguel Nogueira
      Miguel Nogueira Month ago

      mysql_real_escape_string was deprecated. please don't use this tutorial anymore. If you're using PHP 7, it's been removed. The alternative is mysqli_real_escape_string().

      But then again please don't use this tutorial as it's severely outdated and insecure. The mysql extension was removed as I stated. There are far better tutorials out there.

  • lolrogi
    lolrogi Month ago +2

    Wait what? Are you storing passwords in plain text?

  • Nutri Tech
    Nutri Tech Month ago

    Not working after Install dear

  • guilherme daniel
    guilherme daniel Month ago


  • RepublicanGuard
    RepublicanGuard Month ago

    I am Iron Born. What is dead may never die!

  • moshe shai
    moshe shai Month ago +1

    משה שי שמאי צקרקעין ,מתווך דירות,הולילנד נכסים ירושלים ,אפליקציה אפקטיבית לסייבר ספייס

  • Mustafa SAYIN
    Mustafa SAYIN Month ago

    Hi, I cant read strings, write is succesfully but, how can I read.
    thanks alot of

    • Mustafa SAYIN
      Mustafa SAYIN Month ago

      yoksa, sql de ve php de sorun yok, her şekilde veri alıp yazıyorum da, bu nasıl oldu hala çözemedim, ben de diyorum adamlar neden benim soruma cevap vermiyorlar :)

    • Mustafa SAYIN
      Mustafa SAYIN Month ago

      ​@Bedirhan Dincer Eyvallah kardeş, bu arada yeni farkettim, ben bu mesajı otomasyon videosu altına yazmıştım, o arada video bitince buna geçti zaar :) valla ben de yeni farkettim, youtubenin acayiplikleri.

    • Bedirhan Dincer
      Bedirhan Dincer Month ago +1

      @Mustafa SAYIN Tamamdir, işe lazimsa kimse seni tutamaz ;p. Seni ogrenci sandim o yuzden dedim. Ama yinede genelde cok sirketler eski teknoloji kullaniyorlar sende haklısın. Sirket için yeni teknoloji kullanmak cok masraf.

    • Mustafa SAYIN
      Mustafa SAYIN Month ago +1

      @Bedirhan Dincer eyvallah kardesim. Ben de node_red ile endustriyel otomasyon yaptim. Plc ile haberlestiriyorum. Ama bazen php cok lazim oluyor. Acemiyiz daha 😀😀😀

    • Bedirhan Dincer
      Bedirhan Dincer Month ago +1

      Abicim @Mustafa SAYIN bu program dili cok eski orgenme. Ben avrupa'da universiteyi gidiyorum orda PHP eski olarak goriyorlar. Sorun varsa sora bilirsin. Simdik backend olarak Node.js kullaniyorlar ve Rust dili. Node.js suan daki trend ama Rust dili yeni trend olucak.

  • Nono Panzu
    Nono Panzu Month ago +2

    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!

    • Rob K
      Rob K Month ago

      you have to forget everything from this video because its horrible, horrible and very horrible

  • Beard & Bald Head
    Beard & Bald Head Month ago

    Why you type in notepad instead of your speech?

  • Aasd Enclosure
    Aasd Enclosure Month ago

    weldone keep it up its really helpful to me Thanks

  • isunktheship
    isunktheship Month ago

    Hold on a second.. you weren't passing the values in properly the first two times, so your query would have resulted on 0 rows.. but then since your username and password were also blank (""), I guess it passed? So you effectively hacked your own site.. if you logged in with ["",""] I bet it would work too.

  • Ross O'Neill
    Ross O'Neill Month ago +3

    Thanks for this video. Was exactly what I needed.

  • Ptimou
    Ptimou Month ago +2

    Since when text tutorials get so popular ??

  • Marsu
    Marsu Month ago +18

    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.

    • ian fer
      ian fer Month ago

      @Kevin Tran you mean ur not even using password hashing.

    • exoshyfer
      exoshyfer Month ago

      @Marsu oof

    • Marsu
      Marsu Month ago +2

      @Kevin Tran Your age might be starting to show somewhat then

    • Kevin Tran
      Kevin Tran Month ago +1

      bro I've been an engineer for 19 years and this is the best method of doing it

  • Belabbas Mohamed wael

    Thank you sir

  • Jennifer Davis
    Jennifer Davis Month ago

    God bless fabuloushackers.wordpress,com for saving my life, i just received 4,000 USD.

  • Misex Xshop
    Misex Xshop Month ago

    se demora la explicación pero funciona