View Single Post
  #209  
Old 04-25-2005, 12:14 PM
Till Till is offline
 
Join Date: May 2002
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Providing hacks and not supporting them is quite useless. Maybe the moderators could flag hacks that are not supported by the authors as that. Saves time and you don't install stuff that doesn't work right anyway.

I stopped scanning this thread on page 10 or whatever, but I guess since people still have issues, I post my mods.

Here is my setup:
- latest coppermine (1.3.3)
- vbulletin 3.0.6 (German)

The version of Coppermine that I have came with the bridge file for PHP. Since the one provided here didn't work and the file distributed with Coppermine had the cookie fix already applied to, I used it as base of my modifications to make it work.

Warning: The edits are quite techy and I will not support this.

bridge/vbulletin30.inc.php
1) You do all the obvious magic (database settings, ...)
2) Code hacking

Find this (around line 91):
PHP Code:
$got_user 0;

if (
$bbuserid && $bbpassword) {
    
// If userid and password exist in cookies we use them to login 
And replace the following query ($sql = ...) and the mysql_num_rows() statement with this:

PHP Code:
$got_user 0;

if (
$bbuserid && $bbpassword) {
    
// If userid and password exist in cookies we use them to login
    
$sql "SELECT userid as user_id, username as user_name, usergroupid as mgroup, password, salt ";
    
$sql.= "FROM " $UDB_DB_NAME_PREFIX VB_TABLE_PREFIX VB_USER_TABLE " ";
    
$sql.= "WHERE userid='" addslashes(stripslashes($bbuserid)) . "'";
    if(!(
$result db_query($sql$UDB_DB_LINK_ID))){
        echo 
'Error: '.mysql_error().'<br/>';
        echo 
'Query: '.$sql.'<br/>';
        echo 
'File: '.__FILE__.'<br/>';
        exit;
    }
    if (
mysql_num_rows($result) > 0) {
        
$USER_DATA mysql_fetch_array($result);
        if (
$bbpassword != md5($USER_DATA['password'] . $USER_DATA['salt'])) {
            
$got_user 1;
        }
    }
... 
So, what did I change here? First of all, I made the $sql query readable. There is an unwritten law that when you write code, you try to break it up after 65 chars (makes printing and reading easier).

Then I added the field "salt" to the SELECT-statement. It's used in vbulletin's login/authentication methods. Last but not least, I changed the if()-statement to check the password stored in the cookie against the password stored in the database.

If you want to have a look at the way vbuelltin does the authentication magic, feel free to browse includes/function-login.php under your vbulletin installation.

Ok, this is it. Not it works for me. Hope this actually helps someone else. If I find anything else, I will post again.

Cheers,
Till
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01871 seconds
  • Memory Usage 1,791KB
  • Queries Executed 11 (?)
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
  • (2)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
  • (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_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete