MyBB.support, le portail francophone de MyBB
problèmes conenction avec une autre base de donné - Version imprimable

+- MyBB.support, le portail francophone de MyBB (https://mybb.support)
+-- Forum : MyBB.fr (https://mybb.support/forum-1.html)
+--- Forum : Support (https://mybb.support/forum-5.html)
+--- Sujet : problèmes conenction avec une autre base de donné (/thread-4009.html)



problèmes conenction avec une autre base de donné - lilirageuse - 17-04-2011

Bonjour
j'ais décidée de changez le chemin de la connection pour que on puisse se connectée sur le forum > site

jais changez tout les chemin de member.php
Code PHP :
<?php
/**
 * MyBB 1.6
 * Copyright 2010 MyBB Group, All Rights Reserved
 *
 * Website: http://mybb.com
 * License: http://mybb.com/about/license
 *
 * $Id: member.php 5126 2010-07-27 07:48:04Z RyanGordon $
 */

define("IN_MYBB"1);
define('THIS_SCRIPT''member.php');
define("ALLOWABLE_PAGE""register,do_register,login,do_login,logout,lostpw,do_lostpw,activate,resendactiv​ation,do_resendactivation,resetpassword");

$nosession['avatar'] = 1;
$templatelist "member_register,error_nousername,error_nopassword,error_passwordmismatch,error_i​nvalidemail,error_usernametaken,error_emailmismatch,error_noemail,redirect_regis​tered";
$templatelist .= ",redirect_loggedout,login,redirect_loggedin,error_invalidusername,error_invalidp​assword,member_profile_email,member_profile_offline,member_profile_reputation,me​mber_profile_warn,member_profile_warninglevel,member_profile_customfields_field,​member_profile_customfields,member_profile_adminoptions,member_profile,member_lo​gin,member_profile_online,member_profile_modoptions,member_profile_signature,mem​ber_profile_groupimage,member_profile_referrals";
require_once 
"./global.php";

require_once 
MYBB_ROOT."inc/functions_post.php";
require_once 
MYBB_ROOT."inc/functions_user.php";
require_once 
MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;

// Load global language phrases
$lang->load("member");

// Make navigation
switch($mybb->input['action'])
{
    case 
"register":
    case 
"do_register":
        
add_breadcrumb($lang->nav_register);
        break;
    case 
"activate":
        
add_breadcrumb($lang->nav_activate);
        break;
    case 
"resendactivation":
        
add_breadcrumb($lang->nav_resendactivation);
        break;
    case 
"lostpw":
        
add_breadcrumb($lang->nav_lostpw);
        break;
    case 
"resetpassword":
        
add_breadcrumb($lang->nav_resetpassword);
        break;
    case 
"login":
        
add_breadcrumb($lang->nav_login);
        break;
    case 
"emailuser":
        
add_breadcrumb($lang->nav_emailuser);
        break;
}

if((
$mybb->input['action'] == "register" || $mybb->input['action'] == "do_register") && $mybb->usergroup['cancp'] != 1)
{
    if(
$mybb->settings['disableregs'] == 1)
    {
        
error($lang->registrations_disabled);
    }
    if(
$mybb->user['regdate'])
    {
        
error($lang->error_alreadyregistered);
    }
    if(
$mybb->settings['betweenregstime'] && $mybb->settings['maxregsbetweentime'])
    {
        
$time TIME_NOW;
        
$datecut $time-(60*60*$mybb->settings['betweenregstime']);
        
$query $db->simple_select("accounts""*""regip='".$db->escape_string($session->ipaddress)."' AND regdate > '$datecut'");
        
$regcount $db->num_rows($query);
        if(
$regcount >= $mybb->settings['maxregsbetweentime'])
        {
            
$lang->error_alreadyregisteredtime $lang->sprintf($lang->error_alreadyregisteredtime$regcount$mybb->settings['betweenregstime']);
            
error($lang->error_alreadyregisteredtime);
        }
    }
}

if(
$mybb->input['action'] == "do_register" && $mybb->request_method == "post")
{
    
$plugins->run_hooks("member_do_register_start");

    if(
$mybb->settings['regtype'] == "randompass")
    {
        
$mybb->input['pass'] = random_str();
        
$mybb->input['pass2'] = $mybb->input['pass'];
    }

    if(
$mybb->settings['regtype'] == "verify" || $mybb->settings['regtype'] == "admin" || $mybb->input['coppa'] == 1)
    {
        
$usergroup 5;
    }
    else
    {
        
$usergroup 2;
    }

    
// Set up user handler.
    
require_once MYBB_ROOT."inc/datahandlers/user.php";
    
$userhandler = new UserDataHandler("insert");

    
// Set the data for the new user.
    
$user = array(
        
"account" => $mybb->input['account'],
        
"pass" => $mybb->input['pass'],
        
"password2" => $mybb->input['password2'],
        
"email" => $mybb->input['email'],
        
"email2" => $mybb->input['email2'],
        
"usergroup" => $usergroup,
        
"referrer" => $mybb->input['referrername'],
        
"timezone" => $mybb->input['timezoneoffset'],
        
"language" => $mybb->input['language'],
        
"profile_fields" => $mybb->input['profile_fields'],
        
"regip" => $session->ipaddress,
        
"longregip" => my_ip2long($session->ipaddress),
        
"coppa_user" => intval($mybb->cookies['coppauser']),
    );
    
    if(isset(
$mybb->input['regcheck1']) && isset($mybb->input['regcheck2']))
    {
        
$user['regcheck1'] = $mybb->input['regcheck1'];
        
$user['regcheck2'] = $mybb->input['regcheck2'];
    }

    
// Do we have a saved COPPA DOB?
    
if($mybb->cookies['coppadob'])
    {
        list(
$dob_day$dob_month$dob_year) = explode("-"$mybb->cookies['coppadob']);
        
$user['birthday'] = array(
            
"day" => $dob_day,
            
"month" => $dob_month,
            
"year" => $dob_year
        
);
    }

    
$user['options'] = array(
        
"allownotices" => $mybb->input['allownotices'],
        
"hideemail" => $mybb->input['hideemail'],
        
"subscriptionmethod" => $mybb->input['subscriptionmethod'],
        
"receivepms" => $mybb->input['receivepms'],
        
"pmnotice" => $mybb->input['pmnotice'],
        
"emailpmnotify" => $mybb->input['emailpmnotify'],
        
"invisible" => $mybb->input['invisible'],
        
"dstcorrection" => $mybb->input['dstcorrection']
    );

    
$userhandler->set_data($user);

    
$errors "";

    if(!
$userhandler->validate_user())
    {
        
$errors $userhandler->get_friendly_errors();
    }

    if(
$mybb->settings['captchaimage'] == && function_exists("imagecreatefrompng"))
    {
        
$imagehash $db->escape_string($mybb->input['imagehash']);
        
$imagestring $db->escape_string(my_strtolower($mybb->input['imagestring']));
        
$query $db->simple_select("captcha""*""imagehash='$imagehash' AND LOWER(imagestring)='$imagestring'");
        
$imgcheck $db->fetch_array($query);
        if(!
$imgcheck['dateline'])
        {
            
$errors[]  = $lang->error_regimageinvalid;
        }
        
$db->delete_query("captcha""imagehash='$imagehash'");
    }

    if(
is_array($errors))
    {
        
$account htmlspecialchars_uni($mybb->input['account']);
        
$email htmlspecialchars_uni($mybb->input['email']);
        
$email2 htmlspecialchars_uni($mybb->input['email']);
        
$referrername htmlspecialchars_uni($mybb->input['referrername']);

        if(
$mybb->input['allownotices'] == 1)
        {
            
$allownoticescheck "checked=\"checked\"";
        }

        if(
$mybb->input['hideemail'] == 1)
        {
            
$hideemailcheck "checked=\"checked\"";
        }

        if(
$mybb->input['subscriptionmethod'] == 1)
        {
            
$no_email_subscribe_selected "selected=\"selected\"";
        }
        else if(
$mybb->input['subscriptionmethod'] == 2)
        {
            
$instant_email_subscribe_selected "selected=\"selected\"";
        }
        else
        {
            
$no_subscribe_selected "selected=\"selected\"";
        }

        if(
$mybb->input['receivepms'] == 1)
        {
            
$receivepmscheck "checked=\"checked\"";
        }

        if(
$mybb->input['pmnotice'] == 1)
        {
            
$pmnoticecheck " checked=\"checked\"";
        }

        if(
$mybb->input['emailpmnotify'] == 1)
        {
            
$emailpmnotifycheck "checked=\"checked\"";
        }

        if(
$mybb->input['invisible'] == 1)
        {
            
$invisiblecheck "checked=\"checked\"";
        }

        if(
$mybb->input['dstcorrection'] == 2)
        {
            
$dst_auto_selected "selected=\"selected\"";
        }
        else if(
$mybb->input['dstcorrection'] == 1)
        {
            
$dst_enabled_selected "selected=\"selected\"";
        }
        else
        {
            
$dst_disabled_selected "selected=\"selected\"";
        }

        
$regerrors inline_error($errors);
        
$mybb->input['action'] = "register";
        
$fromreg 1;
    }
    else
    {
        
$user_info $userhandler->insert_user();

        if(
$mybb->settings['regtype'] != "randompass" && !$mybb->cookies['coppauser'])
        {
            
// Log them in
            
my_setcookie("mybbuser"$user_info['guid']."_".$user_info['loginkey'], nulltrue);
        }

        if(
$mybb->cookies['coppauser'])
        {
            
$lang->redirect_registered_coppa_activate $lang->sprintf($lang->redirect_registered_coppa_activate$mybb->settings['bbname'], $user_info['account']);
            
my_unsetcookie("coppauser");
            
my_unsetcookie("coppadob");
            
$plugins->run_hooks("member_do_register_end");
            
error($lang->redirect_registered_coppa_activate);
        }
        else if(
$mybb->settings['regtype'] == "verify")
        {
            
$activationcode random_str();
            
$now TIME_NOW;
            
$activationarray = array(
                
"guid" => $user_info['guid'],
                
"dateline" => TIME_NOW,
                
"code" => $activationcode,
                
"type" => "r"
            
);
            
$db->insert_query("awaitingactivation"$activationarray);
            
$emailsubject $lang->sprintf($lang->emailsubject_activateaccount$mybb->settings['bbname']);
            
$emailmessage $lang->sprintf($lang->email_activateaccount$user_info['account'], $mybb->settings['bbname'], $mybb->settings['bburl'], $user_info['guid'], $activationcode);
            
my_mail($user_info['email'], $emailsubject$emailmessage);
            
            
$lang->redirect_registered_activation $lang->sprintf($lang->redirect_registered_activation$mybb->settings['bbname'], $user_info['account']);

            
$plugins->run_hooks("member_do_register_end");

            
error($lang->redirect_registered_activation);
        }
        else if(
$mybb->settings['regtype'] == "randompass")
        {
            
$emailsubject $lang->sprintf($lang->emailsubject_randompassword$mybb->settings['bbname']);
            
$emailmessage $lang->sprintf($lang->email_randompassword$user['account'], $mybb->settings['bbname'], $user_info['account'], $user_info['pass']);
            
my_mail($user_info['email'], $emailsubject$emailmessage);

            
$plugins->run_hooks("member_do_register_end");

            
error($lang->redirect_registered_passwordsent);
        }
        else if(
$mybb->settings['regtype'] == "admin")
        {
            
$lang->redirect_registered_admin_activate $lang->sprintf($lang->redirect_registered_admin_activate$mybb->settings['bbname'], $user_info['account']);

            
$plugins->run_hooks("member_do_register_end");

            
error($lang->redirect_registered_admin_activate);
        }
        else
        {
            
$lang->redirect_registered $lang->sprintf($lang->redirect_registered$mybb->settings['bbname'], $user_info['account']);

            
$plugins->run_hooks("member_do_register_end");

            
redirect("index.php"$lang->redirect_registered);
        }
    }
}

if(
$mybb->input['action'] == "coppa_form")
{
    if(!
$mybb->settings['faxno'])
    {
        
$mybb->settings['faxno'] = "&nbsp;";
    }
    
    eval(
"\$coppa_form = \"".$templates->get("member_coppa_form")."\";");
    
output_page($coppa_form);
}

if(
$mybb->input['action'] == "register")
{
    
$bdaysel '';
    if(
$mybb->settings['coppa'] == "disabled")
    {
        
$bdaysel $bday2blank "<option value=\"\">&nbsp;</option>";
    }
    for(
$i 1$i <= 31; ++$i)
    {
        if(
$mybb->input['bday1'] == $i)
        {
            
$bdaysel .= "<option value=\"$i\" selected=\"selected\">$i</option>\n";
        }
        else
        {
            
$bdaysel .= "<option value=\"$i\">$i</option>\n";
        }
    }

    
$bdaymonthsel[$mybb->input['bday2']] = "selected=\"selected\"";
    
$mybb->input['bday3'] = intval($mybb->input['bday3']);

    if(
$mybb->input['bday3'] == 0$mybb->input['bday3'] = "";

    
// Is COPPA checking enabled?
    
if($mybb->settings['coppa'] != "disabled" && !$mybb->input['step'])
    {
        
// Just selected DOB, we check
        
if($mybb->input['bday1'] && $mybb->input['bday2'] && $mybb->input['bday3'])
        {
            
my_unsetcookie("coppauser");
            
            
$bdaytime = @mktime(000$mybb->input['bday2'], $mybb->input['bday1'], $mybb->input['bday3']);
            
            
// Store DOB in cookie so we can save it with the registration
            
my_setcookie("coppadob""{$mybb->input['bday1']}-{$mybb->input['bday2']}-{$mybb->input['bday3']}", -1);

            
// User is <= 13, we mark as a coppa user
            
if($bdaytime >= mktime(000my_date('n'), my_date('d'), my_date('Y')-13))
            {
                
my_setcookie("coppauser"1, -0);
                
$under_thirteen true;
            }
            
$mybb->request_method "";
        }
        
// Show DOB select form
        
else
        {
            
$plugins->run_hooks("member_register_coppa");
            
            
my_unsetcookie("coppauser");
            
            eval(
"\$coppa = \"".$templates->get("member_register_coppa")."\";");
            
output_page($coppa);
            exit;
        }
    }

    if((!isset(
$mybb->input['agree']) && !isset($mybb->input['regsubmit'])) || $mybb->request_method != "post")
    {
        
// Is this user a COPPA user? We need to show the COPPA agreement too
        
if($mybb->settings['coppa'] != "disabled" && ($mybb->cookies['coppauser'] == || $under_thirteen))
        {
            if(
$mybb->settings['coppa'] == "deny")
            {
                
error($lang->error_need_to_be_thirteen);
            }
            
$lang->coppa_agreement_1 $lang->sprintf($lang->coppa_agreement_1$mybb->settings['bbname']);
            eval(
"\$coppa_agreement = \"".$templates->get("member_register_agreement_coppa")."\";");
        }

        
$plugins->run_hooks("member_register_agreement");

        eval(
"\$agreement = \"".$templates->get("member_register_agreement")."\";");
        
output_page($agreement);
    }
    else
    {
        
$plugins->run_hooks("member_register_start");
        
        
$validator_extra '';

        if(isset(
$mybb->input['timezoneoffset']))
        {
            
$timezoneoffset $mybb->input['timezoneoffset'];
        }
        else
        {
            
$timezoneoffset $mybb->settings['timezoneoffset'];
        }
        
$tzselect build_timezone_select("timezoneoffset"$timezoneoffsettrue);

        
$stylelist build_theme_select("style");

        if(
$mybb->settings['usertppoptions'])
        {
            
$tppoptions '';
            
$explodedtpp explode(","$mybb->settings['usertppoptions']);
            if(
is_array($explodedtpp))
            {
                foreach(
$explodedtpp as $val)
                {
                    
$val trim($val);
                    
$tppoptions .= "<option value=\"$val\">".$lang->sprintf($lang->tpp_option$val)."</option>\n";
                }
            }
            eval(
"\$tppselect = \"".$templates->get("usercp_options_tppselect")."\";");
        }
        if(
$mybb->settings['userpppoptions'])
        {
            
$pppoptions '';
            
$explodedppp explode(","$mybb->settings['userpppoptions']);
            if(
is_array($explodedppp))
            {
                foreach(
$explodedppp as $val)
                {
                    
$val trim($val);
                    
$pppoptions .= "<option value=\"$val\">".$lang->sprintf($lang->ppp_option$val)."</option>\n";
                }
            }
            eval(
"\$pppselect = \"".$templates->get("usercp_options_pppselect")."\";");
        }
        if(
$mybb->settings['usereferrals'] == && !$mybb->user['guid'])
        {
            if(
$mybb->cookies['mybb']['referrer'])
            {
                
$query $db->simple_select("accounts""guid,account""guid='".$db->escape_string($mybb->cookies['mybb']['referrer'])."'");
                
$ref $db->fetch_array($query);
                
$referrername $ref['account'];
            }
            elseif(
$referrer)
            {
                
$query $db->simple_select("accounts""account""guid='".intval($referrer['guid'])."'");
                
$ref $db->fetch_array($query);
                
$referrername $ref['account'];
            }
            elseif(
$referrername)
            {
                
$query $db->simple_select("accounts""guid""LOWER(account)='".$db->escape_string(my_strtolower($referrername))."'");
                
$ref $db->fetch_array($query);
                if(!
$ref['guid'])
                {
                    
$errors[] = $lang->error_badreferrer;
                }
            }
            if(
$quickreg)
            {
                
$refbg "trow1";
            }
            else
            {
                
$refbg "trow2";
            }
            
// JS validator extra
            
$validator_extra .= "\tregValidator.register('referrer', 'ajax', {url:'xmlhttp.php?action=username_exists', loading_message:'{$lang->js_validator_checking_referrer}'});\n";

            eval(
"\$referrer = \"".$templates->get("member_register_referrer")."\";");
        }
        else
        {
            
$referrer '';
        }
        
// Custom profile fields baby!
        
$altbg "trow1";
        
$query $db->simple_select("profilefields""*""editable=1", array('order_by' => 'disporder'));
        while(
$profilefield $db->fetch_array($query))
        {
            
$profilefield['type'] = htmlspecialchars_uni($profilefield['type']);
            
$thing explode("\n"$profilefield['type'], "2");
            
$type trim($thing[0]);
            
$options $thing[1];
            
$select '';
            
$field "fid{$profilefield['fid']}";
            if(
$errors)
            {
                
$userfield $mybb->input['profile_fields'][$field];
            }
            else
            {
                
$userfield '';
            }
            if(
$type == "multiselect")
            {
                if(
$errors)
                {
                    
$useropts $userfield;
                }
                else
                {
                    
$useropts explode("\n"$userfield);
                }
                if(
is_array($useropts))
                {        
                    foreach(
$useropts as $key => $val)
                    {
                        
$seloptions[$val] = $val;
                    }
                }
                
$expoptions explode("\n"$options);
                if(
is_array($expoptions)) 
                {
                    foreach(
$expoptions as $key => $val)
                    {
                        
$val trim($val);
                        
$val str_replace("\n""\\n"$val);

                        
$sel "";
                        if(
$val == $seloptions[$val])
                        {
                            
$sel "selected=\"selected\"";
                        }
                        
$select .= "<option value=\"$val\" $sel>$val</option>\n";
                    }
                    if(!
$profilefield['length'])
                    {
                        
$profilefield['length'] = 3;
                    }
                    
$code "<select name=\"profile_fields[$field][]\" id=\"{$field}\" size=\"{$profilefield['length']}\" multiple=\"multiple\">$select</select>";
                }
            }
            elseif(
$type == "select")
            {
                
$expoptions explode("\n"$options);
                if(
is_array($expoptions))
                {
                    foreach(
$expoptions as $key => $val)
                    {
                        
$val trim($val);
                        
$val str_replace("\n""\\n"$val);
                        
$sel "";
                        if(
$val == $userfield)
                        {
                            
$sel "selected=\"selected\"";
                        }
                        
$select .= "<option value=\"$val\" $sel>$val</option>";
                    }
                    if(!
$profilefield['length'])
                    {
                        
$profilefield['length'] = 1;
                    }
                    
$code "<select name=\"profile_fields[$field]\" id=\"{$field}\" size=\"{$profilefield['length']}\">$select</select>";
                }
            }
            elseif(
$type == "radio")
            {
                
$expoptions explode("\n"$options);
                if(
is_array($expoptions))
                {
                    foreach(
$expoptions as $key => $val)
                    {
                        
$checked "";
                        if(
$val == $userfield)
                        {
                            
$checked "checked=\"checked\"";
                        }
                        
$code .= "<input type=\"radio\" class=\"radio\" name=\"profile_fields[$field]\" id=\"{$field}{$key}\" value=\"$val\" $checked /> <span class=\"smalltext\">$val</span><br />";
                    }
                }
            }
            elseif(
$type == "checkbox")
            {
                if(
$errors)
                {
                    
$useropts $userfield;
                }
                else
                {
                    
$useropts explode("\n"$userfield);
                }
                if(
is_array($useropts))
                {
                    foreach(
$useropts as $key => $val)
                    {
                        
$seloptions[$val] = $val;
                    }
                }
                
$expoptions explode("\n"$options);
                if(
is_array($expoptions)) 
                {
                    foreach(
$expoptions as $key => $val)
                    {
                        
$checked "";
                        if(
$val == $seloptions[$val])
                        {
                            
$checked "checked=\"checked\"";
                        }
                        
$code .= "<input type=\"checkbox\" class=\"checkbox\" name=\"profile_fields[$field][]\" id=\"{$field}{$key}\" value=\"$val\" $checked /> <span class=\"smalltext\">$val</span><br />";
                    }
                }
            }
            elseif(
$type == "textarea")
            {
                
$value htmlspecialchars_uni($userfield);
                
$code "<textarea name=\"profile_fields[$field]\" id=\"{$field}\" rows=\"6\" cols=\"30\" style=\"width: 95%\">$value</textarea>";
            }
            else
            {
                
$value htmlspecialchars_uni($userfield);
                
$maxlength "";
                if(
$profilefield['maxlength'] > 0)
                {
                    
$maxlength " maxlength=\"{$profilefield['maxlength']}\"";
                }
                
$code "<input type=\"text\" name=\"profile_fields[$field]\" id=\"{$field}\" class=\"textbox\" size=\"{$profilefield['length']}\"{$maxlength} value=\"$value\" />";
            }
            if(
$profilefield['required'] == 1)
            {
                
// JS validator extra
                
if($type == "checkbox" || $type == "radio")
                {
                    
$id "{$field}0";
                }
                else
                {
                    
$id "fid{$profilefield['fid']}";
                }
                
$validator_extra .= "\tregValidator.register('{$id}', 'notEmpty', {failure_message:'{$lang->js_validator_not_empty}'});\n";
                
                eval(
"\$requiredfields .= \"".$templates->get("member_register_customfield")."\";");
            }
            
$code '';
            
$select '';
            
$val '';
            
$options '';
            
$expoptions '';
            
$useropts '';
            
$seloptions '';
        }
        if(
$requiredfields)
        {
            eval(
"\$requiredfields = \"".$templates->get("member_register_requiredfields")."\";");
        }
        if(!
$fromreg)
        {
            
$allownoticescheck "checked=\"checked\"";
            
$hideemailcheck '';
            
$emailnotifycheck '';
            
$receivepmscheck "checked=\"checked\"";
            
$pmnoticecheck " checked=\"checked\"";
            
$emailpmnotifycheck '';
            
$invisiblecheck '';
            if(
$mybb->settings['dstcorrection'] == 1)
            {
                
$enabledstcheck "checked=\"checked\"";
            }
            
        }
        
// Spambot registration image thingy
        
if($mybb->settings['captchaimage'] == && function_exists("imagecreatefrompng"))
        {
            
$randomstr random_str(5);
            
$imagehash md5(random_str(12));
            
$regimagearray = array(
                
"imagehash" => $imagehash,
                
"imagestring" => $randomstr,
                
"dateline" => TIME_NOW
            
);
            
$db->insert_query("captcha"$regimagearray);
            eval(
"\$regimage = \"".$templates->get("member_register_regimage")."\";");

            
// JS validator extra
            
$validator_extra .= "\tregValidator.register('imagestring', 'ajax', {url:'xmlhttp.php?action=validate_captcha', extra_body: 'imagehash', loading_message:'{$lang->js_validator_captcha_valid}', failure_message:'{$lang->js_validator_no_image_text}'});\n";
        }
        if(
$mybb->settings['regtype'] != "randompass")
        {
            
// JS validator extra
            
$lang->js_validator_password_length $lang->sprintf($lang->js_validator_password_length$mybb->settings['minpasswordlength']);
            
$validator_extra .= "\tregValidator.register('pass', 'length', {match_field:'password2', min: {$mybb->settings['minpasswordlength']}, failure_message:'{$lang->js_validator_password_length}'});\n";

            
// See if the board has "require complex passwords" enabled.
            
if($mybb->settings['requirecomplexpasswords'] == 1)
            {
                
$lang->pass $lang->complex_pass $lang->sprintf($lang->complex_pass$mybb->settings['minpasswordlength']);
                
$validator_extra .= "\tregValidator.register('pass', 'ajax', {url:'xmlhttp.php?action=complex_password', loading_message:'{$lang->js_validator_password_complexity}'});\n";
            }
            
$validator_extra .= "\tregValidator.register('pass2', 'matches', {match_field:'pass', status_field:'password_status', failure_message:'{$lang->js_validator_password_matches}'});\n";

            eval(
"\$passboxes = \"".$templates->get("member_register_password")."\";");
        }

        
// JS validator extra
        
if($mybb->settings['maxnamelength'] > && $mybb->settings['minnamelength'] > 0)
        {
            
$lang->js_validator_username_length $lang->sprintf($lang->js_validator_username_length$mybb->settings['minnamelength'], $mybb->settings['maxnamelength']);
            
$validator_extra .= "\tregValidator.register('account', 'length', {min: {$mybb->settings['minnamelength']}, max: {$mybb->settings['maxnamelength']}, failure_message:'{$lang->js_validator_username_length}'});\n";
        }

        
$languages $lang->get_languages();
        
$langoptions '';
        foreach(
$languages as $lname => $language)
        {
            
$language htmlspecialchars_uni($language);
            if(
$user['language'] == $lname)
            {
                
$langoptions .= "<option value=\"$lname\" selected=\"selected\">$language</option>\n";
            }
            else
            {
                
$langoptions .= "<option value=\"$lname\">$language</option>\n";
            }
        }

        
$plugins->run_hooks("member_register_end");

        eval(
"\$registration = \"".$templates->get("member_register")."\";");
        
output_page($registration);
    }
}

if(
$mybb->input['action'] == "activate")
{
    
$plugins->run_hooks("member_activate_start");

    if(
$mybb->input['account'])
    {
        
$query $db->simple_select("accounts""*""LOWER(account)='".$db->escape_string(my_strtolower($mybb->input['account']))."'", array('limit' => 1));
        
$user $db->fetch_array($query);
        if(!
$accouts['account'])
        {
            
error($lang->error_invalidpworusername);
        }
        
$guid $user['guid'];
    }
    else
    {
        
$query $db->simple_select("accounts""*""guid='".intval($mybb->input['guid'])."'");
        
$user $db->fetch_array($query);
    }
    if(
$mybb->input['code'] && $user['guid'])
    {
        
$mybb->settings['awaitingusergroup'] = "5";
        
$query $db->simple_select("awaitingactivation""*""guid='".$user['guid']."' AND (type='r' OR type='e')");
        
$activation $db->fetch_array($query);
        if(!
$activation['guid'])
        {
            
error($lang->error_alreadyactivated);
        }
        if(
$activation['code'] != $mybb->input['code'])
        {
            
error($lang->error_badactivationcode);
        }
        
$db->delete_query("awaitingactivation""guid='".$user['guid']."' AND (type='r' OR type='e')");
        if(
$user['usergroup'] == && $activation['type'] != "e")
        {
            
$db->update_query("accounts", array("usergroup" => 2), "guid='".$user['guid']."'");
        }
        if(
$activation['type'] == "e")
        {
            
$newemail = array(
                
"email" => $db->escape_string($activation['misc']),
                );
            
$db->update_query("accounts"$newemail"guid='".$user['guid']."'");
            
$plugins->run_hooks("member_activate_emailupdated");

            
redirect("usercp.php"$lang->redirect_emailupdated);
        }
        else
        {
            
$plugins->run_hooks("member_activate_accountactivated");

            
redirect("index.php"$lang->redirect_accountactivated);
        }
    }
    else
    {
        
$plugins->run_hooks("member_activate_form");

        eval(
"\$activate = \"".$templates->get("member_activate")."\";");
        
output_page($activate);
    }
}

if(
$mybb->input['action'] == "resendactivation")
{
    
$plugins->run_hooks("member_resendactivation");

    if(
$mybb->settings['regtype'] == "admin")
    {
        
error($lang->error_activated_by_admin);
    }

    eval(
"\$activate = \"".$templates->get("member_resendactivation")."\";");
    
output_page($activate);
}

if(
$mybb->input['action'] == "do_resendactivation" && $mybb->request_method == "post")
{
    
$plugins->run_hooks("member_do_resendactivation_start");

    if(
$mybb->settings['regtype'] == "admin")
    {
        
error($lang->error_activated_by_admin);
    }

    
$query $db->query("
        SELECT u.guid, u.account, u.usergroup, u.email, a.code
        FROM "
.TABLE_PREFIX."accounts u
        LEFT JOIN "
.TABLE_PREFIX."awaitingactivation a ON (a.guid=u.guid AND a.type='r')
        WHERE u.email='"
.$db->escape_string($mybb->input['email'])."'
    "
);
    
$numusers $db->num_rows($query);
    if(
$numusers 1)
    {
        
error($lang->error_invalidemail);
    }
    else
    {
        while(
$user $db->fetch_array($query))
        {
            if(
$user['usergroup'] == 5)
            {
                if(!
$user['code'])
                {
                    
$user['code'] = random_str();
                    
$now TIME_NOW;
                    
$guid $user['guid'];
                    
$awaitingarray = array(
                        
"guid" => $guid,
                        
"dateline" => TIME_NOW,
                        
"code" => $user['code'],
                        
"type" => "r"
                    
);
                    
$db->insert_query("awaitingactivation"$awaitingarray);
                }
                
$account$user['account'];
                
$email $user['email'];
                
$activationcode $user['code'];
                
$emailsubject $lang->sprintf($lang->emailsubject_activateaccount$mybb->settings['bbname']);
                
$emailmessage $lang->sprintf($lang->email_activateaccount$user['account'], $mybb->settings['bbname'], $mybb->settings['bburl'], $user['guid'], $activationcode);
                
my_mail($email$emailsubject$emailmessage);
            }
        }
        
$plugins->run_hooks("member_do_resendactivation_end");

        
redirect("index.php"$lang->redirect_activationresent);
    }
}

if(
$mybb->input['action'] == "lostpw")
{
    
$plugins->run_hooks("member_lostpw");

    eval(
"\$lostpw = \"".$templates->get("member_lostpw")."\";");
    
output_page($lostpw);
}

if(
$mybb->input['action'] == "do_lostpw" && $mybb->request_method == "post")
{
    
$plugins->run_hooks("member_do_lostpw_start");

    
$email $db->escape_string($email);
    
$query $db->simple_select("accounts""*""email='".$db->escape_string($mybb->input['email'])."'");
    
$numusers $db->num_rows($query);
    if(
$numusers 1)
    {
        
error($lang->error_invalidemail);
    }
    else
    {
        while(
$user $db->fetch_array($query))
        {
            
$db->delete_query("awaitingactivation""guid='{$user['guid']}' AND type='p'");
            
$user['activationcode'] = random_str();
            
$now TIME_NOW;
            
$guid $user['guid'];
            
$awaitingarray = array(
                
"guid" => $user['guid'],
                
"dateline" => TIME_NOW,
                
"code" => $user['activationcode'],
                
"type" => "p"
            
);
            
$db->insert_query("awaitingactivation"$awaitingarray);
            
$account $user['account'];
            
$email $user['email'];
            
$activationcode $user['activationcode'];
            
$emailsubject $lang->sprintf($lang->emailsubject_lostpw$mybb->settings['bbname']);
            
$emailmessage $lang->sprintf($lang->email_lostpw$account$mybb->settings['bbname'], $mybb->settings['bburl'], $guid$activationcode);
            
my_mail($email$emailsubject$emailmessage);
        }
    }
    
$plugins->run_hooks("member_do_lostpw_end");

    
redirect("index.php"$lang->redirect_lostpwsent);
}

if(
$mybb->input['action'] == "resetpassword")
{
    
$plugins->run_hooks("member_resetpassword_start");

    if(
$mybb->input['account'])
    {
        
$query $db->simple_select("accounts""*""LOWER(account)='".$db->escape_string(my_strtolower($mybb->input['account']))."'");
        
$user $db->fetch_array($query);
        if(!
$user['guid'])
        {
            
error($lang->error_invalidpworusername);
        }
    }
    else
    {
        
$query $db->simple_select("accounts""*""guid='".intval($mybb->input['guid'])."'");
        
$user $db->fetch_array($query);
    }
    if(
$mybb->input['code'] && $user['guid'])
    {
        
$query $db->simple_select("awaitingactivation""*""guid='".$user['guid']."' AND type='p'");
        
$activation $db->fetch_array($query);
        
$now TIME_NOW;
        if(
$activation['code'] != $mybb->input['code'])
        {
            
error($lang->error_badlostpwcode);
        }
        
$db->delete_query("awaitingactivation""guid='".$user['guid']."' AND type='p'");
        
$account$user['account'];

        
// Generate a new pass, then update it
        
$pass random_str();
        
$logindetails update_password($user['guid'], md5($pass), $user['salt']);

        
$email $user['email'];

        
$plugins->run_hooks("member_resetpassword_process");

        
$emailsubject $lang->sprintf($lang->emailsubject_passwordreset$mybb->settings['bbname']);
        
$emailmessage $lang->sprintf($lang->email_passwordreset$account$mybb->settings['bbname'], $pass);
        
my_mail($email$emailsubject$emailmessage);

        
$plugins->run_hooks("member_resetpassword_reset");

        
error($lang->redirect_passwordreset);
    }
    else
    {
        
$plugins->run_hooks("member_resetpassword_form");

        eval(
"\$activate = \"".$templates->get("member_resetpassword")."\";");
        
output_page($activate);
    }
}

$do_captcha $correct false;
$inline_errors "";
if(
$mybb->input['action'] == "do_login" && $mybb->request_method == "post")
{
    
$plugins->run_hooks("member_do_login_start");
    
    
// Checks to make sure the user can login; they haven't had too many tries at logging in.
    // Is a fatal call if user has had too many tries
    
$logins login_attempt_check();
    
$login_text '';
    
    
// Did we come from the quick login form
    
if($mybb->input['quick_login'] == "1" && $mybb->input['quick_password'] && $mybb->input['quick_username'])
    {
        
$mybb->input['pass'] = $mybb->input['quick_password'];
        
$mybb->input['account'] = $mybb->input['quick_username'];
        
$mybb->input['remember'] = $mybb->input['quick_remember'];
    }

    if(!
username_exists($mybb->input['account']))
    {
        
my_setcookie('loginattempts'$logins 1);
        
error($lang->error_invalidpworusername.$login_text);
    }
    
    
$query $db->simple_select("accounts""loginattempts""LOWER(account)='".$db->escape_string(my_strtolower($mybb->input['account']))."'", array('limit' => 1));
    
$loginattempts $db->fetch_field($query"loginattempts");
    
    
$errors = array();
    
    
$user validate_password_from_username($mybb->input['account'], $mybb->input['pass']);
    if(!
$user['guid'])
    {
        
my_setcookie('loginattempts'$logins 1);
        
$db->update_query("accounts", array('loginattempts' => 'loginattempts+1'), "LOWER(account) = '".$db->escape_string(my_strtolower($mybb->input['account']))."'"1true);
        
        
$mybb->input['action'] = "login";
        
$mybb->input['request_method'] = "get";
        
        if(
$mybb->settings['failedlogincount'] != && $mybb->settings['failedlogintext'] == 1)
        {
            
$login_text $lang->sprintf($lang->failed_login_again$mybb->settings['failedlogincount'] - $logins);
        }
        
        
$errors[] = $lang->error_invalidpworusername.$login_text;
    }
    else
    {
        
$correct true;
    }
    
    if(
$mybb->settings['failedcaptchalogincount'] > && ($loginattempts $mybb->settings['failedcaptchalogincount'] || intval($mybb->cookies['loginattempts']) > $mybb->settings['failedcaptchalogincount']))
    {        
        
// Show captcha image if enabled
        
if($mybb->settings['captchaimage'] == && function_exists("imagepng"))
        {
            
// Check their current captcha input - if correct, hide the captcha input area
            
if($mybb->input['imagestring'])
            {
                
$imagehash $db->escape_string($mybb->input['imagehash']);
                
$imagestring $db->escape_string($mybb->input['imagestring']);
                
$query $db->simple_select("captcha""*""imagehash='{$imagehash}' AND imagestring='{$imagestring}'");
                
$imgcheck $db->fetch_array($query);
                if(
$imgcheck['dateline'] > 0)
                {
                    
$correct true;
                }
                else
                {
                    
$db->delete_query("captcha""imagehash='{$imagehash}'");
                    
$errors[] = $lang->error_regimageinvalid;
                }
            }
            else if(
$mybb->input['quick_login'] == && $mybb->input['quick_password'] && $mybb->input['quick_username'])
            {
                
$errors[] = $lang->error_regimagerequired;
            }
            else
            {
                
$errors[] = $lang->error_regimagerequired;
            }
        }
        
        
$do_captcha true;
    }
    
    if(!empty(
$errors))
    {
        
$mybb->input['action'] = "login";
        
$mybb->input['request_method'] = "get";
        
        
$inline_errors inline_error($errors);
    }
    else if(
$correct)
    {        
        if(
$user['coppauser'])
        {
            
error($lang->error_awaitingcoppa);
        }
        
        
my_setcookie('loginattempts'1);
        
$db->delete_query("sessions""ip='".$db->escape_string($session->ipaddress)."' AND sid != '".$session->sid."'");
        
$newsession = array(
            
"guid" => $user['guid'],
        );
        
$db->update_query("sessions"$newsession"sid='".$session->sid."'");
        
        
$db->update_query("accounts", array("loginattempts" => 1), "guid='{$user['guid']}'");
        
        if(
$mybb->input['remember'] != "yes")
        {
            
$remember = -1;
        }
        else
        {
            
$remember null;
        }
        
my_setcookie("mybbuser"$user['guid']."_".$user['loginkey'], $remembertrue);
        
my_setcookie("sid"$session->sid, -1true);
        
        
$plugins->run_hooks("member_do_login_end");
        
        if(
$mybb->input['url'] != "" && my_strpos(basename($mybb->input['url']), 'member.php') === false)
        {
            if((
my_strpos(basename($mybb->input['url']), 'newthread.php') !== false || my_strpos(basename($mybb->input['url']), 'newreply.php') !== false) && my_strpos($mybb->input['url'], '&processed=1') !== false)
            {
                
$mybb->input['url'] = str_replace('&processed=1'''$mybb->input['url']);
            }
            
            
$mybb->input['url'] = str_replace('&amp;''&'$mybb->input['url']);
            
            
// Redirect to the URL if it is not member.php
            
redirect(htmlentities($mybb->input['url']), $lang->redirect_loggedin);
        }
        else
        {
            
redirect("index.php"$lang->redirect_loggedin);
        }
    }
    else
    {
        
$mybb->input['action'] = "login";
        
$mybb->input['request_method'] = "get";
    }
    
    
$plugins->run_hooks("member_do_login_end");
}

if(
$mybb->input['action'] == "login")
{
    
$plugins->run_hooks("member_login");
    
    
$member_loggedin_notice "";
    if(
$mybb->user['guid'] != 0)
    {
        
$lang->already_logged_in $lang->sprintf($lang->already_logged_inbuild_profile_link($mybb->user['account'], $mybb->user['guid']));
        eval(
"\$member_loggedin_notice = \"".$templates->get("member_loggedin_notice")."\";");
    }

    
// Checks to make sure the user can login; they haven't had too many tries at logging in.
    // Is a fatal call if user has had too many tries
    
login_attempt_check();

    
// Redirect to the page where the user came from, but not if that was the login page.
    
if($mybb->input['url'] && !preg_match("/action=login/i"$mybb->input['url']))
    {
        
$redirect_url htmlentities($mybb->input['url']);
    }
    elseif(
$_SERVER['HTTP_REFERER'])
    {
        
$redirect_url htmlentities($_SERVER['HTTP_REFERER']);
    }
        
    
$captcha "";
    
// Show captcha image for guests if enabled
    
if($mybb->settings['captchaimage'] == && function_exists("imagepng") && $do_captcha == true)
    {
        
$randomstr random_str(5);
        
$imagehash md5(random_str(12));
        
$imagearray = array(
            
"imagehash" => $imagehash,
            
"imagestring" => $randomstr,
            
"dateline" => TIME_NOW
        
);
        
$db->insert_query("captcha"$imagearray);
        eval(
"\$captcha = \"".$templates->get("post_captcha")."\";");
    }
    
    
$account "";
    
$pass "";
    if(
$mybb->input['account'] && $mybb->request_method == "post")
    {
        
$accounthtmlspecialchars_uni($mybb->input['account']);
    }
    
    if(
$mybb->input['pass'] && $mybb->request_method == "post")
    {
        
$pass htmlspecialchars_uni($mybb->input['pass']);
    }

    eval(
"\$login = \"".$templates->get("member_login")."\";");
    
output_page($login);
}

if(
$mybb->input['action'] == "logout")
{
    
$plugins->run_hooks("member_logout_start");

    if(!
$mybb->user['guid'])
    {
        
redirect("index.php"$lang->redirect_alreadyloggedout);
    }

    
// Check session ID if we have one
    
if($mybb->input['sid'] && $mybb->input['sid'] != $session->sid)
    {
        
error($lang->error_notloggedout);
    }
    
// Otherwise, check logoutkey
    
else if(!$mybb->input['sid'] && $mybb->input['logoutkey'] != $mybb->user['logoutkey'])
    {
        
error($lang->error_notloggedout);
    }

    
my_unsetcookie("mybbuser");
    
my_unsetcookie("sid");
    if(
$mybb->user['guid'])
    {
        
$time TIME_NOW;
        
$lastvisit = array(
            
"lastactive" => $time-900,
            
"lastvisit" => $time,
        );
        
$db->update_query("accounts"$lastvisit"guid='".$mybb->user['guid']."'");
        
$db->delete_query("sessions""sid='".$session->sid."'");
    }
    
$plugins->run_hooks("member_logout_end");
    
redirect("index.php"$lang->redirect_loggedout);
}

if(
$mybb->input['action'] == "profile")
{
    
$plugins->run_hooks("member_profile_start");

    if(
$mybb->usergroup['canviewprofiles'] == 0)
    {
        
error_no_permission();
    }
    if(
$mybb->input['guid'] == "lastposter")
    {
        if(
$mybb->input['tid'])
        {
            
$query $db->simple_select("posts""guid""tid='".intval($mybb->input['tid'])."' AND visible = 1", array('order_by' => 'dateline''order_dir' => 'DESC''limit' => '1'));
            
$post $db->fetch_array($query);
            
$guid $post['guid'];
        }
        elseif(
$mybb->input['fid'])
        {
            
$flist '';
            switch(
$db->type)
            {
                case 
"pgsql":
                case 
"sqlite":
                    
$query $db->simple_select("forums""fid""INSTR(','||parentlist||',',',".intval($mybb->input['fid']).",') > 0");
                    break;
                default:
                    
$query $db->simple_select("forums""fid""INSTR(CONCAT(',',parentlist,','),',".intval($mybb->input['fid']).",') > 0");
            }
            
            while(
$forum $db->fetch_array($query))
            {
                if(
$forum['fid'] == $mybb->input['fid'])
                {
                    
$theforum $forum;
                }
                
$flist .= ",".$forum['fid'];
            }
            
$query $db->simple_select("threads""tid""fid IN (0$flist) AND visible = 1", array('order_by' => 'lastpost''order_dir' => 'DESC''limit' => '1'));
            
$thread $db->fetch_array($query);
            
$tid $thread['tid'];
            
$query $db->simple_select("posts""guid""tid='$tid' AND visible = 1", array('order_by' => 'dateline''order_dir' => 'DESC''limit' => '1'));
            
$post $db->fetch_array($query);
            
$guid $post['guid'];
        }
    }
    else
    {
        if(
$mybb->input['guid'])
        {
            
$gguid intval($mybb->input['guid']);
        }
        else
        {
            
$guid $mybb->user['guid'];
        }
    }
    
    if(
$mybb->user['guid'] != $guid)
    {
        
$query $db->simple_select("accounts""*""guid='$guid'");
        
$memprofile $db->fetch_array($query);
    }
    else
    {
        
$memprofile $mybb->user;
    }
    
    
$lang->profile $lang->sprintf($lang->profile$memprofile['account']);

    if(!
$memprofile['guid'])
    {
        
error($lang->error_nomember);
    }

    
// Get member's permissions
    
$memperms user_permissions($memprofile['guid']);

    
$lang->nav_profile $lang->sprintf($lang->nav_profile$memprofile['account']);
    
add_breadcrumb($lang->nav_profile);

    
$lang->users_forum_info $lang->sprintf($lang->users_forum_info$memprofile['account']);
    
$lang->users_contact_details $lang->sprintf($lang->users_contact_details$memprofile['account']);

    if(
$mybb->settings['enablepms'] != && $memprofile['receivepms'] != && $memperms['canusepms'] != && my_strpos(",".$memprofile['ignorelist'].","",".$mybb->user['guid'].",") === false)
    {
        
$lang->send_pm $lang->sprintf($lang->send_pm$memprofile['account']);
    }
    else
    {
        
$lang->send_pm '';
    }
    
$lang->away_note $lang->sprintf($lang->away_note$memprofile['account']);
    
$lang->users_additional_info $lang->sprintf($lang->users_additional_info$memprofile['account']);
    
$lang->users_signature $lang->sprintf($lang->users_signature$memprofile['account']);
    
$lang->send_user_email $lang->sprintf($lang->send_user_email$memprofile['account']);

    if(
$memprofile['avatar'])
    {
        
$memprofile['avatar'] = htmlspecialchars_uni($memprofile['avatar']);
        
$avatar_dimensions explode("|"$memprofile['avatardimensions']);
        if(
$avatar_dimensions[0] && $avatar_dimensions[1])
        {
            
$avatar_width_height "width=\"{$avatar_dimensions[0]}\" height=\"{$avatar_dimensions[1]}\"";
        }
        
$avatar "<img src=\"{$memprofile['avatar']}\" alt=\"\" $avatar_width_height />";
    }
    else
    {
        
$avatar '';
    }

    if(
$memprofile['hideemail'] != 1)
    {
        eval(
"\$sendemail = \"".$templates->get("member_profile_email")."\";");
    }
    else
    {
        
$alttrow "trow1"// To properly sort the contact details below
        
$sendemail '';
    }

    
// Clean alt_trow for the contact details
    
$cat_array = array(
        
"pm",
        
"icq",
        
"aim",
        
"yahoo",
        
"msn",
    );

    
$bgcolors = array();
    foreach(
$cat_array as $cat)
    {
        
$bgcolors[$cat] = alt_trow();
    }

    if(
$memprofile['website'])
    {
        
$memprofile['website'] = htmlspecialchars_uni($memprofile['website']);
        
$website "<a href=\"{$memprofile['website']}\" target=\"_blank\">{$memprofile['website']}</a>";
    }
    else
    {
        
$website '';
    }

    if(
$memprofile['signature'] && ($memprofile['suspendsignature'] == || $memprofile['suspendsigtime'] < TIME_NOW))
    {
        
$sig_parser = array(
            
"allow_html" => $mybb->settings['sightml'],
            
"allow_mycode" => $mybb->settings['sigmycode'],
            
"allow_smilies" => $mybb->settings['sigsmilies'],
            
"allow_imgcode" => $mybb->settings['sigimgcode'],
            
"me_username" => $memprofile['account']
        );

        
$memprofile['signature'] = $parser->parse_message($memprofile['signature'], $sig_parser);
        eval(
"\$signature = \"".$templates->get("member_profile_signature")."\";");
    }

    
$daysreg = (TIME_NOW $memprofile['regdate']) / (24*3600);
    
$ppd $memprofile['postnum'] / $daysreg;
    
$ppd round($ppd2);
    if(
$ppd $memprofile['postnum'])
    {
        
$ppd $memprofile['postnum'];
    }
    
$stats $cache->read("stats");
    
$numposts $stats['numposts'];
    if(
$numposts == 0)
    {
        
$percent "0";
    }
    else
    {
        
$percent $memprofile['postnum']*100/$numposts;
        
$percent round($percent2);
    }
    
    if(
$percent 100)
    {
        
$percent 100;
    }

    if(!empty(
$memprofile['icq']))
    {
        
$memprofile['icq'] = intval($memprofile['icq']);
    }
    else
    {
        
$memprofile['icq'] = '';
    }

    if(
$memprofile['away'] == && $mybb->settings['allowaway'] != 0)
    {
        
$lang->away_note $lang->sprintf($lang->away_note$memprofile['account']);
        
$awaydate my_date($mybb->settings['dateformat'], $memprofile['awaydate']);
        if(!empty(
$memprofile['awayreason']))
        {
            
$awayreason htmlspecialchars_uni($memprofile['awayreason']);
        }
        else
        {
            
$awayreason $lang->away_no_reason;
        }
        if(
$memprofile['returndate'] == '')
        {
            
$returndate "$lang->unknown";
        }
        else
        {
            
$returnhome explode("-"$memprofile['returndate']);
            if(
$returnhome[2] >= 2038)
            {
                require_once 
MYBB_ROOT."inc/functions_time.php";
                
$returnmkdate adodb_mktime(000$returnhome[1], $returnhome[0], $returnhome[2]);
                
$returndate my_date($mybb->settings['dateformat'], $returnmkdate""1true);
            }
            else
            {
                
$returnmkdate mktime(000$returnhome[1], $returnhome[0], $returnhome[2]);
                
$returndate my_date($mybb->settings['dateformat'], $returnmkdate);
            }
        }
        eval(
"\$awaybit = \"".$templates->get("member_profile_away")."\";");
    }
    if(
$memprofile['dst'] == 1)
    {
        
$memprofile['timezone']++;
        if(
my_substr($memprofile['timezone'], 01) != "-")
        {
            
$memprofile['timezone'] = "+{$memprofile['timezone']}";
        }
    }
    
$memregdate my_date($mybb->settings['dateformat'], $memprofile['regdate']);
    
$memlocaldate gmdate($mybb->settings['dateformat'], TIME_NOW + ($memprofile['timezone'] * 3600));
    
$memlocaltime gmdate($mybb->settings['timeformat'], TIME_NOW + ($memprofile['timezone'] * 3600));

    
$localtime $lang->sprintf($lang->local_time_format$memlocaldate$memlocaltime);

    if(
$memprofile['lastactive'])
    {
        
$memlastvisitdate my_date($mybb->settings['dateformat'], $memprofile['lastactive']);
        
$memlastvisitsep $lang->comma;
        
$memlastvisittime my_date($mybb->settings['timeformat'], $memprofile['lastactive']);
    }
    else
    {
        
$memlastvisitdate $lang->lastvisit_never;
        
$memlastvisitsep '';
        
$memlastvisittime '';
    }

    if(
$memprofile['birthday'])
    {
        
$membday explode("-"$memprofile['birthday']);
        
        if(
$memprofile['birthdayprivacy'] != 'none')
        {
            if(
$membday[2])
            {
                
$lang->membdayage $lang->sprintf($lang->membdayageget_age($memprofile['birthday']));
                
                if(
$membday[2] >= 1970)
                {
                    
$w_day date("l"mktime(000$membday[1], $membday[0], $membday[2]));
                    
$membday format_bdays($mybb->settings['dateformat'], $membday[1], $membday[0], $membday[2], $w_day);
                }
                else
                {
                    
$bdayformat fix_mktime($mybb->settings['dateformat'], $membday[2]);
                    
$membday mktime(000$membday[1], $membday[0], $membday[2]);
                    
$membday date($bdayformat$membday);
                }
                
$membdayage $lang->membdayage;
            }
            else
            {
                
$membday mktime(000$membday[1], $membday[0], 0);
                
$membday date("F j"$membday);
                
$membdayage '';
            }
        }
        
        if(
$memprofile['birthdayprivacy'] == 'age')
        {
            
$membday $lang->birthdayhidden;
        }
        else if(
$memprofile['birthdayprivacy'] == 'none')
        {
            
$membday $lang->birthdayhidden;
            
$membdayage '';
        }
    }
    else
    {
        
$membday $lang->not_specified;
        
$membdayage '';
    }
    
    if(!
$memprofile['displaygroup'])
    {
        
$memprofile['displaygroup'] = $memprofile['usergroup'];
    }

    
// Grab the following fields from the user's displaygroup
    
$displaygroupfields = array(
        
"title",
        
"usertitle",
        
"stars",
        
"starimage",
        
"image",
        
"usereputationsystem"
    
);
    
$displaygroup usergroup_displaygroup($memprofile['displaygroup']);

    
// Get the user title for this user
    
unset($usertitle);
    unset(
$stars);
    if(
trim($memprofile['usertitle']) != '')
    {
        
// User has custom user title
        
$usertitle $memprofile['usertitle'];
    }
    elseif(
trim($displaygroup['usertitle']) != '')
    {
        
// User has group title
        
$usertitle $displaygroup['usertitle'];
    }
    else
    {
        
// No usergroup title so get a default one
        
$query $db->simple_select("usertitles""*""", array('order_by' => 'posts''order_dir' => 'DESC'));
        while(
$title $db->fetch_array($query))
        {
            if(
$memprofile['postnum'] >= $title['posts'])
            {
                
$usertitle $title['title'];
                
$stars $title['stars'];
                
$starimage $title['starimage'];
                break;
            }
        }
    }
    
    if(
$displaygroup['stars'] || $displaygroup['usertitle'])
    {
        
// Set the number of stars if display group has constant number of stars
        
$stars $displaygroup['stars'];
    }
    elseif(!
$stars)
    {
        
// This is for cases where the user has a title, but the group has no defined number of stars (use number of stars as per default usergroups)
        
$query $db->simple_select("usertitles""*""", array('order_by' => 'posts''order_dir' => 'DESC'));
        while(
$title $db->fetch_array($query))
        {
            if(
$memprofile['postnum'] >= $title['posts'])
            {
                
$stars $title['stars'];
                
$starimage $title['starimage'];
                break;
            }
        }
    }

    if(!empty(
$displaygroup['image']))
    {
        if(!empty(
$mybb->user['language']))
        {
            
$language $mybb->user['language'];
        }
        else
        {
            
$language $mybb->settings['bblanguage'];
        }
        
$displaygroup['image'] = str_replace("{lang}"$language$displaygroup['image']);
        
$displaygroup['image'] = str_replace("{theme}"$theme['imgdir'], $displaygroup['image']);
        eval(
"\$groupimage = \"".$templates->get("member_profile_groupimage")."\";");
    }

    if(!
$starimage)
    {
        
$starimage $displaygroup['starimage'];
    }

    if(
$starimage)
    {
        
// Only display stars if we have an image to use...
        
$starimage str_replace("{theme}"$theme['imgdir'], $starimage);
        
$userstars '';
        for(
$i 0$i $stars; ++$i)
        {
            
$userstars .= "<img src=\"$starimage\" border=\"0\" alt=\"*\" />";
        }
    }
    
    
// User is currently online and this user has permissions to view the user on the WOL
    
$timesearch TIME_NOW $mybb->settings['wolcutoffmins']*60;
    
$query $db->simple_select("sessions""location,nopermission""guid='$guid' AND time>'{$timesearch}'", array('order_by' => 'time''order_dir' => 'DESC''limit' => 1));
    
$session $db->fetch_array($query);
    
    if((
$memprofile['invisible'] != || $mybb->usergroup['canviewwolinvis'] == || $memprofile['guid'] == $mybb->user['guid']) && !empty($session))
    {
        
// Fetch their current location
        
$lang->load("online");
        require_once 
MYBB_ROOT."inc/functions_online.php";
        
$activity fetch_wol_activity($session['location'], $session['nopermission']);
        
$location build_friendly_wol_location($activity);
        
$location_time my_date($mybb->settings['timeformat'], $memprofile['lastactive']);

        eval(
"\$online_status = \"".$templates->get("member_profile_online")."\";");
    }
    
// User is offline
    
else
    {
        eval(
"\$online_status = \"".$templates->get("member_profile_offline")."\";");
    }

    
// Build Referral
    
if($mybb->settings['usereferrals'] == 1)
    {
        
// Reset the background colours to keep it inline
        
$bg_color alt_trow(true);

        eval(
"\$referrals = \"".$templates->get("member_profile_referrals")."\";");
    }
    else
    {
        
// Manually set to override colours...
        
$alttrow 'trow2';
    }

    
// Fetch the reputation for this user
    
if($memperms['usereputationsystem'] == && $displaygroup['usereputationsystem'] == && $mybb->settings['enablereputation'] == 1)
    {
        
$bg_color alt_trow();
        
$reputation get_reputation($memprofile['reputation']);

        
// If this user has permission to give reputations show the vote link
        
if($mybb->usergroup['cangivereputations'] == && $memprofile['guid'] != $mybb->user['guid'])
        {
            
$vote_link "[<a href=\"javascript:MyBB.reputation({$memprofile['guid']});\">{$lang->reputation_vote}</a>]";
        }

        eval(
"\$reputation = \"".$templates->get("member_profile_reputation")."\";");
    }

    if(
$mybb->settings['enablewarningsystem'] != && $memperms['canreceivewarnings'] != && ($mybb->usergroup['canwarnusers'] != || ($mybb->user['guid'] == $memprofile['guid'] && $mybb->settings['canviewownwarning'] != 0)))
    {
        
$bg_color alt_trow();
        
$warning_level round($memprofile['warningpoints']/$mybb->settings['maxwarningpoints']*100);
        if(
$warning_level 100)
        {
            
$warning_level 100;
        }
        
$warning_level get_colored_warning_level($warning_level);
        if(
$mybb->usergroup['canwarnusers'] != && $memprofile['guid'] != $mybb->user['guid'])
        {
            eval(
"\$warn_user = \"".$templates->get("member_profile_warn")."\";");
            
$warning_link "warnings.php?guid={$memprofile['guid']}";
        }
        else
        {
            
$warning_link "usercp.php";
        }
        eval(
"\$warning_level = \"".$templates->get("member_profile_warninglevel")."\";");
    }

    
$query $db->simple_select("userfields""*""ufid='$guid'");
    
$userfields $db->fetch_array($query);
    
$customfields '';
    
$bgcolor "trow1";
    
$alttrow "trow1";
    
// If this user is an Administrator or a Moderator then we wish to show all profile fields
    
if($mybb->usergroup['cancp'] == || $mybb->usergroup['issupermod'] == || $mybb->usergroup['canmodcp'] == 1)
    {
        
$field_hidden '1=1';
    }
    else
    {
        
$field_hidden "hidden=0";
    }
    
$query $db->simple_select("profilefields""*""{$field_hidden}", array('order_by' => 'disporder'));
    while(
$customfield $db->fetch_array($query))
    {
        
$thing explode("\n"$customfield['type'], "2");
        
$type trim($thing[0]);

        
$field "fid{$customfield['fid']}";
        
$useropts explode("\n"$userfields[$field]);
        
$customfieldval $comma '';
        if(
is_array($useropts) && ($type == "multiselect" || $type == "checkbox"))
        {
            foreach(
$useropts as $val)
            {
                if(
$val != '')
                {
                    
$customfieldval .= "<li style=\"margin-left: 0;\">{$val}</li>";
                }
            }
            if(
$customfieldval != '')
            {
                
$customfieldval "<ul style=\"margin: 0; padding-left: 15px;\">{$customfieldval}</ul>";
            }
        }
        else
        {
            if(
$customfield['type'] == "textarea")
            {
                
$customfieldval nl2br(htmlspecialchars_uni($userfields[$field]));
            }
            else
            {
                
$customfieldval htmlspecialchars_uni($userfields[$field]);
            }
        }
        eval(
"\$customfields .= \"".$templates->get("member_profile_customfields_field")."\";");
        
$bgcolor alt_trow();
    }
    if(
$customfields)
    {
        eval(
"\$profilefields = \"".$templates->get("member_profile_customfields")."\";");
    }
    
$memprofile['postnum'] = my_number_format($memprofile['postnum']);
    
$lang->ppd_percent_total $lang->sprintf($lang->ppd_percent_totalmy_number_format($ppd), $percent);
    
$formattedname format_name($memprofile['account'], $memprofile['usergroup'], $memprofile['displaygroup']);
    if(
$memprofile['timeonline'] > 0)
    {
        
$timeonline nice_time($memprofile['timeonline']);
    }
    else
    {
        
$timeonline $lang->none_registered;
    }
    
    if(
$mybb->usergroup['cancp'] == && $mybb->config['hide_admin_links'] != 1)
    {
        eval(
"\$adminoptions = \"".$templates->get("member_profile_adminoptions")."\";");
    }
    else
    {
        
$adminoptions '';
    }
    
    if(
$mybb->usergroup['canmodcp'] == 1)
    {
        
$memprofile['usernotes'] = nl2br(htmlspecialchars_uni($memprofile['usernotes']));
        
        if(!empty(
$memprofile['usernotes']))
        {
            if(
strlen($memprofile['usernotes']) > 100)
            {
                
$memprofile['usernotes'] = my_substr($memprofile['usernotes'], 0100).'...';
            }
        }
        else
        {
            
$memprofile['usernotes'] = $lang->no_usernotes;
        }
        
        eval(
"\$modoptions = \"".$templates->get("member_profile_modoptions")."\";");
    }
    else
    {
        
$modoptions '';
    }
    
    
$buddy_options '';
    
    if(
$mybb->user['guid'] != $mybb->input['guid'] && $mybb->user['guid'] != 0)
    {
        
$buddy_list explode(','$mybb->user['buddylist']);
        if(
in_array($mybb->input['guid'], $buddy_list))
        {
            
$buddy_options "<br /><a href=\"./usercp.php?action=do_editlists&amp;delete={$mybb->input['guid']}&amp;my_post_key={$mybb->post_code}\"><img src=\"{$theme['imgdir']}/remove_buddy.gif\" /> {$lang->remove_from_buddy_list}</a>";
        }
        else
        {
            
$buddy_options "<br /><a href=\"./usercp.php?action=do_editlists&amp;add_username=".urlencode($memprofile['account'])."&amp;my_post_key={$mybb->post_code}\"><img src=\"{$theme['imgdir']}/add_buddy.gif\" /> {$lang->add_to_buddy_list}</a>";
        }
        
        
$ignore_list explode(','$mybb->user['ignorelist']);
        if(
in_array($mybb->input['guid'], $ignore_list))
        {
            
$buddy_options .= "<br /><a href=\"./usercp.php?action=do_editlists&amp;manage=ignored&amp;delete={$mybb->input['guid']}&amp;my_post_key={$mybb->post_code}\"><img src=\"{$theme['imgdir']}/remove_ignore.gif\" /> {$lang->remove_from_ignore_list}</a>";
        }
        else
        {
            
$buddy_options .= "<br /><a href=\"./usercp.php?action=do_editlists&amp;manage=ignored&amp;add_username=".urlencode($memprofile['account'])."&amp;my_post_key={$mybb->post_code}\"><img src=\"{$theme['imgdir']}/add_ignore.gif\" /> {$lang->add_to_ignore_list}</a>";
        }
    }

    
$plugins->run_hooks("member_profile_end");
    
    eval(
"\$profile = \"".$templates->get("member_profile")."\";");
    
output_page($profile);
}

if(
$mybb->input['action'] == "do_emailuser" && $mybb->request_method == "post")
{
    
// Verify incoming POST request
    
verify_post_check($mybb->input['my_post_key']);

    
$plugins->run_hooks("member_do_emailuser_start");

    
// Guests or those without permission can't email other accounts
    
if($mybb->usergroup['cansendemail'] == || !$mybb->user['guid'])
    {
        
error_no_permission();
    }
    
    
// Check group limits
    
if($mybb->usergroup['maxemails'] > 0)
    {
        
$query $db->simple_select("maillogs""COUNT(*) AS sent_count""fromuid='{$mybb->user['guid']}' AND dateline >= '".(TIME_NOW - (60*60*24))."'");
        
$sent_count $db->fetch_field($query"sent_count");
        if(
$sent_count >= $mybb->usergroup['maxemails'])
        {
            
$lang->error_max_emails_day $lang->sprintf($lang->error_max_emails_day$mybb->usergroup['maxemails']);
            
error($lang->error_max_emails_day);
        }
    }
    
    
$query $db->simple_select("accounts""guid, account, email, hideemail""guid='".intval($mybb->input['guid'])."'");
    
$to_user $db->fetch_array($query);
    
    if(!
$to_user['account'])
    {
        
error($lang->error_invalidusername);
    }
    
    if(
$to_user['hideemail'] != 0)
    {
        
error($lang->error_hideemail);
    }
    
    if(empty(
$mybb->input['subject']))
    {
        
$errors[] = $lang->error_no_email_subject;
    }
    
    if(empty(
$mybb->input['message']))
    {
        
$errors[] = $lang->error_no_email_message;
    }

    if(
count($errors) == 0)
    {
        if(
$mybb->settings['mail_handler'] == 'smtp')
        {
            
$from $mybb->user['email'];
        }
        else
        {
            
$from "{$mybb->user['account']} <{$mybb->user['email']}>";
        }
        
        
$message $lang->sprintf($lang->email_emailuser$to_user['account'], $mybb->user['account'], $mybb->settings['bbname'], $mybb->settings['bburl'], $mybb->input['message']);
        
my_mail($to_user['email'], $mybb->input['subject'], $message$from""""false"text"""$mybb->user['email']);
        
        if(
$mybb->settings['mail_logging'] > 0)
        {
            
// Log the message
            
$log_entry = array(
                
"subject" => $db->escape_string($mybb->input['subject']),
                
"message" => $db->escape_string($mybb->input['message']),
                
"dateline" => TIME_NOW,
                
"fromuid" => $mybb->user['guid'],
                
"fromemail" => $db->escape_string($mybb->user['email']),
                
"touid" => $to_user['guid'],
                
"toemail" => $db->escape_string($to_user['email']),
                
"tid" => 0,
                
"ipaddress" => $db->escape_string($session->ipaddress)
            );
            
$db->insert_query("maillogs"$log_entry);
        }

        
$plugins->run_hooks("member_do_emailuser_end");

        
redirect(get_profile_link($to_user['guid']), $lang->redirect_emailsent);
    }
    else
    {
        
$mybb->input['action'] = "emailuser";
    }
}

if(
$mybb->input['action'] == "emailuser")
{
    
$plugins->run_hooks("member_emailuser_start");

    
// Guests or those without permission can't email other accounts
    
if($mybb->usergroup['cansendemail'] == || !$mybb->user['guid'])
    {
        
error_no_permission();
    }
    
    
// Check group limits
    
if($mybb->usergroup['maxemails'] > 0)
    {
        
$query $db->simple_select("maillogs""COUNT(*) AS sent_count""fromuid='{$mybb->user['guid']}' AND dateline >= '".(TIME_NOW - (60*60*24))."'");
        
$sent_count $db->fetch_field($query"sent_count");
        if(
$sent_count $mybb->usergroup['maxemails'])
        {
            
$lang->error_max_emails_day $lang->sprintf($lang->error_max_emails_day$mybb->usergroup['maxemails']);
            
error($lang->error_max_emails_day);
        }
    }    
    
    
$query $db->simple_select("accounts""guid, account, email, hideemail""guid='".intval($mybb->input['guid'])."'");
    
$to_user $db->fetch_array($query);
    
    
$lang->email_user $lang->sprintf($lang->email_user$to_user['account']);
    
    if(!
$to_user['guid'])
    {
        
error($lang->error_invaliduser);
    }
    
    if(
$to_user['hideemail'] != 0)
    {
        
error($lang->error_hideemail);
    }
    
    if(
count($errors) > 0)
    {
        
$errors inline_error($errors);
        
$subject htmlspecialchars_uni($mybb->input['subject']);
        
$message htmlspecialchars_uni($mybb->input['message']);
    }
    else
    {
        
$errors '';
        
$subject '';
        
$message '';
    }
    
    
$plugins->run_hooks("member_emailuser_end");
    
    eval(
"\$emailuser = \"".$templates->get("member_emailuser")."\";");
    
output_page($emailuser);
}

if(!
$mybb->input['action'])
{
    
header("Location: index.php");
}
?>


Mais quand jesaye de me connectée sa me mais une erreur :

Une erreur inconnue s'est produite.

merci de votre aide, cordialement

Petite information sur le code :

là nouvelle base de donné sapelle : accounts
le chemin de l'indentifiant est account
le chemin du mot de passe et pass Smile



RE: problèmes conenction avec une autre base de donné - Alexandre - 17-04-2011

Je n'ai pas très bien compris.


RE: problèmes conenction avec une autre base de donné - lilirageuse - 17-04-2011

j'ais changé le chemin de la base de donné ( voir code php)
malgrès que je maite le bon identifiant sa me mais une erreur De connection Wink


RE: problèmes conenction avec une autre base de donné - exdiogene - 17-04-2011

Il n'est pas très utile d'afficher un si long fichier avec des changements difficiles à percevoir, sans connaître la finalité du travail réalisé.

1- Dans le préambule il serait préférable d'expliquer le but à atteindre avant de demander de l'aide pour les problèmes.
2- Quel est ce chemin, que nous voulons changer et pourquoi le changer?
3- Pourquoi est-il nécessaire de changer le code source de MyBB, au lieu d'utiliser un plugin qui lui permet les mises à jour de MyBB?
4- Il est toujours plus facile de donner un exemple des lignes changées avec le code "avant" et "après" pour faciliter le travail au lecteur duquel nous attendons de l'aide. Au moins les identifier avec des couleurs différentes dans le texte intégral, non mis en forme par PHP.

Je ne peux vraiment pas offrir mon aide dans les conditions actuelles, car il me manque trop d'informations...

P.S. Le chemin(répertoire) de la Base de Données est fixe sur la presque totalité des hébergeurs, elles peuvent cependant être identifiées pour leur accès. Serait-il plutôt question de l'accès à une table différente dans la même Base de Données? De plus, les coordonnées d'accès à la Base de Données se retrouvent normalement dans le fichier config.php et ne semblent pas être changées ici...


RE: problèmes conenction avec une autre base de donné - Alexandre - 17-04-2011

(17-04-2011, 17:42)exdiogene a écrit :  Il n'est pas très utile d'afficher un si long fichier avec des changements difficiles à percevoir, sans connaître la finalité du travail réalisé.

1- Dans le préambule il serait préférable d'expliquer le but à atteindre avant de demander de l'aide pour les problèmes.
2- Quel est ce chemin, que nous voulons changer et pourquoi le changer?
3- Pourquoi est-il nécessaire de changer le code source de MyBB, au lieu d'utiliser un plugin qui lui permet les mises à jour de MyBB?
4- Il est toujours plus facile de donner un exemple des lignes changées avec le code "avant" et "après" pour faciliter le travail au lecteur duquel nous attendons de l'aide. Au moins les identifier avec des couleurs différentes dans le texte intégral, non mis en forme par PHP.

Je ne peux vraiment pas offrir mon aide dans les conditions actuelles, car il me manque trop d'informations...

P.S. Le chemin(répertoire) de la Base de Données est fixe sur la presque totalité des hébergeurs, elles peuvent cependant être identifiées pour leur accès. Serait-il plutôt question de l'accès à une table différente dans la même Base de Données? De plus, les coordonnées d'accès à la Base de Données se retrouvent normalement dans le fichier config.php et ne semblent pas être changées ici...

Voilà qui est bien dit.


RE: problèmes conenction avec une autre base de donné - lilirageuse - 17-04-2011

Je veut changez la tables qui est par défaut users
car je veut que il y est une liaision entre plusieurs site Wink
donc ma nouvelle table s'appelle accounts
le préfixe des tables à aussi changez avec ma table account pour l'identifiant et pass pour le mot de passe
lorsque jais changez presque tous les ligne de code de member php pour que elle cherche l'identifiant avec la nouvelle table je peut pas maitre une ligne car toute les ligne on été changez ( casiment)
mais quand je veut me connectez ( sur mon forum)
sa m'affiches Une erreur inconnue s'est produite. ( ce message s'affiches quand on entre un mauvais mot de passe)




RE: problèmes conenction avec une autre base de donné - Suceur_de_glaçon - 17-04-2011

Salut,

Je ne sais pas avec quel autre site (cms j'imagine) tu souhaites coupler la base de données de MyBB, mais il ne suffit pas de changer les nom pour que cela fonctionne.
La table "users" de MyBB n'est pas forcement constitué de la même façon que la table "accounts" de ton autre système.

Pour info voilà une partie du contenu de la table "users" pour MyBB :
Code :
uid    int(10) unsigned    Non    Primary    NULL    auto_increment
    username    varchar(120)    Non    None
    password    varchar(120)    Non    None    
    salt    varchar(10)    Non    None    
    loginkey    varchar(50)    Non    None    
    email    varchar(220)    Non    None    
    postnum    int(10)    Non    None    0    
    avatar    varchar(200)    Non    None    
    avatardimensions    varchar(10)    Non    None    
    avatartype    varchar(10)    Non    None    0    
    usergroup    smallint(5) unsigned    Non    Indexed    0    
    additionalgroups    varchar(200)    Non    None    
    ...


Et encore ce n'est qu'une petite partie de cette table. Je doute fort que ta table "account" (du cms ou de ton autre "site") soit identique en tout point.
Bref, il ne suffit pas de changer le nom pour les relier.
Il faut aussi s'assurer que le contenu des tables soient identiques.
Par exemple ici, nous avons la rangée "username", si ça se trouve sur la table "accounts", cette rangée s'appelle "nickname" et, est sans doute constituées totalement différemment.

Dans ce cas le mieux, est d'utiliser un "serveur d'annuaire" : LDAP pour le plus connu.
Malheureusement, la core team de MyBB ne semble pas avoir encore travaillée sur cette possibilité pour le moment ... d'ailleurs, perso, je trouve ça hallucinant, car aujourd'hui la plupart des systèmes de forums, blogs et cms proposent la possibilité d'utiliser au choix la BDD par défaut ou via un LDAP (pour la gestion d'utilisateurs/membres, et/ou système OpenID)...... c'est aujourd'hui devenu une chose essentielle.

Sinon dans ton cas, sans LDAP, dans ce cas il faut faire un pont (bridge) qui fait passerelle entre la base de donnée du forum et celle de ton cms (dans le cas où tu souhaite le mixer avec un cms... vu que tu n'expliques pas beaucoup).

Mais si tu utilises un CMS, essai de regarder de ce coté. Il est possible qu'un "bridge" existe déjà entre ce CMS et MyBB avec un peu de chance.


RE: problèmes conenction avec une autre base de donné - exdiogene - 17-04-2011

Je suggère de lire cette discussion avant d'aller plus loin :
http://mybb.fr/thread-4012.html

Si seulement les sections appropriées sont changées dans le code source des trois forums distincts, il est possible d'en arriver à une solution viable. Mais il est toujours souhaitable d'utiliser la solution de multiple forums dans des catégories séparées et avec des thèmes différents.

Pour diagnostiquer le problème de connexion, je suggère d'ajouter des codes dans la section "if($mybb->input['action'] == "do_login" && $mybb->request_method == "post")" suite à la définition de la variable $user pour imprimer les variables et quitter immédiatement.

Code PHP :
print_r($user);
print 
'<br /><br />';
print_r($mybb->input);
exit; 



 Utilitaire de traduction fourni par Regentronique