View Single Post
  #1  
Old 10-07-2008, 02:16 PM
LittleB@ LittleB@ is offline
 
Join Date: Oct 2007
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default I need some help with this eqdkp bridge - possibly a session management issue

To make a long story short, I've found a eqdkp bridge that supposedly should allow me to use one single user account for both my forums and my eqdkp-site.

The original eqdkp session.php is included as an attachment. The istructions for the bridge code are as follows:

Find:
PHP Code:
/**
   * Attempt to log in a user 
After, replace everything with:
PHP Code:
   *
   * @
param $username
   
* @param $password
   
* @param $auto_login Save login in cookie?
   * @return 
bool
   
*/
   function 
login($username$password$auto_login)
   {
            
// EDIT BY OBRAX - Thanks to Kazan for phpbb3-Bridge
            // Vbulletin - EQDKP - Bridge

//echo $a_username ." versucht ?ber vb-bridge einzuloggen. -- ";

//            global $user,;
              
global $db$eqdkp;

            
$a_username strtolower($username);

            
$vb_prefix "vb3_"// Change to your vb-Prefix
            
$group_ids "1,2,3";   // Change to the Group-ID(s) who should be allowed to log in to eqdkp

            
$sql "SELECT user_id, username, user_password, user_email
                            FROM " 
USERS_TABLE "
                            WHERE username='" 
$a_username "'";

            
$local_users_table $db->query($sql);


            
$sql "SELECT userid, password, email, salt
        FROM "
.$vb_prefix."user
        WHERE username='" 
$a_username "'";
            
$remote_users_table $db->query($sql);

            if ( 
$rut_row $db->fetch_record($remote_users_table) )
            {
//echo "Remote-Userid: ".$rut_row[userid]." -- ";
                //Remote user check passed
                
$db->free_result($remote_users_table);
                
$db->free_result($remote_groups_table);

                
$sql "SELECT count(*) as valid FROM ".$vb_prefix."user WHERE (membergroupids like '%$group_ids%' or usergroupid='$group_ids') and userid='" $rut_row['userid'] . "'";
                
$remote_groups_table $db->query($sql);

                
$rgt_row $db->fetch_record($remote_groups_table);

//echo $rgt_row['valid']." User mit Berechtigung gefunden -- ";
                //Checking remote user table");
                
if ( (md5(md5($password).$rut_row['salt']) == $rut_row['password']) && $rgt_row['valid'] > 0)
                {
//echo "Eingegebenes vb-Passwort korrekt -- ";
                    //Remote active check passed
                    
if ($lut_row $db->fetch_record($local_users_table))
                    {
//echo "EQDKP-Passwort synchronisiert -- ";
                        //Local user found
                        //sync password
                        
$sql "UPDATE " USERS_TABLE " SET user_password='" md5(md5($password).$rut_row['salt']) .
                                        
"' WHERE username='" $a_username "'";
                        
$db->query($sql);
                        
$userid $lut_row['user_id'];
                    }
                    else
                    {
                        
//Creating local user
                        //create local row
                          
$sql "insert into " USERS_TABLE " set username='".$a_username."', user_password='".md5(md5($password).$rut_row['salt'])."', user_email='".$rut_row['email']."', user_active='1', user_style=".$eqdkp->config['default_style'].", user_lang='".$eqdkp->config['default_lang']."'";
                        
$db->query($sql);
//echo $a_username . $password . $rut_row['salt'] . $rut_row['email'] . users_table;
                        
$userid $db->insert_id();
                        
$sql 'SELECT auth_id, auth_default
                                        FROM ' 
AUTH_OPTIONS_TABLE '
                                        ORDER BY auth_id'
;
                        
$result $db->query($sql);
                        while ( 
$row $db->fetch_record($result) )
                        {
                            
$sql 'INSERT INTO ' AUTH_USERS_TABLE "
                                            (user_id, auth_id, auth_setting)
                                            VALUES ('" 
$userid "','" $row['auth_id'] . "','" $row['auth_default'] . "')";
                            
$db->query($sql);
//echo "EQDKP-User angelegt und Daten synchronisiert -- Login ?ber dein vb-Passwort -- ";
                        
}
                        
$db->free_result($result);
                    }
                    
$db->free_result($local_users_table);

                    
$auto_login = ( !empty($auto_login) ) ? md5($password) : '';
                    return 
$this->create($userid$auto_logintrue);
                }
            }
            return 
false;
        }
}
?> 
Whenever I try to log in with a user that exist on my forums and that is in one of the allowed user groups I get an error saying I provided the wrong passowrd or that I am using an account which is not active.

My php skills are limited and I have little understanding of how to really work with mysql - I'm a true novice and that's why I turn to you :erm:

any way, I enabled the various echo lines and tracked down my first halt at
PHP Code:
echo $rgt_row['valid']." User mit Berechtigung gefunden -- "
which would basically tell me "0 authenticated users found" even thou I am absolutely sure I am entering the correct name and password and that the user (my admin acc) is in a group that should be allowed to use eqdkp according to the $group_ids variable.

so basically, what am I missing, does it have something to do with the session/password/whathever management in vbulletin which is not taken care of here or what am I missing?

In an attempt to be as detailed as possible I will include the eqdkp login.php as well, oh, and I am using the latest vbulletin forums (vBulletin 3.7.3 Patch Level 1) together with eqdkp-1.3.2f (but you will be able to see the code in my attachments any way)

I'd appreciate the tiniest help/hint with this, thnx in advance

Edit, creds to the original author of the bridge which can be found here:
http://forums.eqdkp.com/index.php?showtopic=10360
Attached Files
File Type: php session.php (19.4 KB, 3 views)
File Type: php login.php (2.7 KB, 1 views)
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01399 seconds
  • Memory Usage 1,885KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (2)postbit_attachment
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete