Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Need some help integrating with mybb (http://www.mysidiaadoptables.com/forum/showthread.php?t=4140)

Infernette 05-28-2013 10:10 PM

Need some help integrating with mybb
 
So I've been struggling with integrating mybb in the new version (Of all the things...).
I've checked the config file for the mybb and took the info from there and put it into config_forums but when I make a test account I get "failed to create forum account". I know I haven't misspelled anything, because when I did I got a message that told me that access was denied for me to do that, so I don't know what is up.

I was trying to work on making my forums and site's inventories integrated and I don't know why it isn't working... (have to make the user id's match on both so I needed the auto sign-up)

I'm probably going to make myself a cup of noodles and try to fiddle around with this more to see what I can do to fix it on my own...

Missy Master 05-30-2013 07:14 PM

I had the same error, I'm going to leave this to HoF because I was never able to resolve it myself ---

I will be anxious to see what the issue is, I really would love to use the Mybb with the Pet site!

Infernette 05-30-2013 08:04 PM

I was using it to try and sync up forum achievements/items with site ones and currency to kind of add a bit of connectivity but this error is really frustration. Glad to know I'm not the only one XD

Nieth 06-03-2013 10:27 AM

I know this sounds too simple to be true but, did you assign the Database account to the new database for the forum and give it full access?

I set up MyBB forums with Mysidia's v1.3.3 script this morning and it seems to be working fine for me.

Infernette 06-03-2013 12:21 PM

Quote:

Originally Posted by Nieth (Post 27065)
I know this sounds too simple to be true but, did you assign the Database account to the new database for the forum and give it full access?

I set up MyBB forums with Mysidia's v1.3.3 script this morning and it seems to be working fine for me.

I did, it was the same account I had used for the previous version that I simply just reassigned to this one, and it isn't working for me... it seems to be a common error though, from the looks of it....

Alaric 06-03-2013 01:03 PM

Quote:

Originally Posted by Infernette (Post 27068)
I did, it was the same account I had used for the previous version that I simply just reassigned to this one, and it isn't working for me... it seems to be a common error though, from the looks of it....

Isn't working for me too :ohnoes:

Alaric 06-09-2013 10:45 AM

Quote:

Originally Posted by Infernette (Post 27011)
So I've been struggling with integrating mybb in the new version (Of all the things...).
I've checked the config file for the mybb and took the info from there and put it into config_forums but when I make a test account I get "failed to create forum account". I know I haven't misspelled anything, because when I did I got a message that told me that access was denied for me to do that, so I don't know what is up.

I was trying to work on making my forums and site's inventories integrated and I don't know why it isn't working... (have to make the user id's match on both so I needed the auto sign-up)

I'm probably going to make myself a cup of noodles and try to fiddle around with this more to see what I can do to fix it on my own...

I found that it doesn't work with MyBB 1.6.10, I had problems with it for almost a week Installing and uninstalling more than 30 times :(

I tried it with MyBB 1.6.8 today and it worked :happycbig:

Infernette 06-09-2013 03:08 PM

Quote:

Originally Posted by Alaric (Post 27161)
I found that it doesn't work with MyBB 1.6.10, I had problems with it for almost a week Installing and uninstalling more than 30 times :(

I tried it with MyBB 1.6.8 today and it worked :happycbig:

That's great!


I hope though it can be fixed work with 1.6.10, cause I modded my forums a bit and I do not want to lose my stuff....

Hall of Famer 06-10-2013 06:48 PM

umm so you are implying that the script works with MyBB 1.6.8 but not MyBB 1.6.10? I believe it is compatible with MyBB 1.6.9 too as I tested it myself with Mys v1.3.3's demo site. There is a chance that MyBB 1.6.10 has a different database table structure for users and other users related fields. I will take a look at it after finishing off new features for Mys v1.3.4.

Alaric 06-20-2013 04:14 AM

Quote:

