Login logout system with session in php for beginners

Поділитися
Вставка
  • Опубліковано 5 лют 2025
  • "Hey guys if this video helps you then please subscribe my channel to support me.Thanks :)" *
    In this video i will show you how to make login and logout system with session in php.Without login user can not acces the other page of your website excluding login page.If user try to acces other page by direct link then he should be redirected to login page.
    if user loged in then user can acces all the page of website.
    After logout session was destroyed and user have to login again to acces all the page.
    i hope you like this video.
    Please Subscribe my channel and like,share this video.
    Thank you.
    #php #loginlogout #session

КОМЕНТАРІ •

  • @mukeshchaudhary1688
    @mukeshchaudhary1688  5 років тому +16

    * "Hey guys if this video helps you then please please dont forget to subscribe my channel that will inspire me to make such more videos for you. Thanks guys for watching my video :)" *

    • @psblogs8494
      @psblogs8494 5 років тому +1

      Thnks bro... its useful

    • @robloxprisonlife3390
      @robloxprisonlife3390 5 років тому

      the video helps me but but but but i won't subscribe i'm not satisfy i want hardcore video codings also you got a reward 1 DISLIKE

    • @VinodGupta-dj8my
      @VinodGupta-dj8my 5 років тому +1

      Bhai video Hindi rakna chahiye

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  5 років тому +1

      @@VinodGupta-dj8my ha bhai age k video hindi mehi ayege

    • @VinodGupta-dj8my
      @VinodGupta-dj8my 5 років тому

      @@mukeshchaudhary1688 Bhai plz muj yah video Hindi me chahiye acha bataya ha tum ne but English me samj nai raha ha

  • @engineerrajkumar
    @engineerrajkumar 3 роки тому +2

    Thank you sir jo hamse class me nahi samjha wo aapne samjha diya wo bhi 5 min me

  • @HustleAndStrum
    @HustleAndStrum 3 роки тому +5

    This was just what I needed. Just finished my first user authenticated website thanks to you. Your explanation was very clear and it all makes sense. It's amazing how so much functionality can be jammed into so little code. Thank you.

  • @nandhuim1958
    @nandhuim1958 2 роки тому +2

    thank u sooo much. i hv been struggling last two days.

  • @hardik8245
    @hardik8245 Рік тому +1

    point to point explanation. Very informative.

  • @09AKHLESH
    @09AKHLESH 4 роки тому +1

    Thanks so much bro....very helpfulll your video

  • @aimalamiri9874
    @aimalamiri9874 4 роки тому +1

    Thanks bro very helpful video in such a short time

  • @kimberlyalbarda119
    @kimberlyalbarda119 3 роки тому +1

    This is what I am looking for. Thankyou so much Sir..

  • @redseantlworld
    @redseantlworld 4 роки тому +1

    Shukriya Mukesh bhai, gotta say. You made an excellent tutorial, all I need to do is connect this to a database.

  • @Nope-259
    @Nope-259 3 роки тому +1

    concept of session is well defined here Tnx

  • @walzen6654
    @walzen6654 3 роки тому +1

    Thank you for the video.

  • @vishalprajapati5381
    @vishalprajapati5381 3 роки тому +1

    Thank you so much brother it really helped me 🙏🙏🙏

  • @AkramLaamri
    @AkramLaamri Рік тому +1

    Thank you so much, love your content!

  • @mahdibouchenaf7215
    @mahdibouchenaf7215 4 роки тому +1

    Thank you very mutch for being simple and streight

  • @juliovitorino1296
    @juliovitorino1296 6 років тому +2

    Nice vídeo. Simple anda Clean. Great!

  • @newsmix8659
    @newsmix8659 5 років тому +3

    Well explained! keep the videos coming!

  • @CSC315
    @CSC315 4 роки тому +2

    Thank you for posting this video.

  • @kuba-uncensored
    @kuba-uncensored 4 роки тому

    Awesome, best login php tutorial on yt.

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  4 роки тому +1

      Thanks 😊 watch my second video of login system with database.

  • @vinaygupta2016
    @vinaygupta2016 5 років тому +1

    bhai bhut badiya ,, your teaching to programming is much good ..bro, i wish ,.. you try maintain to upload continusly with these types of videos and for this video thanks bro.....

  • @rajkumargaikwad5706
    @rajkumargaikwad5706 5 років тому +2

    tysm alot mukesh brother , this video stood really helpful for me as well as my partner...............i just needed the second page codes ...............because it is not totally available on the video...................it is only till 25th line............i need the below codes also..............tysm brother

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  5 років тому +1

      Thanks man, please watch carefully I showed all the code in this video.. If you looking for welcome page code then watch at 3.15 minute you will get it.😊

    • @rajkumargaikwad5706
      @rajkumargaikwad5706 5 років тому +1

      Mukesh Chaudhary there u go brother✨tysm for ur valuable time for me May God bless uhh brother, stay happie and keeping helping

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  5 років тому +1

      @@rajkumargaikwad5706 thank you so much 😊😊

  • @vickievik8464
    @vickievik8464 4 роки тому +1

    Good tutorial Bro... Keep it up.

  • @audiobeats4728
    @audiobeats4728 5 років тому +5

    i subscribed... I am expecting more cool videos, so simple and just what i needed..because i just learned php and ajax.. really need session tutorials

  • @joshuaoliverarreza2887
    @joshuaoliverarreza2887 6 років тому +2

    Thank you so much. I was looking for something like this. You are seriously a big help.

  • @emmagrace5168
    @emmagrace5168 4 роки тому +2

    Thank you so much for this video!! It really helped me with an assignment I have been struggling with.

  • @iffathumaira4846
    @iffathumaira4846 5 років тому +1

    thank you soo much..your video is what i exactly wanteddd..thank u again

  • @Bestodds1
    @Bestodds1 6 років тому +1

    Thanks very much. This really, Really, REALLY helped me!

  • @Sahibyar0
    @Sahibyar0 4 роки тому +1

    Great method

  • @harshalgaidhane4001
    @harshalgaidhane4001 4 роки тому +1

    Description box mai. Code bhi dalaa karo bahot help ho jayegi...

  • @cromuelbarut9859
    @cromuelbarut9859 4 роки тому +1

    thanks! my saviour! new subsriber here

  • @katze405
    @katze405 3 роки тому +1

    you are awesome thank you!

  • @ifargantech
    @ifargantech 6 років тому +1

    Wonderful. this is nice simple tutorial.... but please show using the database

  • @karan47837
    @karan47837 2 роки тому

    registration page be bnao plz saath mai oska table be show ho and vo session ki value get kare to login ho other wise na ho

  • @lloydfernandes119
    @lloydfernandes119 6 років тому +3

    Thank you so much! This is exactly what I needed :)

  • @vikasandroidgamer
    @vikasandroidgamer 5 років тому +1

    Nice bro🤟🤟🤟

  • @anissyuhadaamirhamidi9474
    @anissyuhadaamirhamidi9474 5 років тому +3

    Thanks sir for the awesome tutorial! It really helpful :D

  • @wraith460
    @wraith460 5 років тому +4

    Hey Mukesh !! you had really done a excellent work!! Keep it up and thanks for this great help!! I will be more thankful to you if you can provide the source code, so that We can try it ourself!!

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  5 років тому +1

      Sorry but i don't have code now.. I formated my PC so..

    • @wraith460
      @wraith460 5 років тому

      @@mukeshchaudhary1688 yeah i can understand that.. Actually everything is okay but i just need the code for welcome.php file.. As i was basically learning about sessions

  • @songlover9437
    @songlover9437 4 роки тому +1

    U have taken static values...when I tried using values from db...it is not displaying anything...actually session is not starting...it would b very helpful for me to know how to login with dynamic values

  • @trandingindia2617
    @trandingindia2617 3 роки тому +1

    Thanks brother

  • @Moukraan
    @Moukraan 6 років тому +2

    nice video! thanks a lot

  • @madanjitender
    @madanjitender 6 років тому +1

    Brilliant teaching

  • @madanjitender
    @madanjitender 6 років тому +1

    In logout.php why we need redirection in if else statement? Cant we just unset the session with if statement and after if redirect.

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  6 років тому

      After unset session also we need to redirect for login without redirecting how it comes to know what to do after unset.

    • @madanjitender
      @madanjitender 6 років тому

      In logout script... Redirection is defined twice on line 8 (in if statement) and line 12 (in else statement). If we unset the session with only if statement and close it then pass on the redirect without else statement.

  • @mjfcjam
    @mjfcjam 2 роки тому +1

    Great video. Very good. I have a question. Can I put several usernames and passwords into the session? For using for more than one user?

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  2 роки тому

      You need database for that.. For more clarification watch my second video of login.

  • @mohamedfowsan6172
    @mohamedfowsan6172 6 років тому +1

    Good. Thank you so much bro

  • @debasishchatterjee9478
    @debasishchatterjee9478 6 років тому +1

    awesome sir please carry onnnnnnnnnnnnnnn

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  6 років тому

      debasish chatterjee thank you 😊 and plz subscribe my channel and like this video.

  • @thenguyenvo18
    @thenguyenvo18 3 роки тому +1

    This is what I am looking for. Thank you!!!

  • @MisterFiddle
    @MisterFiddle 4 роки тому +1

    but, AFTER you've logged out, what happens if the user clicks the browser BACK button?

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  4 роки тому

      We destroyed session so it checked session again if not set then it will redirect user to login page

  • @madanjitender
    @madanjitender 6 років тому +1

    Can you teach, integrating two web application on a webserver? Where user logins into one webapp gets logged into other application as well

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  6 років тому

      Sorry bro i don't know about this.

    • @casul-4891
      @casul-4891 6 років тому

      So basically you mean there is two types of web, the first one is for the login menu, and then the next is for the web ?

  • @cegum1
    @cegum1 6 років тому +2

    Superb video. I tried applying your code in GoDaddy's cPanel and found some issues with the code. How can I make your Php Sessions code work in cPanel?

  • @a_sunshine_21
    @a_sunshine_21 4 роки тому

    Vry hlpful

  • @vaishalisingh6275
    @vaishalisingh6275 3 роки тому

    Perfect example.❤️

  • @mohamedabdiahmed401
    @mohamedabdiahmed401 5 років тому +1

    What is difference b/w login& welcome page.??

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  5 років тому

      if login successful then it will redirect you to welcome page.. Without login you can't access any page rather then login.

  • @rithikasasitharan5398
    @rithikasasitharan5398 4 роки тому

    While username and password is correct we redditecf them to welcome page but why a session variable is set there?

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  4 роки тому

      We are setting session in welcome page in case of session is not set. Check if conditions carefully. Session is set in else part.

    • @rithikasasitharan5398
      @rithikasasitharan5398 4 роки тому

      @@mukeshchaudhary1688 if they are incorrect we can just pop a msg it's incorrect know why session variable needs to be set?

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  4 роки тому

      We are setting it in case of correct and redirecting to the same page and if incorrect then showing pop up and redirecting to login page. Please check code.

    • @rithikasasitharan5398
      @rithikasasitharan5398 4 роки тому +1

      @@mukeshchaudhary1688 thank you

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  4 роки тому

      @@rithikasasitharan5398 welcome 🤗

  • @viditshah6552
    @viditshah6552 7 років тому

    nice one 😊😊😊

  • @muhammadsufiyan7429
    @muhammadsufiyan7429 6 років тому +1

    Hi nice sir. But can you please help me out for time session of expire in 5 min ??
    Thanks

  • @58__tannurawat95
    @58__tannurawat95 3 роки тому

    Ohhhh mukesh 😂😂 sapna kesi hai she is with you or in nalasupara 🤣🤣

  • @Weeb814
    @Weeb814 6 років тому +2

    It doesn't work on me..why???
    Incorrect username

  • @timeless-JAT
    @timeless-JAT 4 роки тому

    Hello Mukesh, I want to know how to host a website globally from own computer.

  • @tijnrodrigo5065
    @tijnrodrigo5065 4 роки тому

    Hi Mukesh, How can i allow a 2nd person to login? And without a database?

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  4 роки тому

      You need to use database and registration page. Without database it is not feasible way to do it. But you can do it with session variables by storing user data in it.

  • @sonykallingal2792
    @sonykallingal2792 Рік тому

    How to show a html page after successful login.. Pls help

  • @paules2376
    @paules2376 10 місяців тому

    Thank you

  • @Theaaruh
    @Theaaruh 4 роки тому +1

    Pge Ko run krne pr output kis taraf niklte h

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  4 роки тому

      Output hamesha client side dikhta he... Uska processing server side hota he.

    • @Theaaruh
      @Theaaruh 4 роки тому

      @@mukeshchaudhary1688 me esa bol ri hu bro localhost me run nhi ho rha Mene new strt kiya h to muje pta ni h bro to localhost likhne pr nhi aa rha

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  4 роки тому

      @@Theaaruh xampp control panel me Apache server and mysql server start kiya?

    • @Theaaruh
      @Theaaruh 4 роки тому

      Haa kiya h

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  4 роки тому

      Then file save kha ki he?

  • @techworld6602
    @techworld6602 5 років тому +1

    Thanx sir

  • @kerbyangelopatungan2021
    @kerbyangelopatungan2021 5 років тому +1

    when i type right credentials, it always appear wrong username or password. where was the error?

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  5 років тому

      Do you following same procedure shown in this video?

    • @kerbyangelopatungan2021
      @kerbyangelopatungan2021 5 років тому

      @@mukeshchaudhary1688 yes sir but it always appear wrong credentials

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  5 років тому

      @@kerbyangelopatungan2021 then check the if conditions once again.. Maybe you missed some conditions or misplaced if block... Check and reply.

    • @kerbyangelo4055
      @kerbyangelo4055 5 років тому

      @@mukeshchaudhary1688 i already check it one by one but its always the same

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  5 років тому

      @@kerbyangelo4055 then mail me all of your code file.. I will check it

  • @prasadaute2264
    @prasadaute2264 6 років тому +1

    Can you show same login using phpmyadmin database

  • @aziilahjm7170
    @aziilahjm7170 4 роки тому +1

    How to log in with multi user(user have a role like staff supervisor or admin)

  • @SureshKumar-mu3jo
    @SureshKumar-mu3jo 6 років тому +1

    thanks for this video session

  • @venkateshbingi8978
    @venkateshbingi8978 7 років тому +1

    nicely explained

  • @alliahadvincula1399
    @alliahadvincula1399 4 роки тому +1

    sir can i ask? how to connect this log in system to the bootsrap?

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  4 роки тому

      That's only designing part which is client side... You can use as per your requirement... Php remain same

  • @priyankawankhede5658
    @priyankawankhede5658 5 років тому

    how to use sessions for multiple login and if we want to show the particular page to the particular login.

    • @kalingirisridhar
      @kalingirisridhar 5 років тому

      Same doubt if you know this pls help me because it's depends on marks for me

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  5 років тому

      okay then first explain whats your exact requirements..what kind of multiple login and for what?

    • @kalingirisridhar
      @kalingirisridhar 5 років тому

      Basically Iam a student it's on my project I want a session how it work

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  5 років тому

      @@kalingirisridhar that's okay but where you want to use session? For a particular task or just for project features that you used session

    • @kalingirisridhar
      @kalingirisridhar 5 років тому

      @@mukeshchaudhary1688 it's just for project

  • @ronnelmacompas1647
    @ronnelmacompas1647 4 роки тому +1

    Thank you so much!

  • @tigsims
    @tigsims 10 місяців тому

    Directly session cookies use are too risky.. use token as cookies..

  • @shreshthkant6267
    @shreshthkant6267 6 років тому +1

    when i open the login.php only a code is visible...

  • @rohinselva6159
    @rohinselva6159 6 років тому +1

    Can you provide the link for the above code!! It will be really helpful

  • @khandaker402
    @khandaker402 5 років тому +1

    *JUST A GREAT VIDEO BOSS!*

  • @mokhlesrahman3800
    @mokhlesrahman3800 4 роки тому

    such like above I create a logout, it makes out of current page and redirect to index.php page but by clicking back button, reopen the logged page. How can I resolve it

  • @anomolisagag2270
    @anomolisagag2270 5 років тому +1

    even though i insert wrong username and pass, it still logged in? help

  • @riddhigameti7924
    @riddhigameti7924 7 років тому

    very helpful video

  • @eRRor-_-ZeUs
    @eRRor-_-ZeUs 4 роки тому

    Hello ,
    Thats Very Helpful Video But In Where Can I Get The Code !?

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  4 роки тому +1

      No source available. You can type all the code from this video.

  • @TECLOVENIA
    @TECLOVENIA 4 роки тому +1

    Bro, please help me with this: I want to login with matching username and password from database table and display only selected data from the other tables using PHP. If you have enough time to. Thank you in anticipation.

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  4 роки тому

      Sure.. I will post this tutorial soon 👍

    • @TECLOVENIA
      @TECLOVENIA 4 роки тому

      If you please bro, kindly add along with file upload.
      Thanks a lot.

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  4 роки тому

      @@TECLOVENIA I already uploaded a video regarding file uploading in php. Please watch that video

    • @TECLOVENIA
      @TECLOVENIA 4 роки тому +1

      @@mukeshchaudhary1688 Thanks a lot bro 👍

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  4 роки тому

      @@TECLOVENIA ua-cam.com/video/IO6djibkpFo/v-deo.html watch this video 👍

  • @vjon8873
    @vjon8873 Рік тому +1

    ❤❤

  • @iqraekra1670
    @iqraekra1670 4 роки тому

    sir my alert message does not display?

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  4 роки тому

      Please check out code again. You may have syntax error or wrong code flow.

  • @shashiacharya8803
    @shashiacharya8803 5 років тому +1

    Good vedio but I want same several users

  • @karldavealmeria8768
    @karldavealmeria8768 5 років тому +1

    it is using MYSQL database?

  • @Windstale
    @Windstale 4 роки тому

    how to create pdf upload image upload after login as admin please help

  • @mulatuhailie6564
    @mulatuhailie6564 2 роки тому

    thankd

  • @sukhmandersingh2106
    @sukhmandersingh2106 5 років тому +1

    excellent bro but how to set user name & password

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  5 років тому

      If you creating real web application then you have to set username and password in database table then you have to fetch username and password from database and store to the variables

  • @ssramanjaneyulu2321
    @ssramanjaneyulu2321 6 років тому +1

    simply super

  • @sadstatusguru3926
    @sadstatusguru3926 3 роки тому

    CSS ka code link bhej dijiye sir plz

  • @sbilogo2440
    @sbilogo2440 5 років тому +1

    Hello sir I want help to create a project in php

  • @tuyizeredaniel2418
    @tuyizeredaniel2418 5 років тому

    i wanna to become a web developer how can you help me?

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  5 років тому

      If you want to become professional web developer then i suggest you to get training of php from any good institute or company.

  • @chiengeugene2540
    @chiengeugene2540 5 років тому

    The only problem is the user just need to enter yourdomain.com/welcome.php then he can skip the authentication

  • @hafiztouseef6184
    @hafiztouseef6184 5 років тому

    After "to" there is 1st form of verb

  • @houssemgran999
    @houssemgran999 5 років тому +1

    u can user the header() function instead

  • @amitezuthachan5779
    @amitezuthachan5779 4 роки тому

    bro are you on discord or slack?

  • @ShubhamKumar-pw5qx
    @ShubhamKumar-pw5qx 4 роки тому

    English se accha hindi hi bol lete hesitate ho rahe the bhai and thanks

  • @codenflowin1094
    @codenflowin1094 Рік тому +1

    Yea

  • @MrGlitchyII
    @MrGlitchyII 5 років тому

    Is this venerable to hacks?

  • @mdmahasin3936
    @mdmahasin3936 5 років тому

    I need this code for project so if you sent me it will be helpful to me

  • @coolairsolution3552
    @coolairsolution3552 4 роки тому

    When i run your code i get this error.

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  4 роки тому

      Which error?

    • @coolairsolution3552
      @coolairsolution3552 4 роки тому

      $uname="admin"; $pwd="admin"; session_startO; if(isset($_SESSION[ 'uname' ])) { echo "
      Welcome " .$ SESSION[ 'uname' ]."
      "; echo "product
      "; echo "
      < input type=button value=logout name=logout>"; ) else( if ($_POSTrunamel==$uname && $_POST[ 'pwd' ]=$pwd) ( $_SESSION[ 'uname' ]=$uname; echo "

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  4 роки тому

      @@coolairsolution3552 all errors are solved.. Check your email inbox. 😊😊

    • @coolairsolution3552
      @coolairsolution3552 4 роки тому +1

      Thank you so much for this. New the code is working. It really helped me.

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  4 роки тому

      @@coolairsolution3552 welcome 😊. If you want login with database then watch my latest video.

  • @mr.chikambu3793
    @mr.chikambu3793 6 років тому +2

    where is source code bro.

    • @mukeshchaudhary1688
      @mukeshchaudhary1688  6 років тому

      It's accidentally deleted... i don't have copy of this... You can write your own.. By watching this video i explained and showed everything in it... I hope it's helps you bro...