Automatic Logout after 15 minutes of user Inactivity using PHP

Поділитися
Вставка
  • Опубліковано 29 січ 2025

КОМЕНТАРІ • 33

  • @suleimanabdullahi3190
    @suleimanabdullahi3190 26 днів тому

    You need an ajax call that keeps checking if the session exceeds the amount of time set, then log you out. That is where "automatic" comes from. This will require a refresh from the active user.

  • @hsert29
    @hsert29 6 років тому +13

    How does this track user inactivity? This just logs you out after 15 minutes. There is nothing on the code that checks whether or not user is performing any action. They could be filling in crucial information and the session will still be destroyed when the time runs out.

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

      What you can do is place $_SESSION['timeStamp'] = time() on every page, so that every time a user visits a new page the time stamp is refreshed. After $_SESSION['timeStamp'] you would check to see if the user has been inactive by using time() - $_SESSION['timeStamp'] > inactivityTime.
      The downside of this is that if the user is just browsing the same page for x amount of minutes and happens to be over your inactivity time the user would have to login again.

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

      exactly this is the main point of the subject log out should be after 15 minute if ===> the user doesn't performing any action

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

    even if you are active this method logging you out after the time you set

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

    I think in a serious pitfall, let's imagine an user whose access a page where he is just watching a long video, he will be disconnected into server side, but he is an active user. creation of a heartbeat with ajax not sounds a good approach

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

    Friends, this is very nice tutorial

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

    I think there should be a popup on which written your session has exxpired without page refreshing

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

      A popup is a browser action. If he uses a cookie then the browser can keep track of the login time out.

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

    What if we want to make the page empty after 1 week .
    As i'm design notice board application in which I 'll be making validation to clear all the notices from dashboard .? Plz help make vedio explaining such query

  • @pianoLee-sx9dx
    @pianoLee-sx9dx 5 років тому +1

    how would you convert hours to seconds?

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

      1 hour = 60 mins
      1 min = 60 secs
      8 hours = 8*60*60 = 28800 secs

    • @pianoLee-sx9dx
      @pianoLee-sx9dx 3 роки тому +1

      @@pxxl42 thanks

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

    Shall we increase the timing

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

    how automatic refresh after login time stamp is true

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

    How to do Run countdown timer automatically if webpage not opening in php while running event. & Update SQL database while zero.

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

    sir can your please make a video lesson in which the bootstrap modal popup should fetch the data from mysql data base. and the same modal we have next and previous button by click the next button the next row data should display in the same modal without refresh.

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

    Can you please tell me that how to do this task using laravel framework of php?

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

    Thank you very much.

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

    It is doing logout during activity also.

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

    Good Job boy this is help me btw saya orang indo you:V sengaja cari yg inggris

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

    nice work
    thanks

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

    thank you so much :)

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

    Are you a robot? Friends....

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

    Thank you so much!

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

    Hi bro, are you available at any moment? I really need some help with my php functions if you care to take a look. Please let me know how i can contact you xp

  • @ScrapersNbots
    @ScrapersNbots Місяць тому

    gotta love bots

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

    Tks!

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

    saved my day

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

    Good job bro, JESUS IS COMING BACK SOON;PREPARE

  • @herbertk9266
    @herbertk9266 8 років тому

    nice