Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. can't figure is out

can't figure is out

Scheduled Pinned Locked Moved Web Development
phpdatabasesysadmintoolsquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tim Zorn
    wrote on last edited by
    #1

    can someone tell me if theres a way to notify another php page when a page unloads without opening a new window or stopping the user from goin to the site he wants to? im asking this because i need to make a php script that logs people out when the close the window or leave a page. if seen automatic logout things on other websites but i can't figure out how they work? i cant just have cookies that expire when they close the window, because i want to have it so it echo's what users or how many users are currently viewing the page. not just if they have viewed the page. ive seen forums tell u what users are currently logged in..... P.S. if i need to use SQL or sumthing i have access to that on my server also

    A G 2 Replies Last reply
    0
    • T Tim Zorn

      can someone tell me if theres a way to notify another php page when a page unloads without opening a new window or stopping the user from goin to the site he wants to? im asking this because i need to make a php script that logs people out when the close the window or leave a page. if seen automatic logout things on other websites but i can't figure out how they work? i cant just have cookies that expire when they close the window, because i want to have it so it echo's what users or how many users are currently viewing the page. not just if they have viewed the page. ive seen forums tell u what users are currently logged in..... P.S. if i need to use SQL or sumthing i have access to that on my server also

      A Offline
      A Offline
      alex barylski
      wrote on last edited by
      #2

      When the page unloads...??? I don't think thats possible...I think by the time _onbefore_unload() fires it prevents you from doing anything but maybe sending an alert() to the end user.. If memory serves correct I've tried this before, but saving cookies instead of sending HTTP requests...same thing...I got no where... I can tell you that how most systems accomplish this who's logged in/logged out is by actually using a temp session table with records that expire every 15, 20 mins or so. The display of whose online and who isn't...isn't really real time...even if you set the session expiration time to 1 minute...if the session record is created a split second before the person leaves the page/site...that person will apear logged in for another 59 seconds...which is only an illusion :) So to sum it up...you can't do real time, but you can do it so that it gives a good idea as to who is online. HTH Cheers :) It's frustrating being a genius and living the life of a moron!!!

      T 2 Replies Last reply
      0
      • A alex barylski

        When the page unloads...??? I don't think thats possible...I think by the time _onbefore_unload() fires it prevents you from doing anything but maybe sending an alert() to the end user.. If memory serves correct I've tried this before, but saving cookies instead of sending HTTP requests...same thing...I got no where... I can tell you that how most systems accomplish this who's logged in/logged out is by actually using a temp session table with records that expire every 15, 20 mins or so. The display of whose online and who isn't...isn't really real time...even if you set the session expiration time to 1 minute...if the session record is created a split second before the person leaves the page/site...that person will apear logged in for another 59 seconds...which is only an illusion :) So to sum it up...you can't do real time, but you can do it so that it gives a good idea as to who is online. HTH Cheers :) It's frustrating being a genius and living the life of a moron!!!

        T Offline
        T Offline
        Tim Zorn
        wrote on last edited by
        #3

        thanks again hockey:-D

        1 Reply Last reply
        0
        • A alex barylski

          When the page unloads...??? I don't think thats possible...I think by the time _onbefore_unload() fires it prevents you from doing anything but maybe sending an alert() to the end user.. If memory serves correct I've tried this before, but saving cookies instead of sending HTTP requests...same thing...I got no where... I can tell you that how most systems accomplish this who's logged in/logged out is by actually using a temp session table with records that expire every 15, 20 mins or so. The display of whose online and who isn't...isn't really real time...even if you set the session expiration time to 1 minute...if the session record is created a split second before the person leaves the page/site...that person will apear logged in for another 59 seconds...which is only an illusion :) So to sum it up...you can't do real time, but you can do it so that it gives a good idea as to who is online. HTH Cheers :) It's frustrating being a genius and living the life of a moron!!!

          T Offline
          T Offline
          Tim Zorn
          wrote on last edited by
          #4

          ok now i cant figure this out: how do u make a temporary table in an SQL db that expires automatically

          1 Reply Last reply
          0
          • T Tim Zorn

            can someone tell me if theres a way to notify another php page when a page unloads without opening a new window or stopping the user from goin to the site he wants to? im asking this because i need to make a php script that logs people out when the close the window or leave a page. if seen automatic logout things on other websites but i can't figure out how they work? i cant just have cookies that expire when they close the window, because i want to have it so it echo's what users or how many users are currently viewing the page. not just if they have viewed the page. ive seen forums tell u what users are currently logged in..... P.S. if i need to use SQL or sumthing i have access to that on my server also

            G Offline
            G Offline
            Guffa
            wrote on last edited by
            #5

            The only way to notify the server is to catch the onunload event and open a new window that logs the person out. The event fires when the page unloads for any reason, so you have to keep track of where you are going. This of course only works if javascript is enabled, and no popup blocker stops the code from opening the window. --- b { font-weight: normal; }

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups