Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Suggestions and Feature Requests (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=21)
-   -   MyBB intergration (http://www.mysidiaadoptables.com/forum/showthread.php?t=1144)

exdiogene 10-20-2009 02:52 PM

MyBB intergration
 
I would love Adoptables Script to be intergrated into MyBB! Would be great. It would mean users would only have one login and password. Any ideas/tutorial on how it would be done?

Thanks :D

Seapyramid 10-20-2009 03:01 PM

RE: MyBB intergration
 
Brandon has said that he might make a tutorial on this at some point. You best bet would be to research on the MyBB forums for support on intergration. You can intergrate MyBB with Joomla using JFusion & it is also possible to combine PHPAdoptables with Joomla using JFusion.

Sea

exdiogene 10-20-2009 03:15 PM

RE: MyBB intergration
 
ok thanks. So Jfusion seems to be the best bet then.

Arianna 10-23-2009 02:37 PM

RE: MyBB intergration
 
I'm still very interested in this, as I'm working with people to possibly convert a forum with 100,000+ posts and integrate it with the adoptables system. Though this isn't an exact plan, I'd love to see this project go further.

exdiogene 10-23-2009 04:35 PM

RE: MyBB intergration
 
Im learning PHP at the moment but have never worked with a script this complex before... I have a smaller forum that I want to intergrate before i get lots of members.

Arianna 10-24-2009 02:27 AM

RE: MyBB intergration
 
I think that we would be doing similar things, then. :D
I'm not good at PHP. I haven't bothered to take a tutorial or anything and I've just dived into editing all of the PHP files for this script. However, I will have no idea what to do for a bridge.
From my knowledge (which isn't much) it would take merging two tables, changing all of the prefixes, adding rows to the user table, changing 2 register pages, and... that's all, I think. I know there's more, but I don't know PHP. Any ideas?

exdiogene 10-24-2009 04:36 AM

RE: MyBB intergration
 
Well I think we would need to, like you say, edit the script so it takes users from MyBB_users. I was going to use the MyBB forum to register users.

Could we not just change (in login.php):

PHP Code:

$query "SELECT * FROM ".$prefix."users WHERE username = '$username'"

to

PHP Code:

$query "SELECT * FROM "mybb_"users WHERE username = '$username'"


Arianna 10-24-2009 08:56 AM

RE: MyBB intergration
 
That's a good idea, if they're in the same table. But how do we go about on stuff like passwords (don't they have different encryption?) and stuff.
I'm going to go compare tables for a minute, I'll be right back. :)[hr]
The fact that there are about 50 columns in the mybb user table makes me shudder. Thank goodness there are only 13 for myadopts.
How do we merge them, though? I have a feeling that all I'll do is mess everything up. xP

Seapyramid 10-24-2009 09:17 AM

RE: MyBB intergration
 
Quote:

Originally Posted by tommyk1210
Well I think we would need to, like you say, edit the script so it takes users from MyBB_users. I was going to use the MyBB forum to register users.

Could we not just change (in login.php):

PHP Code:

$query "SELECT * FROM ".$prefix."users WHERE username = '$username'"

to

PHP Code:

$query "SELECT * FROM "mybb_"users WHERE username = '$username'"


That won't work alone because it wont set the cookies for the Adoptables script so therefore the script wont see them as being logged in.

Sea

Arianna 10-24-2009 09:23 AM

RE: MyBB intergration
 
I've tried to edit the member.php file for mybb, but it's so unbearably complicated I can't even tell what the actual 'register' action is. :P
Is it possible to remove some fields without damaging the complete forum structure, do you think? (I'm using a test part of the site, so it doesn't really matter that much, though. xP)

exdiogene 10-24-2009 09:37 AM

RE: MyBB intergration
 
I would think that it would be easier to edit the Adoptables script as MyBB has a lot more files depending on the integrety of the member.php

Arianna 10-24-2009 09:52 AM

RE: MyBB intergration
 
Yes, you do have a point. :)
However, it does set default values on stuff like that, I think. And another thing - banning might be a problem. xP
And yet another thing - I looked at the passwords on both things, and they are encoded differently. xP[hr]
Another thing, though - I think registering on the forum is more important for my needs. xP

exdiogene 10-24-2009 10:00 AM

RE: MyBB intergration
 
I tohught they were both MD5 encoded?

Arianna 10-24-2009 10:04 AM

RE: MyBB intergration
 
Maybe one is different. If I use a test password - 'password' the MD5 is '5f4dcc3b5aa765d61d8327deb882cf99' right? I'll edit and see what happens. :)
By the way, do you know what 'salt' is in the mybb table?[hr]
This is what I have, straight from phpmyadmin. This is the password encoding.
adopts_users: 5f4dcc3b5aa765d61d8327deb882cf99
mybb_users: 7370faafe822e685d2fe3e535f6fe78e

Certainly not the same...[hr]
The second one (mybb) doesn't fit, look.
Password | | | password
Crypt Hash | | | 1$s7aoXaH7NEs
MD5 Hash | | | 5f4dcc3b5aa765d61d8327deb882cf99
SHA Hash | | | 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8
MD5 Salted Hash | | | 0fh3vXJhFAOnI

exdiogene 10-24-2009 10:22 AM

RE: MyBB intergration
 
i tihnk MyBB uses salt and hash, i have asked how to intergrate on the MyBB forum and nobody has replied.[hr]
It seems that (when you change the table it gets the name and pass from) it only has trouble decoding the pass. Any ideas anyone? Sea? Brandon?[hr]
MyBB Salt is the way it encodes the pass to make it more secure, anyone know how to use salts in the adoptables script?

Arianna 10-24-2009 10:38 AM

RE: MyBB intergration
 
I asked too - I hope they answer.
I don't know how to use salts in the adoptables script, sadly. It uses another column in the table - that's about all i know.

exdiogene 10-24-2009 10:50 AM

RE: MyBB intergration
 
well salts are just used ot make the bruteforcing of passwords a longer process, it simply takes the pass and adds the salt on the end, then converts it to MD5 (i think)

For example:

You have a password = "password" which has a MD5 hash of "5f4dcc3b5aa765d61d8327deb882cf99"
but if you add a salt = "eth7"
the string becomes = "passwordeth7"
which makes the MD5 = "804462e52e923941708106a10c6fb416"
So, unless the hacker has the correct salt in their dicitonary after the password then the time taken to crack is considerably longer.[hr]
I think it should be something like this, i know its not the right way round but...:

PHP Code:

$password md5($password,$salt);

$query "SELECT * FROM mybb_users WHERE username = '$username'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);

//Loop out code
$i=0;
while (
$i 1) {

$luser=@mysql_result($result,$i,"username");
$lpass=@mysql_result($result,$i,"password,");
$lsalt=@mysql_result($result,$i,"salt,");

$i++;
}

if(
$username == $luser and $password == $lpass$lsalt){
$article_title "Login Successful!"


Arianna 10-24-2009 11:41 AM

RE: MyBB intergration
 
I saw that it was something like
(md5(salt[$.password]))
Or the like. The problem is, it won't log in on both, I think.

exdiogene 10-24-2009 12:03 PM

RE: MyBB intergration
 
Quote:

(md5(salt[$.password]))
On MyBB?

And yes sessions could be an issue. We could probably get it so the logins work on both.

So: in login.php
PHP Code:

$password md5($password); 

should beocme:
PHP Code:

$passwordmd5(salt[$password])); 

Then the salt and pass need to be extracted form the database and matched to the string. Correct?

Seapyramid 10-24-2009 12:35 PM

RE: MyBB intergration
 
Session cookies are the hardest part to set up. They are quite confusing as well. Your bridge has to incorporate a simple cookis session for Adopts & a complicated one for the forum & even the simple one gets complicated. http://www.w3schools.com/PHP/php_sessions.asp gives you some background but it takes time to actually figure it all out.

Sea

exdiogene 10-24-2009 12:53 PM

RE: MyBB intergration
 
hey Sea, you got any idea how to just bridge the tables? So passwords work? Then I'll have a look at sesisons.

Arianna 10-24-2009 12:55 PM

RE: MyBB intergration
 
Gosh, I fail at this. xP
I learned cookies over the summer (not an easy feat for a 13 year old) and that was hard enough. I better go through the lessons before that before I get up to that, right? Having basic PHP knowledge would be useful here. x3
As for the cookies - I think so. The only problem, is even with the salt, I don't think that the first password thing is the same. So are we changing a function in both login.php and register.php?

exdiogene 10-24-2009 01:03 PM

RE: MyBB intergration
 
Well I was planning on removing the Registation from Adoptable script and using MyBB's to make the process simpler. With the salt the password will be exactly the same.

Here is how it works:

PASSWORD + Salt = saltPASSWORD which is then coded into MD5

Basically the script just needs to take the pass the user has entered into the form, query the salt from the database then add that to the front. Then convert ot MD5 and check if it matches the password hash in the MyBB_users table.

Off Topic: BTW arianna, I'm 16 ;) doing A-level Computing a year early.

Arianna 10-24-2009 01:15 PM

RE: MyBB intergration
 
I think that that idea is smarter. :) I won't remove the registration, I'll just rename it or something.
Ah, I get it now. That's why it doesn't work like that.

Hmm, so how do we now get this to work with the adoptables?

exdiogene 10-24-2009 01:25 PM

RE: MyBB intergration
 
Well we need to make it take the username and pass from the Mybb_users tbale instead of Adopt_users table. We then need it to take the salt from the database where the UID = the one we want. Then it needs to add the salt to the password we enter, and encode it in MD5. Then it matches that to the Password string in the Mybb_users table :D

So, Im guessing in login.php:

This:
PHP Code:

$password md5($password); 


should become this:
PHP Code:

$salt "SELECT salt FROM mybb_users WHERE username = '$username'";
$password md5($salt.($password)); 


Arianna 10-24-2009 01:49 PM

RE: MyBB intergration
 
Shouldn't everything be in one table? That way, if a user changes her/his password, they can still log on, right?
As for the code, where are we getting the actual password from. From the mybb table, or from the adopts user table?

exdiogene 10-24-2009 01:53 PM

RE: MyBB intergration
 
we are getting the username and password from the MyBB tables and using the Adopts tables for the levels and adopts etc...

The adopts_users tbale could be dropped as it wouldnt be needed any more and the fields form the Adopts_users table could be added into the MyBB_users table.

Arianna 10-24-2009 02:24 PM

RE: MyBB intergration
 
That's good - maybe dropping the table is necessary - I haven't found out how to merge, so I'll do it manually.

exdiogene 10-24-2009 02:29 PM

RE: MyBB intergration
 
It shouldnt be nessiccary to drpo it, just the tbale wont be used anymore so there is no point really having it. I would make sure you can bridge the scripts before you do anything with the database. ;)

Arianna 10-24-2009 02:35 PM

RE: MyBB intergration
 
Okay, that's a good idea. I'm using a test database, so it doesn't matter.
I'll catch up on this later, I'm sort of busy right now. Have you worked out anything about the sessions?

BMR777 10-24-2009 02:53 PM

RE: MyBB intergration
 
This might help. I just remembered that I sent an email to someone a long time ago on how to integrate the script possibly with PunBB, however a lot of the advise applies to MyBB as well:

Quote:

As far as login integration goes, it is possible. What you can probably do is just disable registrations through the adoptables script and have all the registrations handled by PunBB by removing register.php. Now the adoptables script uses its own cookies for storing user data, so you can probably very easily change the login system to instead read from PunBB's database tables and write to the cookies rather than reading from the Adoptables database tables and write to the cookies.

In functions.php, look at the logincheck() function, which basically checks the cookie values against the database to see if a user is logged in. Rather then querying the adopts_users table for the username / password, just query through PunBB's database tables for this info.

Also, you'll want to look at login.php and change the database portions to read from the PunBB tables and not the adopts_ tables.

You'll also have to make some adjustments to the usergroups. In functions.php the cancp function handles if a user can access the site's Admin CP and the cando function determines what users can do, such as adopt pets, or which portions of the ACP they can access if they are admins. Basically for the usergroups what you need to do is edit the getgroup() function in functions.php to make it select the user's usergroup from PunBB's database tables. Then you need to make sure the numerical IDs of the adopts_groups table data MATCH the ones from PunBB, so in my script Root Admins are group 1, so if say in PunBB root admins are group 4, you need to change the root admins group on the adoptables script from group 1 to group 4.

Lastly, you'll need to edit the profile.php page to read the user's profile data from PunBB rather than from the adopts_users table.

That should be basically what you need to do for login integration. This way the forums handle all registrations of new and existing members and users just log in to the adoptables script with the same username / password as on the forums and it all should work fine. :)
Also, this code may help. It's some code I wrote for a custom CMS script to allow for MyBB integration. If you replace the logincheck() function in inc > functions.php with the following code this will help with MyBB integration.

PHP Code:

function logincheck(){

include(
"forum/inc/functions_user.php");

if (isset(
$_COOKIE['ourusername']) and isset($_COOKIE['ourpass'])){

$username $_COOKIE['ourusername'];
$password $_COOKIE['ourpass'];

$username secure($username);
$password secure($password);

/*
//Don't check the salt of the password as we did this when we logged in...

//First we select the salt from the database where we have a username match...

$query = "SELECT * FROM mybb_users WHERE username = '$username'";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

$salt=@mysql_result($result,$i,"salt");

$i++;
}

//Now we salt the password...

$saltedpw = salt_password($password, $salt);

*/

//Run login operation
$query "SELECT * FROM mybb_users WHERE username = '$username'";
$result mysql_query($query);
$num mysql_numrows($result);

//Loop out code
$i=0;
while (
$i 1) {

$luser=@mysql_result($result,$i,"username");
$lpass=@mysql_result($result,$i,"password");

$i++;
}

    if(
$username == $luser and $password == $lpass){
        
$isloggedin "yes";
    }
    else{
    if (isset(
$_COOKIE['ourusername'])){
    
$past time() - 10
    
setcookie("ourusername",$username,$past);
    }

    if (isset(
$_COOKIE['ourpass'])){
    
$past time() - 10
    
setcookie("ourpass",$password,$past);
    }
    
$isloggedin "no";
    }

}
else
{
//User is not logged in
$isloggedin "no";



//Return our user data
$userdata[loginstatus] = $isloggedin;
$userdata[username] = $username;

return 
$userdata;



Then you may have to edit login.php and logout.php, but I am not sure. Then just make sure that the usergroups match up in the Adoptables Admin CP with the ones in MyBB and you are all set. :)

Whatever username users register for on the forums should be the one their adoptables are saved under. :)

I hope this helps,
Brandon

exdiogene 10-24-2009 02:58 PM

RE: MyBB intergration
 
Thnaks brandon, ill get into this tommorrow, for now i am going on my games sevrer :D see ya guys

Arianna 10-24-2009 03:04 PM

RE: MyBB intergration
 
Thanks, Brandon. I have to go to bed (Europe. xP) but I'll also look at it tomorrow.

exdiogene 10-25-2009 01:23 PM

RE: MyBB intergration
 
hey brandon when i add that code it says it cant reefine logincheck function... :(

BMR777 10-25-2009 01:24 PM

RE: MyBB intergration
 
Did you replace the existing one with that one? :)

exdiogene 10-25-2009 01:47 PM

RE: MyBB intergration
 
yes, then it gave php errors, causing me to reupload my adoptables script wich caused me all that hassle today with the DB lol XD

Arianna 10-25-2009 01:49 PM

RE: MyBB intergration
 
That's not good. :/

Arianna 10-30-2009 01:07 PM

RE: MyBB intergration
 
Have we forgotten about this? I'd still really like to implement this.
How about, in the mybb table, creating the columns:
Code:

uid (have they got something like this already?), email, usergroup, newmessagenotify, membersince, isbanned, website, profilepic, aim, yahoo, msn
And then what we do, is in mybb file member.php, in the action 'register' (on line 315 it starts with the 'register' action, ends at line 721), we change... I can't find where it actually INSERTS the thing into the table. Any help here?

The 1000+ lines in this php file are somewhat daunting.

kamrinjacobs 02-23-2010 01:43 AM

RE: MyBB intergration
 
Hello..
You say right that You can intergrate MyBB with Joomla using JFusion & it is also possible to combine PHPAdoptables with Joomla using JFusion.I have been tried to integrate mybb with joomla using jfusion It was integrate.thanks jfusion is best for integrate.

Arianna 02-24-2010 12:04 AM

RE: MyBB intergration
 
There is a mod for this in the premium members section.


All times are GMT -5. The time now is 10:43 AM.

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