Originally Posted by Hall of Famer (Post 27164)
umm so you are implying that the script works with MyBB 1.6.8 but not MyBB 1.6.10? I believe it is compatible with MyBB 1.6.9 too as I tested it myself with Mys v1.3.3's demo site. There is a chance that MyBB 1.6.10 has a different database table structure for users and other users related fields. I will take a look at it after finishing off new features for Mys v1.3.4.

Hope you make MyBB 1.6.10 compatible In the next release of Mys v1.3.4, or else if your planning to release Mys 1.3.4 after MyBB 1.8 is released I would suggest making it compatible with MyBB 1.8 instead.

pachoofoosh 08-20-2013 09:10 AM

Sorry to dig this up, but I found out what was causing the error! ouo The field 'failedlogin' in the column 'users' no longer exists in the latest MyBB version. To make the newest version compatible, simply replace your functions/functions_forums.php with the following:
PHP Code:

<?php

// File ID: functions_forums.php
// Purpose: Provides specific functions for forum integration, for now it is MyBB only.

function mybbregister(){ 
    
$mysidia Registry::get("mysidia");
    include(
"inc/config_forums.php");   
    
$forums = new Database($mybbdbname$mybbhost$mybbuser$mybbpass$mybbprefix) or die("Cannot connect to forum database, please contact an admin immediately.");

    
//Now the database has been switched to mybb forum's. Before inserting user info, lets generate the password and salt in Mybb format.
    
$salty codegen(80);
    
$loginkey codegen(500);
    
$md5pass md5($mysidia->input->post("pass1"));
    
$fpass md5(md5($salty).$md5pass); 
    
$ip $_SERVER['REMOTE_ADDR'];
    
$altip ipgen($ip);  
    
$username $mysidia->input->post("username");
    
$email $mysidia->input->post("email");
    
$avatar = (strpos($imageurl"http://") !== false)?$avatar:"http://www.".DOMAIN.SCRIPTPATH."/".$mysidia->input->post("avatar");
    
$birthday $mysidia->input->post("birthday");
    
$query "INSERT INTO {$mybbprefix}users (uid, username, password, salt, loginkey, email, postnum, avatar, avatardimensions, avatartype, usergroup, additionalgroups, displaygroup, usertitle, regdate, lastactive, lastvisit, lastpost, website, icq, aim, yahoo, msn, birthday, birthdayprivacy, signature, allownotices, hideemail, subscriptionmethod, invisible, receivepms, receivefrombuddy, pmnotice, pmnotify, threadmode, showsigs, showavatars, showquickreply, showredirect, ppp, tpp, daysprune, dateformat, timeformat, timezone, dst, dstcorrection, buddylist, ignorelist, style, away, awaydate, returndate, awayreason, pmfolders, notepad, referrer, referrals, reputation, regip, lastip, longregip, longlastip, language, timeonline, showcodebuttons, totalpms, unreadpms, warningpoints, moderateposts, moderationtime, suspendposting, suspensiontime, suspendsignature, suspendsigtime, coppauser, classicpostbit, loginattempts, usernotes)
                                       VALUES ('', '
$username', '$fpass','$salty','$loginkey', '$email', '0', '$avatar', '', '0', '2', '', '0', '', 'time()', 'time()', 'time()', '0', '', '', '', '', '', '$birthday', 'all', '', '1', '0', '0', '0', '1', '0', '1', '1', '', '1', '1', '1', '1', '0', '0', '0', '', '', '0', '0', '0', '', '', '0', '0', '0', '', '', '', '', '0','0','0','$ip', '$ip','$altip','$altip','','0','1', '0', '0', '0','0','0','0','0','0','0','0','0','1','')";
    
$forums->query($query) or die("Failed to create forum account");

    
// Now set the cookie for user on MyBB        
    
$mybbuser $forums->select("users", array("uid""loginkey"), "username = '{$username}'")->fetchObject();
    
$cookiesettings = array();
    
$cookiesettings['cookiedomain'] = $forums->select("settings", array("value"), "name = 'cookiedomain'")->fetchColumn();
    
$cookiesettings['cookiepath'] = $forums->select("settings", array("value"), "name = 'cookiepath'")->fetchColumn();
    
$cookiesettings['cookieprefix'] = $forums->select("settings", array("value"), "name = 'cookieprefix'")->fetchColumn();
    
mybbsetcookie("mybbuser"$mybbuser->uid."_".$mybbuser->loginkeyNULLtrue$cookiesettings);

    
$mybbsid mybb_random_str(32); 
    
mybbsetcookie("sid"$mybbsid, -1true); 
}

function 
mybblogin(){
    
$mysidia Registry::get("mysidia");
    include(
"inc/config_forums.php");
    
$forums = new Database($mybbdbname$mybbhost$mybbuser$mybbpass$mybbprefix) or die("Cannot connect to forum database, please contact an admin immediately.");
    
$mybbuser $forums->select("users", array("uid""loginkey"), "username = '{$mysidia->input->post("username")}'")->fetchObject();
    
$cookiesettings = array();
    
$cookiesettings['cookiedomain'] = $forums->select("settings", array("value"), "name = 'cookiedomain'")->fetchColumn();
    
$cookiesettings['cookiepath'] = $forums->select("settings", array("value"), "name = 'cookiepath'")->fetchColumn();
    
$cookiesettings['cookieprefix'] = $forums->select("settings", array("value"), "name = 'cookieprefix'")->fetchColumn();
    
mybbsetcookie("mybbuser"$mybbuser->uid."_".$mybbuser->loginkeyNULLtrue$cookiesettings);

    
$mybbsid mybb_random_str(32); 
    
mybbsetcookie("sid"$mybbsid, -1true); 
}

function 
mybblogout(){
    
$mysidia Registry::get("mysidia");
    include(
"inc/config_forums.php");
    
mybbunsetcookie("mybbuser");
    
mybbunsetcookie("sid");
    
$forums = new Database($mybbdbname$mybbhost$mybbuser$mybbpass$mybbprefix) or die("Cannot connect to forum database, please contact an admin immediately.");
    
$loginkey codegen(500);
    
$lastvisit time() - 900;
    
$lastactive time();
    
$forums->update("users", array("loginkey" => $loginkey"lastvisit" => $lastvisit"lastactive" => $lastactive), "uid = '{$mysidia->user->uid}'");
    
$forums->delete("sessions""uid = '{$mysidia->user->uid}'");
}

function 
mybbsetcookie($name$value=""$expires=""$httponly=false$cookiesettings = array()){
    
$mysidia Registry::get("mysidia");
    if(!
$cookiesettings['cookiepath']) $cookiesettings['cookiepath'] = "/";

    if(
$expires == -1$expires 0;
    elseif(
$expires == "" || $expires == null$expires time() + (60*60*24*365); // Make the cookie expire in a years time
    
else $expires time() + intval($expires);

    
$cookiesettings['cookiepath'] = str_replace(array("\n","\r"), ""$cookiesettings['cookiepath']);
    
$cookiesettings['cookiedomain'] = str_replace(array("\n","\r"), ""$cookiesettings['cookiedomain']);
    
$cookiesettings['cookieprefix'] = str_replace(array("\n","\r"" "), ""$cookiesettings['cookieprefix']);

    
// Versions of PHP prior to 5.2 do not support HttpOnly cookies and IE is buggy when specifying a blank domain so set the cookie manually
    
$cookie "Set-Cookie: {$cookiesettings['cookieprefix']}{$name}=".urlencode($value);

    if(
$expires 0$cookie .= "; expires=".@gmdate('D, d-M-Y H:i:s \\G\\M\\T'$expires);
    if(!empty(
$cookiesettings['cookiepath'])) $cookie .= "; path={$cookiesettings['cookiepath']}";
    if(!empty(
$cookiesettings['cookiedomain'])) $cookie .= "; domain={$cookiesettings['cookiedomain']}";
    if(
$httponly == true$cookie .= "; HttpOnly";
    
    
$cookiesettings[$name] = $value;
    
header($cookiefalse);
}

function 
mybbunsetcookie($name){    
    
$expires = -3600;
    
mybbsetcookie($name""$expires);        
}


function 
mybb_seed_rng($count=8){
    
$output '';
    
    
// Try the unix/linux method
    
if(@is_readable('/dev/urandom') && ($handle = @fopen('/dev/urandom''rb'))){
        
$output = @fread($handle$count);
        @
fclose($handle);
    }
    
    
// Didn't work? Do we still not have enough bytes? Use our own (less secure) rng generator
    
if(strlen($output) < $count){
        
$output '';
        
        
// Close to what PHP basically uses internally to seed, but not quite.
        
$unique_state microtime().@getmypid();
        
        for(
$i 0$i $count$i += 16){
            
$unique_state md5(microtime().$unique_state);
            
$output .= pack('H*'md5($unique_state));
        }
    }
    
    
// /dev/urandom and openssl will always be twice as long as $count. base64_encode will roughly take up 33% more space but crc32 will put it to 32 characters
    
$output hexdec(substr(dechex(crc32(base64_encode($output))), 0$count));
    
    return 
$output;
}

function 
mybb_rand($min=null$max=null$force_seed=false){
    static 
$seeded false;
    static 
$obfuscator 0;

    if(
$seeded == false || $force_seed == true){
        
mt_srand(mybb_seed_rng());
        
$seeded true;

        
$obfuscator abs((int) mybb_seed_rng());
        
        
// Ensure that $obfuscator is <= mt_getrandmax() for 64 bit systems.
        
if($obfuscator mt_getrandmax()) $obfuscator -= mt_getrandmax();
    }

    if(
$min !== null && $max !== null){
        
$distance $max $min;
        if (
$distance 0) return $min + (int)((float)($distance 1) * (float)(mt_rand() ^ $obfuscator) / (mt_getrandmax() + 1));
        else return 
mt_rand($min$max);
    }
    else{
        
$val mt_rand() ^ $obfuscator;
        return 
$val;
    }
}

function 
mybb_random_str($length="8"){
    
$set = array("a","A","b","B","c","C","d","D","e","E","f","F","g","G","h","H","i","I","j","J","k","K","l","L","m","M","n","N","o","O","p","P","q","Q","r","R","s","S","t","T","u","U","v","V","w","W","x","X","y","Y","z","Z","1","2","3","4","5","6","7","8","9");
    
$str '';

    for(
$i 1$i <= $length; ++$i){
        
$ch mybb_rand(0count($set)-1);
        
$str .= $set[$ch];
    }

    return 
$str;
}

function 
mybbrebuildstats(){
    
$mysidia Registry::get("mysidia");
    include(
"inc/config_forums.php");
    if(!
$mysidia->input->post("username")) return FALSE;
    
    
$forums = new Database($mybbdbname$mybbhost$mybbuser$mybbpass$mybbprefix) or die("Cannot connect to forum database, please contact an admin immediately.");
    
$oldstats $forums->select("datacache", array("cache"), "title = 'stats'")->fetchColumn();
    
$stats unserialize($oldstats); 
    
$uid $forums->select("users", array("uid"), "username = '{$mysidia->input->post("username")}'")->fetchColumn();
    
    if(
$stats['lastuid'] == $uid) return FALSE;
    
$stats['numusers']++;
    
$stats['lastuid'] = $uid;
    
$stats['lastusername'] = $mysidia->input->post("username");
    
$newstats serialize($stats);
    
    
$forums->update("datacache", array("cache" => $newstats), "title = 'stats'");
    
$forums->delete("stats");
    
$forums->insert("stats", array("dateline" => time(), "numusers" => $stats['numusers'], "numthreads" => $stats['numthreads'], "numposts" => $stats['numposts']));
    return 
TRUE;
}

?>


Hall of Famer 08-20-2013 01:18 PM

Interesting, I never thought about that, but well MyBB's users table has like 50+ fields so its difficult to track each column down. This is why I've divided Mysidia's users table into several smaller pieces so each one gets no more than 15 columns, and ideally less than 10.


All times are GMT -5. The time now is 08:30 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.