Jump to content

john010117

Members
  • Posts

    492
  • Joined

  • Last visited

    Never

Posts posted by john010117

  1. Have this:

    $page = $_SERVER['PHP_SELF'];
    $_SESSION['page_check'] = $page;
    

    on login.php

     

    and on the process page, have something like this:

    <?php
    session_start();
    if($_SESSION['page_check'] == "login.php") {
       unset($_SESSION['page_check']);
       // Proceed
    }
    else {
       unset($_SESSION['page_check']);
       // Fail - Display an error message
    }
    ?>
    

  2. Let's say you wanted to log a user out after 10 minutes. Create a new function named whatever you want, and a new column in the table named something like last_activity and set the type to timestamp. In the function, use strtotime to check when the user was last active, and if that was more than 10 minutes ago, unset the session for that user. Put the function in a file, and include/require that for every secure page.

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.