PHP Login System with Admin Features

This forum was created to talk about the PHP Login System with admin features created by jpmaster77 on evolt's website


    Log OUT

    Share

    miyatch7

    Number of posts : 1
    Registration date : 2009-02-24

    Log OUT

    Post  miyatch7 on Tue Feb 24, 2009 1:16 pm

    I have no trouble logging out on my computer and the web browsers i test. But some of my users say the log out link doesn't work. Does anyone know what could cause this.

    I even tried making a new php page called log out with the following code..

    <?php
    include("include/session.php");
    global $session;
    $retval = $session->logout();
    header("Location: ".$session->referrer);

    ?>

    and it works on my computer, but not on the others. What can i do to make it work everywhere? any ideas?
    avatar
    Fred-Eric

    Number of posts : 63
    Registration date : 2007-05-13

    Re: Log OUT

    Post  Fred-Eric on Tue Feb 24, 2009 1:39 pm

    first you don't need to do global $session in this code because session is already global.

    secondo:

    I did something also for the log out process and il is lok like this:

    in main.php add these line just before </body>

    Code:
    <a href="javascript:disconnect();" onclick="javascript:document.disconnect.submit();">disconnect v2</a>
    <div style="display: none;">
    <form action="process.php" method="post" name="disconnect" >
       <input type="hidden" value="1"  name="subdisconnect" />
    </form>   
    </div>

    in process.php add this

    Code:

    elseif (isset($_POST['subdisconnect']) )   $this->procDisconnect();

    and this procDisconnect function

    Code:

    /**
    * Process::procDisconnect()
    *
    * @return
    */
    function procDisconnect()
    {
    global $session;
    $session->logout();
    print <<< eoe
    <script type="text/javascript">
    top.location.replace("destroy_session.php");
    </script>
    eoe;
    }




    and also create a new php files called: destroy_session.php at the same location of the process.php

    insert into this files this code
    Code:

    <?php
    /**
     * destroy_session.php
     * version 1.0.0
     * by fred-eric@lafaille.ca
     * leave this in place
     */
     
    session_start(); //Initialise une session
    $old_session_id = session_id();
    session_destroy(); //Détruit une session *** ne fonctionne pas ***
    session_start(); //Initialise une session
    session_unset(); //Détruit toutes les variables d'une session
    session_regenerate_id();//Remplace l'identifiant de session courant par un nouveau
    $new_session_id = session_id();
    print <<< eoe

    Logout process in progress...
    old session id is : {$old_session_id}<br />
    new session_id is : {$new_session_id}<br />

    <script type="text/javascript">
             <!--
             setTimeout('delayedRedirect()', 5000);
             function delayedRedirect(){
                top.location.replace(".");
             }
                // -->
    </script>
    eoe;
    ?>

      Current date/time is Tue Oct 23, 2018 9:28 am