Logout from amember with another site

Discussion in 'Customization & add-ons' started by strongcord, Mar 14, 2009.

  1. strongcord

    strongcord New Member

    Joined:
    Feb 6, 2009
    Messages:
    14
    I have the following logout script for amember:
    Code:
    <?php
    require_once('https://aMemberSite.com/config.inc.php');
    setcookie('_amember_ru', '', time() - 3600 * 26, '/');
    setcookie('_amember_rp', '', time() - 3600 * 26, '/');
    $to_delete = array();
    
    plugin_after_logout($_SESSION['_amember_user']);
    
    foreach ($_SESSION as $k=>$v){
       if (!preg_match('/^_amember/', $k) || $k == '_amember_login_attempt_id') continue;
       $to_delete[] = $k;
    }
    
    foreach ($to_delete as $k){
       if (ini_get('register_globals'))
           session_unregister($k);
       else
           unset($_SESSION[$k]);
       unset($$k);
    }
    
    
    session_write_close();
    if (!$config['protect']['php_include']['redirect'])
        @($config['protect']['php_include']['redirect'] = 
            'http://' . $_SERVER['HTTP_HOST'] . '/'); 
            
    ?>
    The script is stored in a PHP file on the aMemberSite.com (https://amembersite.com/customlogout.php). After i access it and return to the Member page i see that i am logged out. That's great. When i try to execute the "customlogout.php" script that is described above from another site like: https://aMemberSite2.com/customlogout.php the logout doesn't work. I think the problem is with the session information. What can i do to have it working ?

Share This Page