Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If this site has a login script / log out script you could</p> <ol> <li>When a user ends a session (logs out) then you can run a query to update with the users session user-name and the time stamp </li> <li>If a users session times out (possibly he leaves the website but does not log out) you could have a query run with the username and time stamp to have data on when a users session timed out and how long the session was alive for. </li> <li>If a user logs in use that session user-name / inputted user-name to store the session data in the database. </li> </ol> <p>These are just some ways of doing it (the first two ways that came to mind). Take a look at <a href="http://www.php.net/manual/en/book.session.php" rel="nofollow">sessions on PHP</a> for further help. Also for the query stuff take a look at <a href="http://php.net/manual/en/book.pdo.php" rel="nofollow">PHP PDO</a> Again I just want to reiterate this is the first two things that came to mind, and with the information provided I came up with the following recommendations. Hopefully this is some sort of help / a "AH - HAH!" moment. Enjoy sir. </p> <blockquote> <blockquote> <p>Edit 1</p> </blockquote> </blockquote> <p>If by any chance you are trying to have a query run once the browser is closed / a user hits a link to an external domain then no as deceze commented you can should not trust in the browser to notify the server. But like I posted above the edit you could use the above mentioned methods to do close to what you were asking. </p> <p>Also don't forget to read up on <a href="https://www.owasp.org/index.php/Session_Management_Cheat_Sheet" rel="nofollow">OWAPS's PHP session security cheat sheet</a>.. This and PHP user manual should be your best friends :D</p> <p>Again hopefully this is some use to you! </p> <p>Happy coding :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload