Complete Login Register & Logout System | PHP & MySQL | Animated Epic Login Regis Form | Source Code

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys welcome back and in this video we're going to do this amazing login and register form using php and mysql so here basically if i click on this sign up button then we have a sliding effect and we have here sign a form here if i click on the sign in then we have sign in here okay so now i can sign up here first so here i need to enter here full name so i'm gonna use here pure coding and the email we are going official address gmail.com and the password i will use this password we are going off sale and the content password i am gonna write anything and if i click on the sign up then we have a message password did not match so i want to go here and i to enter this password here otherwise it's not working so click on this and then we have user registration successful so now i will check under that data bill then we have here a row recording and the email is forgoing official at the gmail.com and the password is encrypted form this is the md5 hash password and now i'm gonna create one more user here so here user is that test and email is pure coding official at the gmail.com and the password we are going off cell and if i click on this then we have here message email already exit in our database it means you can't use one email multiple times because it's not working so now i'm gonna log in here so i'm gonna write here incorrect details and click on this login button then we have a message login address is incorrect let's try again so we have to write we need to write here correct details so i'm going to write characters and here we have this so here we have first user id so user id is one and then we have a logger logout button if i click on this then we have logged out okay so now i wanna login again here and notice here we have an index.php this is the sign it and the signup form psp file and now click on this login button then we have redirected into welcome.php and if i try to open index.ps file then we have alright automatically redirected into welcome to specified so if i log out here and if i try to open welcome dot face file then we don't successful because you need to log in here first then you need to you will access the log out actually welcome dot space file otherwise you can't access welcome to this file the same thing on if you logged in and then you can't access the sign-in page first you need to log out then you can access this so without wasting any time let's get started so here as you can see i have a login and register from html template here in the root folder that's our project folder so i will show it up here so i have already start this jam server xampp and apache and mysql server okay so then uh i have pasted this template into the htdocs folder and then i'm gonna search here for this folder that's name is login register so here's our template and we have this username field password field and login button so here if i click on signup then we have a sliding effect and then we have a signup form here okay so i'm gonna give you this line form in the video description so you can easily download this html template from my video description so now let's start that so first of all uh i'm gonna change this dot html extension into dot php extension okay so now uh after that i'm gonna open php my admin here localhost phpmyadmin so here's my psp and my admin and here you need to create a database so i'm gonna give a name here that's a login register form okay so register register youtube and now click on this create button so once i have click on this credit button then we have a database so now i'm gonna create a table here so for that i'm gonna uh give here a name that's user table okay users and we have here uh so i'm gonna count the rows here actually columns so first thing is id id and then we have here the full name then we have email and then password and we have password okay so these four rows here actually so i'm gonna click on this go button so once i have click on this then we have here something so i'm gonna write it the id and it's also auto increment so you need to click on this auto increment here and then you need to write the second thing is the full name and this parker and i'm gonna set at the 15 characters actually and then we have email so for email we have also worker and that's i'm gonna use 100 and then password password and we have here the worker and the 255 so now i'm going to click on the save button and here my table is created and now i'm gonna go the code editor and open index.php file actually okay sorry and this is our index.php file and here as you can see we have here the sign-in form so that's sign-in form and okay so here is the sign up form actually and this is the sign-in form all right so for sign up form i'm gonna so this action is blank so that's set and now i'm gonna write here method is the post and the sign up form and here first thing is i will need a full name and i will pass here in name attribute and then i'm gonna this parameter is i'm gonna add here the full name full underscore name so i need that uh when i will get the data from the input value in the php so now second thing is we have an email address so i'm going to change this email to my address that's actually less solder so this placeholder is this so email this so amina also added the required attribute so required and here we have name and name is email so i'm gonna use here sign up sign up name sign up full name sign up name it actually because we have here the sign in form and the sign up form in the same page and sam second thing is we have here actually third thing is we have here password so for password 11 at the name is sign up password and it's also required and now we have one more thing that's confirmed password so confirm password so i'm gonna write the confirm confirm confirm password and let's see password and this also required all right so i'm gonna give a name on this button so name is sign up sign up and here notice you need to add this type and to submit you can use here also button but i'm gonna use i have used here this input okay so now [Music] now i'm gonna go here at the top of the page and i'm gonna write here php syntax and here i will check okay so for the first thing is i need a config file database config file so for that i'm gonna use it a config.psp file create a file here and it's like that i'm gonna create a ph i'm gonna start psp syntax and close that and i'm gonna define some variables here so i'm gonna use first host name and we have here now localhost for so i'm gonna use here localhost and second thing is we have here username this is your database username so here we have the username is root it's by default on the localhost and now here we have the password password is blank on the localhost if you working on the live server then you need to enter the password of the database user password here okay so now here we have the database name finally so database is we have this database so this is our database login and just register and describe youtube so i'm going to write here this login underscore register underscore youtube so this is our database and now i'm gonna write hit the dollar connection variable is mysqli connect and here i'm gonna write this host name then we have this username then password and then there are his name so i'm gonna write here the host name and then we have the username then we have password and finally we have database so here we have or it means uh if this failed then we have here a code that's die and here i'm gonna write database connection failed connection failed so that's it so now i'm gonna go here index.php and here i'm gonna write include and here i'm gonna write the config.php file so now i'm gonna check here so refresh that we have no anything here error so it means this commands is right so now i'm gonna check here if set dollar underscore post uh this is the signup form so we have here this sign up button so once i have clicked on that then we have here define some variables like we have here for or sign up we have for full name full name and here i tried mysqli real estate string many peoples are don't write this and if you don't try this then it's very bad practice because if you don't write this then you're called hundred percent chance of sql injection so i recommended you to use this and now here first thing is we need to write this connection variable that we have defined on this config.psp file and second thing is we have dollar underscore post and we have here this full name sign up full name sign up adapter full name so i'm going to copy this and paste here all right so now we have this so now i need here total four columns so i'm gonna copy this into four times and now second thing is we have the email so for email i'm gonna write this and we have sign up underscore email so i'm gonna copy this from here sign up underscore email and paste that and now password for password we have here sign up underscore password and paste that here and we have last thing is confirmed password so i'm gonna paste that here and we have to write here see password okay so now for checking this password and the confirm password i'm gonna write here password in case of your password if you want to secure your password then right here md5 or sha1 this is the password encrypted of the php here so i'm gonna write here this md5 and now i'm gonna check here dollar password dollar password is this variable here and is equal to is equals to actually three squares too and then we have the c password so if this password is equals to equal then we have this and otherwise i'm gonna write this like this if this password not match to this password then we have execute this commands here okay so for that i'm gonna write here a message variable okay so here's the message very well and i'm gonna write here i'm gonna assign a value to this message variable so msg and everyone right here uh okay so i'm gonna write here the i'm gonna echo here actually a large boxes because this is the javascript alert boxes for the warnings so i'm gonna echo here and write here script and we have alert here a lot that's password did not matched matched match did not match so we have this and i'm gonna need to close this script tag here all right so now i'm gonna check that so i'm gonna refresh this and i'm gonna go with the sign up so we have this and if i click on this so this field are required so i'm gonna write here something and email address and we have the password here so i'm going to copy this and i will paste here so if i click if i run this password password and password then we have here a message password did not match and we have uh if i enter here the same password in the password and command password field then we don't have any error message here okay so for that i will check it out here so i'm gonna write this like this and the password control password is the same so if i click on this now then we have no any errors here so it means this code is really work and now here we have else if so now and to check yet here the email is already exist in our database or not so for that i'm gonna write here uh dollar sql variable okay so i'm gonna write here check actually check the email so check email and i'm gonna write it the mysqli numbers num rows and i'm gonna write mysql like query and here first thing is we need to write this dollar connection variable that we have defined in dot config.specified and second parameter is i'm gonna write the sql query select uh email from users table and we have where clause that's email is equals to this email notice here you need to write here the single quotes otherwise it's not work so now i'm gonna check it out here so this up to zero then it means if one or up to one or up to zero okay so now i'm gonna copy this here and paste here and here i will write email already exist already exist exists in our database and so if i go here and here i do insert a row on this database otherwise it's not working so i'm gonna write here the something like this you can write here anything so [Music] here and now copy this here so i mean click on zico and we have here a row here okay so row here and if i refresh this and if i go with the sign up dot sign up here and now i'm gonna write here something and the email address is the same to this email address and now password for password i'm gonna use this password here and then we have here a message email already exists in our database okay so if i enter here unique email address then check it out here so here i'm going to write i have write it here pure coding official one and inside the database we have peercodingofcell.gmail.com so i will write this here so if i write this so we have no idea error so it means this code is properly working so we have this and otherwise else we have no not this condition and not this condition then we have here else part so inside this else part i'm gonna write dollar sql insert into users okay so insert into users and we have here uh these columns first column is so i'm gonna delete this actually first because this is the confusion and now i'm gonna write this for full name actually first full undiscovered name and second we have this email and the password so email and password basically you can copy this query from this sql tab okay so you can hit here installed then we have this commands so you can copy this from here but i will write here because this is the best practice so we have this and now we need to write the values and inside these values you need to write this order on this here string or variable that you want so first we have this full name so i'm going to write this full name here that's we have in the input field here actually uh this input so i'm gonna write here that and we have second is the email so for email i'm gonna copy this here and paste here and now we have the password for password i'm gonna write this this password variable and now i'm gonna execute this sql query for that i'm gonna write a variable and my skill i really skip straight actually mysql like quality mysql like query and now first thing is we need to write this down connection variable then we have this sequel query so once i write this then i will check here dollar result is true then we have execute this query otherwise we have this as part so as far all right so now we have here uh we have to write here this i'm going to copy this paste here and right here uh user registration success successfully and otherwise we are going to show here user registration so now i'm gonna refresh this okay so i'm gonna refresh here this and if i will check here the database actually table so here we have no any and i'm gonna click on the sign up button then we have this and i'm gonna write here a name and second we have email here and the password so i'm going to use this password here you're recording option and content password and password is the same and click on this sign up button once i've click on this then we have user registration and successfully actually and now if i check on this table then we have this one row and we ins inside this id we have two because we have already one uh row and i have deleted also that and second we have the full name and the third pass email actually and the last is the password for password we have here encrypted hash some password so this actually pre-ordering of the password in the hash format so it's that and here we have one problem actually that's problem is if sometimes if this registration is failed then we have here okay so i'm failed that actually so i must uh write wrong queries on the sql queries u1 uh sdrcss so it is not our table and exist in our database so now if i refresh here refresh and if i go sign up and right here something like test and we okay so gmail.com and we have the test here password password and click on sign up then we have user registration field so here we we are gonna open this sign up then once i have opened that we don't have any values here actually but i need to stay here the values that user righted in the before so right and i'm gonna go here sign the form in the html and i'm gonna write here value so value and php here php eco and right here okay so i'm gonna write here dollar and discord post and now you need to pass this name here this name so i'm going to paste here this and i'm going to copy this value to this all fields here so for email i'm gonna pass this and password here password and the content password here all right so now if i resubmit this form here then we have registration successfully and if i go here then we have this values but if user registration is successful then we don't need these values so i'm going to blank this after if the rest and successful so i'm gonna go here here actually uh if user registration is successful then we have executed this twice so here i'm gonna write dollar underscore post and the first we have this full name full name is easiest to blank and we need four columns here so second we have email for password we have this password and the current password here and now refresh here one more problem here uh if i refresh in the first journey we have here some errors so for that i need to write here error reporting 0 error reporting 0 error reporting is the 0 so if i refresh here and go sign up then we don't have any error so i'm gonna write here something so i'm gonna write here test and the test at the gmail.com and we have the password for test test and sign up so we have already data exit the email is already existing so i'm gonna go here uh okay so all fields are stay in the past status so we have here one test so i'm gonna delete this and i'm gonna click on this sign up so user registration is successful and if i check here then we don't have any values on the input fields so if i check on this database so we have this here so all right so our sign up is completed and now we are going to do this sign in so sign in uh for sign in i'm gonna write here action is hash or blank don't matter and the method is the post this is the important so now we have the sign in and for username i'm going to change it into the email address and it's also required and the password we have also required that we have these two things and i need to give you the name name is the email and we have here name is a password and we have here the login button so for login button i'm gonna give you a name that's uh i'll sign in sign in what basically you need to add this here type is used to submit it's important if you are using here type is just to button then it's not working so here i'm gonna copy this registration code here and paste here all right so i'm gonna change it into the sign in and we have this so i'm gonna write this email and password here so i don't need this all things so i'm gonna delete this two things extra okay so first we have here email and for email name is only email because i have entered that here okay so for password i'm gonna write the password variable and we have this password here and also i need to write here md5 if you are using here on registration you are using 95 then you want to write it here also otherwise it's not working so here and now we have select email here okay so i may write here select id from users what was email and we have here and password password is equals to this password here so i'm gonna paste here okay sorry and we have here password if okay so i'm gonna delete these things because i don't need this so here i'm gonna delete it also i'm gonna write okay so i don't need these things also i'm gonna write here if dollar check email up to zero then we have to uh okay so if not opposite then we have here error message so i'm going to copy this here and i will paste it that's a login details incorrect login details is incorrect incorrect let's try it please try again all right so we have this and inside this up to zero then we will uh equal here okay so i'm gonna start here the session very well because i'm gonna use here the session so i'm gonna write the session start so at top i'm gonna use this session after this so i'm gonna write the session start so we have this and now i'm going to write a dollar underscore session dollar underscore session and here i'm going to write user and describe so user underscore id is equals to this id so okay so i'm going to delete this minus given numbers and enter here my sql numbers because i need this query also mysql num rows so that's it am i right here dollar row row variable and we have minus giveaway fetch our sock so i saw we have here checking it basically i have write this variable for i need the data uh this id here i need this id from the database from the table actually and i'm going to write a dollar row and the id and all right so and then we have to redirect it into welcome dot php file location and welcome dot php file so i'm gonna create here welcome to ps5 welcome dot p3 file and i'm gonna write here php and i'm gonna write a okay so i'm gonna write start the session actually session start and here i'm gonna go dollar and let's go session user and description all right so now i am gonna refresh here and i'm gonna sign in here so for signing i'm gonna write this status stat actually test address in gmail.com so i'm gonna write here the incorrect password so i'm gonna click on this login button then we have login details is incorrect let's try again so we don't have any data here so i'm gonna need this also so i'm gonna go here this form is login form so i'm gonna write here value value is php equal dollar underscore post okay somewhere like this and we have here this email okay so i will copy this value also okay so here we have two double quotes i don't need to transfer okay so here we have the password here and now i'm gonna resubmit this form so we have login database is incorrect and we have this data here so i'm gonna refresh it here so we don't have any error because i have already used at the top is error reporting zero so i'm gonna write here i'm gonna write here another email that's peer recording official address gmail.com and we have this password also this is the password and i'm gonna write here this password and click on this login then we have redirected into the log welcome dot php file and user id is two so i'm gonna check here this table users and we have this user and we have this id is two so it's working and if i go here index dot psp file then we have also accessed this file but if user logged in then we don't want to access this login register file so for that i'm gonna write go here index.psp file and i'm gonna write here if it's set dollar and disco session and right here uh this user underscore id actually this and if it's set then we have to redirect it into welcome.psp file so i'm going to copy this here copy this from here welcome.php file and otherwise this query is also execute so if i refresh this then we have or automatically redirect it into welcome.facebook okay so i'm gonna create now log out dot vista file for that i'm gonna create here on your file logout logout.psp file and here i'm gonna write php session start session destroy okay so here i have to write the session on set actually and set then we have session destroy and then we have to redirect it and do we will redirect it into okay so i'm going to close this syntax actually and then we will redirect it into index.php file that's our login page index.php so i'm gonna create a link on this welcome dot ps file and right here e4 okay so i will write here a link on this html so you write html syntax and then we have here anchor tag and logout dot php and then we have to write here log out so now refresh here so we have a log out button and if i click on this then we have to redirect it into here and we have a log out and if i access here welcome dot specify then we have also accessed this but i don't need to access this so for that i'm gonna go here and actually go index.php and i'm gonna copy this and go here and after session starting we have paste this and change this if condition into not set dollar underscore session dollar user underscore id then we have to redirect it into index.pc file so i'm gonna refresh here so i have already redirected into index.php file so that's it you
Info
Channel: Pure Coding
Views: 15,858
Rating: undefined out of 5
Keywords: Pure Coding, Pure Coding YT, register login, register login system, complete register & login system with php, register, login, complete login system, pdo login register system, complete php pdo login, login and register forms, laravel 6 login and register, how to create a complete login system in php, register form, how to register at hec and steps to complete profile, complete login application in python, login form, how to register, how to register in okex
Id: lIi9rqW-yJY
Channel Id: undefined
Length: 37min 40sec (2260 seconds)
Published: Sun May 02 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.