Login Form in PHP With Session And MySQL

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys welcome to my another video tutorial in this video I'm gonna teach you how you can create a login form in PHP with my skill and also usage of sessions now this is our project I will teach you how you can design this form using a bow to step and I will teach you how you can use PHP to valid the input text fields and also usage of sessions let me show you the example now you can see that this is our project I click on login button then you can see as red line I'm in text and has been appeared please fill in the blanks I enter correct username and incorrect password now you can see please I mean invalid username and password I enter a correct username and password I will feed out with another page ok now you can see here this is a welcome dot PHP I click on logout I read out on home page if I mean a direct use welcome dot PHP I can't do that because I do not use I mean this is a basically validation now you can see it but I use admin and admin correct username and password and I click login and I do not use our Killick on logout button and then I go Parekh index dot PHP file after opening this page our file and I will open the welcome dot PHP I can do that why because I do not click on the I mean logout button our logout link this is all about sessions right I click on it I redirect on the home page and then I fought I for example I open the direct the ball comes out PHP I can't do this so I will teach you how you can do that so first of all I open my project localhost localhost login demo this is a mat project and this file are this project I have been opened on my code editor in this project here of 1 index dot HTML file and Mbutu stepped out CSS file I will use Buddha step 4 to design the login form so first of all we need to create a login for our design the login form so let's get to start to understand how we can create or design login form first of all I write that there and container Clause call row sorry and plus call lg6 under this do I make a basically class and I write the class and use cause the g'tok under this card I will write another day and call class our title and PG primary text white and then I used basically I do not use our detect because I have when I display the heading login form and PHP and I just write log in from in PHP after the closing car title now you can see that this is the car titled air after closing this deal I will make another day and god glass card body under the body I have white the farm tech action process dot PHP and method I just post and I need to basically use input text fields to get the data from users and assign the name you name and I use placeholder use the lair of that first end another thing is I use collage basically guys farm control copy that and best that's it serve it open the browser end up at the pitch okay I'm gonna display the cart on the center so I use a mulatto on the call algae column so the actual cell it marginata right and I make a space empty five margin top five and also I use basically empty file okay and I use class text shader right and I use smuggle top for turn sorry bedding top three is priced I think to this best that's great okay okay another thing is I use the style in the body section background hash CCC means light grey okay right I wanna make a space between one input tax field and another input text field so I use margin pattern three serve it check it okay that's great please best I use some margin bottom on the another and product field and I need to change the basically password placeholder text and also type and also name and I need to use button login and I use class and and plan success and I use basically new name rockin now the edges empty three means they dispersed between second and pro text field and locked in for right this is our simple farm first of all we need to create a I mean another file and I also database connection files so I press ctrl and to make another file and set this file on the same folder connection dot PHP and first of all I will make a connection I will show you my database basically login form PHP my admin and then I will show you guys my database and this is a matter that as PHP tutorials under the PHP tutorials have a implies I mean imply file sorry table and that the implied table have of one record admin and password also at me okay and those are three columns 1 2 3 so first of all we need to write the basically here make a variable and why the mask you connect connect first parameters localhost second parameter is root third parameter is password password is also ml and fourth parameter is get a base note now the next is I check if dollar corn not a kilo not not stable I do not write d basically and I just try to display the message if our connection is not please check your connection and I use concatenation sign my skill I error okay that's perfect now this is our database I'm in connection now okay now the next step is I close it I create another file process dot PHP okay now you can see it processed our PHP I used action process dot PHP so first of all we need to get the data from the one in protect field and also second input text field so I write the basic syntax of PHP and first of all I write if said I check basically the lenders proposed if any one user click on the login button then this is the login button M okay I check it and press I will just write D basically working now let's check it yeah otherwise if the button not working so now guys save it and open the browser and refer the patch and click it now guys button now okay now for example I click on the process dot PHP and then you can see our not working now guys okay now the first of all first step sorry I need to get the before getting the data we need to make I mean check the input text field our input it unwrapped so you need to write the empathy under the empathy you need to write the dollar underscore post first input text field you know this is amethyst in protects field named after the lost second lost parentheses you need to write our sign and write again empathy and use same process and you need to write this second username I'm in our name you can also use this type of method for example I use dollar name dollar underscore post you name but I don't like it because this time I used one variable it is not good for web development it will get basically I think 4 KB variable gear 4 KB and I think so on so there it's not good so you need to write the same post I mean where to get the data from users without activating of variable ok if our text fields are inputting just a minute I use else if our text field are empty then call here to function and I will redirect with index dot PHP file and I will basically display the URL message and I will get the URL message in these same and protects field ok now I will show you for example I call index dot PHP and I use question mark and I write any variable name this is a car gate variable I write for example empathy and I used a Kel sign and displayed a message please and please fill in the blanks get no I want to display this message on my this is clear first I serve it this self port and I clicked login then you can see I only display the message in the URL right I just click on DM I'm in login button then you can see her and putty and please fill in the blanks but I will not display this message on here so I go to my index dot HTML file sorry PHP file I want to display this basically message after the car titled ever okay so first of all I write the basic PHP syntax and I use this dollar underscore yet this is a calculate variable and you need to pass this variable and party if get variable R chew right then I just need to close the PHP tag and I called PHP tag again huh because I want to use basically guys okay I want to use HTML tags so I close the PHP tag on here this starting PHP tag closing PHP tag and starting PHP tags and closing PHP tag this is a basically if still break it okay under this current thesis clip records all right there and I assigned a class a lot a large light that's danger and inside the day I write PHP and I call the coal dollar and let's go get blankets and I called the empathy variable that's it okay save it save it open the browser and I remove it and refer the page now you can see it but I remove it now this is the error okay how you can remove it you just write the basically at the red Sun in the gate before the gate watch okay click on login now you can see please fill in the blank and I want to display this message in the center text center module top and bottom three please best I think not margin padding top button okay that's great please fill in the blanks okay now the next process is I will basically use QT called Curie and first I need to use require doc burns and call connection file connection lot PHP and I use Curie basically that curious select aesthetic from your table name my table name is imply and you need to write the where keyword and first column name the first column name is Union second okay don't focus on ID column just focus on you name okay this is a mile second column name Union and use a kill sign single cottage in double quotation inside the double partition unit right double dot and you'd need to pass the same where dollar underscore post and you name okay after closing I just remove it basically guys after closing deed I mean after the single quotation I call and keyword and I called second column name past the chair to single quotation double quotation double dot and I passed this second basically post method and final trial minute this is our Curie now I use variable I cleared a variable with the name of result and I used my SQL Curie first of all you need to pass two parameter the one parameter is your connection variable name my connection variable name is corn dot PHP I will show you corn this variable just copy that and go to process dot PHP and paste their second variable is Curie copy that and paste it and I use if MySQL I fetch associate error and passed this variable if the record available under the I mean after using the Curie then the input text field and also database data will match if our data is match our data is match so you need to create a basically session and I passed the basically it all on this post no just a minute I cleared a session yeah I passed this session mmm I think I need to just a minute okay okay guys first I write the basically into any session variable name I like the user and I assign this value okay now the next step is I want to redirect with another page so I use location header sorry location welcome dot php' right if other if our record is not match with the database so I call same header function and I redirect and tags dot PHP file and I rather create a get variable invalid this is my invalid method I mean a new alert message I want to display the user I want to please enter correct username and password this is our message if our user not match the username and password then display this message so I want to display this method on the same login form so you need to process same process I mean you need to follow on the same process go to index dot PHP copy that all caught pest there and you need to just change the variable Rice invalid copying blood hair and that's it save it and I need to create another file welcome dot PHP so I actually ate before creating I basically file welcome dot PHP we need to use start session because I use session session start cell that and I create another file welcome dot PHP and in this page I write basically first I just write the Eco message welcome welcome concatenation sign and I call the session my variable name is user set that and open the browser refer the patch okay remove that first I check mmm what is problem click login nobody's a problem guys just a minute line number three Oh connection okay okay this is a variable son guys click on that where the problem please check your connection connection dot PHP collection a local host root PHP tutorials tutorials connection that PHP connection that PHP pong hmm my skill like one parameter called car the circuit okay please check your connection okay I remove that and after these that I think I need to check the connection localhost okay okay okay there is a problem okay please fill in the blanks I enter in correct username and password please fill in the I mean please enter your user name and password I ain't correct username and password I redirect with another page welcome and this is a basically error variables underscore session LTC so I will show you the problem you name user user possession mmm okay I use basically guys session so I need to use session start okay guys so I need to open browser and after that you're welcome at man okay I shall show you another process I click login and I enter admin and incorrect password I use correct password reject with another welcome page okay first of all we need to use basically if statement if our user just a minute I will show you this if session said Alan is for cessation user and then come into the Welcome message and I will basically use concatenation sound vo-tech and I used core first I use I have logout dot PHP log out and cut that and try to core and pass that serve it okay open the browser okay logout link now we need to basically make a global variable logout this is a logout variable and I need to create another file logout dot PHP and this page you need to call the basically first you need to write the session start because a recession if dollars forget I target basically this log out get variable if this if is said okay just imagine set the global variable and test that I guess session to try and I use header location dot php' otherwise header location and that's dot php' what is this right guys okay I just removed that because I just checked the statement okay guys so let me show you the complete login form okay first of all I go to plugin demo and I enter a correct username incorrect password login are they directly welcome to our PHP page I click on logout I redirect on my index dot PHP file and I direct call these welcome duck PHP why okay I use our sistered min and they basically welcome that PHP file you need to call header application and that's dot PHP it means user can't doubt open the welcome dot PHP file okay let me show you dear okay now the I use correct username and passive then hit enter and I close it I do not use basically I mean click on logout button I just check you I'll just check it okay and I go to welcome that I can do there I am able to see welcome admin page without clicking on logout button if I click on logout but and then I read out on home page and I click on true welcome dot PHP I can't redirect it so this video all about how you can create a login form with the help of sessions I hope you are understood as well thank you very much for watching please subscribe my channel for getting updates have a nice day guys
Info
Channel: OnlineITtuts Tutorials
Views: 121,734
Rating: undefined out of 5
Keywords: php login form with sessions and mysql, login form in php with session, session login and logout in php, login logout session in php, OnlineITtuts Tutorials
Id: PXugYdXCBck
Channel Id: undefined
Length: 30min 52sec (1852 seconds)
Published: Tue Apr 24 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.