Login logout system with session in php for beginners

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys myself Mukesh and today I'm going to show you how to create login logout system in PHP so let's get started so first you need to design login page like this you can customize as per your requirement here I'm showing you I am Cree I created four pages first is login page then log out page and product page and welcome page okay this is my login page which only contain the designing part of the login page no PHP code is here you can see some some CSS code style code okay I am applying to table you can apply as per your requirement here you can say one form is created and inside that form I created it one table in which table header was login and table data was user name and second table data was my textbox for user name after that password and Xbox for password which type is password okay means data is hided from the user and then submit button okay submit button whose value is login and a line is right form action is welcome dot PHP means on click of login button our page is read I redirected to welcome dot PHP and method was pushed okay now see welcome dot PHP what it contains first username and password variable I here said it to static means my username and password was static I settled it to hedeman and head wind you can set my database fetching username password from database and set it to the username variable or password variable okay after that I started one session by session and ESCO start function this is the big and function of PHP okay after that I'm going to check in if Shane you name this global variable is set or not okay he said means user is login okay already login and if not then user was not logged in it need to start or a set my session variable for that I am going to checking if user name enter in the login page and fetched or my static username and the password is matched then and then I'm going to set use my session variable otherwise I am going to redirect user to login page okay and one alert message is displayed to the user that username or password incorrect okay after setting my session I need to reload my page so I am redirecting my page to it page itself okay this is the script JavaScript through I am redirecting to the page okay location dot href is equal to welcome dot PHP once the eustachian is sighted my content of page is displayed okay what is my content page here you can set according your requirement here just for your educational purpose or demo purpose I am going to sell some small content just as welcome message in h1 tag and dollar underscore session username whatever username is there it is displayed here and one is cited one link for a product page okay product page I cited one link to redirect from this bit to the other page after log in without login user cannot access this page so we are using your session ok no after that logout button one button for logout is the okay which is associated to logout dot PHP page now see this page okay this is the login once we are entering username and password we enter here wrong password and try to login you can see username or password incorrect okay without entering username password also things that you can set here your JavaScript to check here it required required a validation here I am not using it okay now entering right username and password and it mean ID mean okay this match session was start and which was reloaded session is started so the data is displayed welcome admin my username and the product link and the one button is logout okay now what is in product product okay Jason will be started to access the me access the station variable we need to start one station then and then we go I can access the session variable now checking is sad a station then and then my content is displayed otherwise I going to redirect login dot PHP okay say son you started so welcome message you can say it here any custom you want I just used some demo content welcome message after that I am echoing one button for going back okay which is associated to the Welcome PHP welcome dot PHP Welcome page okay now going to logout to page so first we do you see the product page okay we can access product page because we are login and after back to Welcome page okay what in the logout shishun will be started to access the station variable now we're going we're going to check in say sunny set you station is said then we destroy this session okay otherwise video we redirect user to the login page okay you can see here and you said then destroy this session and redirect user to the login dot PHP page okay now you can see you're practically logout yeah you can see that user is logged out now user cannot log in okay or cannot access any other page directly without login say welcome dot PHP you can see cannot access user now accessing product page say without login user cannot access any other page so this is the main use of session okay now we entering the right username and admin login so session is started after that session is started so using no need to login again okay user if enter username or not entering password then and also it will be a login if user entering wrong username and password then also it will be a login okay after logout user cannot login again without right credential okay thank you for watching my video if you like then subscribe my channel share my video thank you guys
Info
Channel: Mukesh Chaudhary
Views: 215,401
Rating: undefined out of 5
Keywords: php, login, logout, log in, log out, login in php, session, logout in php, how to create login in php, session in php, how to make login in php, how to, login logout with session in php, login logout in php, how to create login logout with session in php, how to make login logout with session in php, login with session in php, logout with session in php, how to create login with session in php, how to make login with session in php, login system in php, login system
Id: O0Ky0tKvsJ8
Channel Id: undefined
Length: 8min 54sec (534 seconds)
Published: Thu Jan 25 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.