Mybb code integeration
#1

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 ''yhy36XXXX8B5z6zWAM3b536tOTwh35L98i4EA4544ytXT7W3lEqJ22i19kBE3334CE63' at line 1
[15:35:02] Callback: 
[15:35:02] gQuery: INSERT INTO `mybb_users` (`uid`,`username`,`password`,`salt`,`loginkey`) VALUES ('2','Youssef','BE3334CE634XXXXBC9C07E58EC9FE47E','yhy36XXXX8B5z6zWAM3b536tOTwh35L98i4EA4544ytXT7W3lEqJ22i19kBE3334CE63
[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_*
Reply
#2

The line doesn't seem to be closed. Could it be that you've ran out of the string buffer space for the query?
Reply
#3

But i tried to make the string upto [1000]
Reply
#4

Quote:
Originally Posted by YouHack
Посмотреть сообщение
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.
Reply
#5

and
Quote:

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
Reply
#6

Quote:
Originally Posted by YouHack
Посмотреть сообщение
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);
Reply
#7

Yes, that's what i'll do
Reply
#8

Here's the output of the random salt and random key + hashed password:

it's working correct, so the problem must be in the sql. ( v R33 )
here's the code:
PHP код:
#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(string2sizeof(string2), "%s%s"MD5_Hash(salt), MD5_Hash(string));
    for(new 
i=0sizeof(string2); i++)
    {
        
string2[i] = tolower(string2[i]);
    }
    
string2 MD5_Hash(string2);
    return 
string2;
}
main()
{
    new 
salted[8], loginkey[50], mybb[128], password[30];
    
format(passwordsizeof(password), "thepassword"); // just to set a password to salt
    
randomSalted(salted8);
    
randomKey(loginkey50);
    print(
loginkey);
    print(
salted);
    
format(mybbsizeof(mybb), "%s"HashMyBBPassword(passwordsalted));
    print(
mybb);

Reply
#9

also, here is the query of mysql (R33)

is there any problem on it?
Reply
#10

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...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)