PDA

View Full Version : Mybb code integeration


YouHack
24/04/2017, 07:18 PM
Hello,
I want to make a code to integer mybb forums to samp for auto-registration at forum when someone registers in-game... it's simple but i'm stuck, so I already started a code, but it gave me this error:

[15:35:02] ================================================== ==================
[15:35:02] Error ID: 1064, Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''yhy36XXXX8B5z6zWAM3b536tOTwh35L98i4EA4544ytXT7W3 lEqJ22i19kBE3334CE63' at line 1
[15:35:02] Callback:
[15:35:02] gQuery: INSERT INTO `mybb_users` (`uid`,`username`,`password`,`salt`,`loginkey`) VALUES ('2','Youssef','BE3334CE634XXXXBC9C07E58EC9FE47E', 'yhy36XXXX8B5z6zWAM3b536tOTwh35L98i4EA4544ytXT7W3l EqJ22i19kBE3334CE63
[15:35:02] ================================================== ==================
when i had alot of errors, i deleted the server snapshot, and i'll start it again, so i need i help, please!
note: i have the same gameserver database as the forum, i use prefix of mybb_*

[WSF]ThA_Devil
24/04/2017, 07:38 PM
The line doesn't seem to be closed. Could it be that you've ran out of the string buffer space for the query?

YouHack
24/04/2017, 07:43 PM
But i tried to make the string upto [1000]

[WSF]ThA_Devil
24/04/2017, 07:45 PM
But i tried to make the string upto [1000]

Please print(); the query and see if that's the issue, or maybe is it your syntax.

YouHack
24/04/2017, 07:46 PM
and yhy36XXXX8B5z6zWAM3b536tOTwh35L98i4EA4544ytXT7W3lE qJ22i19kBE3334CE63 is more than the 50 caracters that i generated!!
** ok i'll remake the code and reply again if it didn't work

[WSF]ThA_Devil
24/04/2017, 07:49 PM
and is more than the 50 caracters that i generated!!
** ok i'll remake the code and reply again if it didn't work

I meant the actual query that you format in the server.

format(query, blah blah..);
print(query);

YouHack
24/04/2017, 08:18 PM
Yes, that's what i'll do

YouHack
24/04/2017, 09:31 PM
Here's the output of the random salt and random key + hashed password:
http://i.imgur.com/YQKglXT.png
it's working correct, so the problem must be in the sql. ( v R33 )
here's the code:
#include <a_samp>
#include <md5>

stock randomSalted(strDest[], strLen = 8)
{
while(strLen--)
strDest[strLen] = random(2) ? (random(26) + (random(2) ? 'a' : 'A')) : (random(10) + '0');
}

stock randomKey(strDest[], strLen = 50)
{
while(strLen--)
strDest[strLen] = random(2) ? (random(26) + (random(2) ? 'a' : 'A')) : (random(10) + '0');
}

stock HashMyBBPassword(string[], salt[])
{
new string2[96];
format(string2, sizeof(string2), "%s%s", MD5_Hash(salt), MD5_Hash(string));
for(new i=0; i < sizeof(string2); i++)
{
string2[i] = tolower(string2[i]);
}
string2 = MD5_Hash(string2);
return string2;
}

main()
{
new salted[8], loginkey[50], mybb[128], password[30];
format(password, sizeof(password), "thepassword"); // just to set a password to salt
randomSalted(salted, 8);
randomKey(loginkey, 50);
print(loginkey);
print(salted);
format(mybb, sizeof(mybb), "%s", HashMyBBPassword(password, salted));
print(mybb);
}

YouHack
24/04/2017, 10:09 PM
also, here is the query of mysql (R33)
http://i.imgur.com/GSSkKXK.png
is there any problem on it?

DRIFT_HUNTER
25/04/2017, 12:10 AM
That query looks fine...Only thing i can notice is '1' (uid). While that is integer you are saving it as a string, but if i remember correctly MySql handles that so i dont think that's a problem...

[WSF]ThA_Devil
25/04/2017, 03:22 PM
Well, you could try updating to R39-6 and see if that fixes it. As DRIFT_HUNTER said, there doesn't really seem anything to be wrong with it, so it could be something with the plugin.

YouHack
25/04/2017, 09:47 PM
Okey, but as the string i just formatted it to appear as 1 ( just to test query ),
better to troubleshot it, i'll focus on print in realtime register. in the server