Automatic Logout after 15 minutes of user Inactivity using PHP

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ก.ย. 2024
  • How to destroy session in php if user inactive since last 15 minutes. If user inactive for last 15 minutes and after he refresh page then he will automatically logout from website and redirect to login page. Source Code - www.webslesson....

ความคิดเห็น • 31

  • @hsert29
    @hsert29 6 ปีที่แล้ว +11

    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

  • @elkhanhamet2561
    @elkhanhamet2561 4 ปีที่แล้ว

    Friends, this is very nice tutorial

  • @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.

  • @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

  • @srinivasaprasanna6691
    @srinivasaprasanna6691 4 ปีที่แล้ว

    Shall we increase the timing

  • @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.

  • @susmitkarmaker2945
    @susmitkarmaker2945 6 ปีที่แล้ว

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

  • @dhakprasadupreti6249
    @dhakprasadupreti6249 ปีที่แล้ว

    Thank you very much.

  • @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

  • @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

  • @RIEFGANZ
    @RIEFGANZ 4 ปีที่แล้ว

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

  • @rahmatjo6837
    @rahmatjo6837 2 ปีที่แล้ว

    how automatic refresh after login time stamp is true

  • @edberaga
    @edberaga 2 ปีที่แล้ว

    Thank you so much!

  • @Q8Duelist
    @Q8Duelist 3 ปีที่แล้ว

    thank you so much :)

  • @ComputerGyani
    @ComputerGyani 5 ปีที่แล้ว

    It is doing logout during activity also.

  • @khamrashed
    @khamrashed 4 ปีที่แล้ว

    nice work
    thanks

  • @AruljothySundramoorthy
    @AruljothySundramoorthy 3 ปีที่แล้ว

    saved my day

  • @alanopatricio4490
    @alanopatricio4490 5 ปีที่แล้ว

    Tks!

  • @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

  • @thechoosen4240
    @thechoosen4240 2 ปีที่แล้ว

    Good job bro, JESUS IS COMING BACK SOON;PREPARE

  • @herbertk9266
    @herbertk9266 7 ปีที่แล้ว

    nice

    • @webslesson
      @webslesson  7 ปีที่แล้ว

      Thanks Herbert...

  • @PabloPazosGutierrez
    @PabloPazosGutierrez 3 ปีที่แล้ว

    Are you a robot? Friends....