1. #1

    Registriert seit
    24.04.2014
    Beiträge
    105
    Thanked 627 Times in 47 Posts

    Standard vBulletin 4.x Sessions löschen (User abmelden)

    Hallo,

    ich möchte in meinem Forum bestimmte User zu einem Logout zwingen. Diese bestimmten User sind Moderatoren.
    Ich hab ein Plugin programmiert, welches erst bei einem erneuten Login greift. Was und wozu es benötigt wird, ist irrelevant.

    Mein Problem:

    Normale User kann ich sehr einfach zum Logout erzwingen, indem ich den Session-Eintrag in der Datenbank mit der ID "X" entferne.
    Bei den Moderatoren & Admins funktioniert das nicht. Egal welche Session ich lösche, Admins und Moderatoren bleiben eingeloggt, dazu gehört auch mein Account.

    Habe mir daraufhin die includes/functions_login.php angeschaut und die Function process_logout gefunden:

    Spoiler:

    PHP-Code:
    function process_logout()
    {
        global 
    $vbulletin;

        
    // clear all cookies beginning with COOKIE_PREFIX
        
    $prefix_length strlen(COOKIE_PREFIX);
        foreach (
    $_COOKIE AS $key => $val)
        {
            
    $index strpos($keyCOOKIE_PREFIX);
            if (
    $index == AND $index !== false)
            {
                
    $key substr($key$prefix_length);
                if (
    trim($key) == '')
                {
                    continue;
                }
                
    // vbsetcookie will add the cookie prefix
                
    vbsetcookie($key''1);
            }
        }

        if (
    $vbulletin->userinfo['userid'] AND $vbulletin->userinfo['userid'] != -1)
        {
            
    // init user data manager
            
    $userdata =& datamanager_init('User'$vbulletinERRTYPE_SILENT);
            
    $userdata->set_existing($vbulletin->userinfo);
            
    $userdata->set('lastactivity'TIMENOW $vbulletin->options['cookietimeout']);
            
    $userdata->set('lastvisit'TIMENOW);
            
    $userdata->save();

            
    // make sure any other of this user's sessions are deleted (in case they ended up with more than one)
            
    $vbulletin->db->query_write("DELETE FROM " TABLE_PREFIX "session WHERE userid = " $vbulletin->userinfo['userid']);
        }

        
    $vbulletin->db->query_write("DELETE FROM " TABLE_PREFIX "session WHERE sessionhash = '" $vbulletin->db->escape_string($vbulletin->session->vars['dbsessionhash']) . "'");

        
    // Remove accesstoken from apiclient table so that a new one will be generated
        
    if (defined('VB_API') AND VB_API === true AND $vbulletin->apiclient['apiclientid'])
        {
            
    $vbulletin->db->query_write("UPDATE " TABLE_PREFIX "apiclient SET apiaccesstoken = '', userid = 0
                WHERE apiclientid = " 
    intval($vbulletin->apiclient['apiclientid']));
            
    $vbulletin->apiclient['apiaccesstoken'] = '';
        }

        if (
    $vbulletin->session->created == true AND !VB_API)
        {
            
    // if we just created a session on this page, there's no reason not to use it
            
    $newsession $vbulletin->session;
        }
        else
        {
            
    // API should always create a new session here to generate a new accesstoken
            
    $newsession = new vB_Session($vbulletin''0''$vbulletin->session->vars['styleid']);
        }
        
    $newsession->set('userid'0);
        
    $newsession->set('loggedin'0);
        
    $newsession->set_session_visibility(($vbulletin->superglobal_size['_COOKIE'] > 0));
        
    $vbulletin->session =& $newsession;

        (
    $hook vBulletinHook::fetch_hook('logout_process')) ? eval($hook) : false;



    So wie ich das intepretiere, ändert die .php-Datei ja nur den Wert des Cookies. Wieso wird der Moderator / Admin (habs mit meinem eigenen Account getestet) dann nicht ausgeloggt?
    Könnt ihr mir bitte dabei weiter helfen?

  2. #2

    Registriert seit
    24.04.2014
    Beiträge
    105
    Thanked 627 Times in 47 Posts

    Standard AW: vBulletin 4.x Sessions löschen (User abmelden)

    Keiner ne Idee?

Ähnliche Themen

  1. GEZ abmelden und nichts mehr zahlen?!
    Von TomatenKetchup im Forum Recht- und Verbraucherschutz
    Antworten: 9
    Letzter Beitrag: 10.08.2014, 16:25
  2. Sessions !
    Von Saad im Forum PHP
    Antworten: 11
    Letzter Beitrag: 25.05.2013, 17:30
  3. Abmelden
    Von sahan im Forum Support
    Antworten: 2
    Letzter Beitrag: 26.12.2012, 11:56
  4. User Löschen Problem
    Von Killerspider im Forum PHP
    Antworten: 3
    Letzter Beitrag: 20.02.2012, 00:49
Diese Seite nutzt Cookies, um das Nutzererlebnis zu verbessern. Klicken Sie hier, um das Cookie-Tracking zu deaktivieren.