PHP Scripting Forums » PHP Classes Support Forum » Access_user Class Support forum

Forcing logout on leaving a protected page

(8 posts)
Please support us by buying these products:

  1. Hello Olaf,

    Real good work (Access_User Class). You can see it working here: http://www.pre-sales.ch/html/login.php
    Question: Is it possible to force a logout on leaving a protected page and if yes how?
    Thanks and regards.

    Posted 5 months ago #
  2. Hello,

    great that you like this class. Why do you need this feature? (the session is closed of the user closed his window)

    Posted 5 months ago #
  3. Hello Olaf

    The protected page has some setup that directly reflects online, adding also new reccords in a database, thus I do not want to make it too trivial for the user to come back (after leaving the page) and add more and more reccords... Call it a psychological barrier and the expression of a real will, through renewed login, to add new reccords... Possible?

    Posted 5 months ago #
  4. just destroy (unset) the session after some transaction is done

    Posted 5 months ago #
  5. Ok, it works with: onsubmit="<?php session_start(); unset($_SESSION); $_SESSION=array(); session_destroy();?>"
    I was really looking for a less destructive logout like a logout function within your classes... But it works so let it be. Thanks.

    Posted 5 months ago #
  6. ??? just put unset($_SESSION['login']) somewhere in your code, that should do the trick...

    Posted 5 months ago #
  7. Hello Olaf

    Replacing the code above (scripted action) by a sole <?php unset($_SESSION['login']);?>, does not do it for me. The protected page is a form with a SUBMIT button and when clicked, the php code is executed on page exiting. I also tried to put it in various places on the page without success.

    Posted 5 months ago #
  8. I would do this:

    if (isset($_POST)) {
      // do the other form related stuff
      unset($_SESSION['login'];
    }

    almost the same code as in the class.

    or this is possible to:

    if (isset($_POST)) {
      // do the other form related stuff
      $myclass_obj->log_out();
    }
    Posted 5 months ago #

RSS feed for this topic

Reply

You must log in to post.