UDB to Whirlpool
#1

Hey, i've been wanting to switch to Whirlpool, but i have no idea to do that, even though i looked at many tutorials.
This is my code
pawn Код:
stock MySQL_Register(playerid, passwordstring[])
{
    new Query[300];
    mysql_real_escape_string(pInfo[playerid][Nick], pInfo[playerid][Nick]);
    // escaping the name of the player to avoid sql_injections.
    mysql_real_escape_string(pInfo[playerid][IP], pInfo[playerid][IP]);
    // escaping the IP of the player to avoid sql_injections.
    // as you might've seen we haven't escaped the password here because it was already escaped in our register dialog
    format(Query, sizeof(Query), "INSERT INTO `playerdata` (`nick`, `password`, `ip`) VALUES('%s', '%d', '%s')", pInfo[playerid][Nick], udb_hash(passwordstring), pInfo[playerid][IP]); // Here we use the INSERT option and insert the name, password, and ip of the player in the database.
    // we don't insert the score, admin, or any other variable because its automatically 0.
    mysql_query(Query);
    // here we do not need to mysql_store_result or mysql_free_result
    // because we are only inserting data in the database not selecting it
    //next we set the players logged variable to 1.
    //and the isregistered variable to 1 aswell.
    SendClientMessage(playerid, -1, "You have now been  successfully registered on this server!");
    pInfo[playerid][Logged] = 1; //Sets the login variable to 1, meaning logged in.
    pInfo[playerid][IsRegistered] = 1; // sets the registered variable to 1. meaning registered.    return 1;
}
And i would like to make this line into whirlpool
pawn Код:
format(Query, sizeof(Query), "INSERT INTO `playerdata` (`nick`, `password`, `ip`) VALUES('%s', '%d', '%s')", pInfo[playerid][Nick], udb_hash(passwordstring), pInfo[playerid][IP]); // Here we use the INSERT option and insert the name, password, and ip of the player in the database.
Reply
#2

pawn Код:
new
    Query[240],
    buff[129];

...

WP_Hash(buff, 129, passwordstring);
format(Query, sizeof(Query), "INSERT INTO `playerdata` (`nick`, `password`, `ip`) VALUES('%s', '%s', '%s')", pInfo[playerid][Nick], buff, pInfo[playerid][IP]);

...
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
new
    Query[240],
    buff[129];

...

WP_Hash(buff, 129, passwordstring);
format(Query, sizeof(Query), "INSERT INTO `playerdata` (`nick`, `password`, `ip`) VALUES('%s', '%s', '%s')", pInfo[playerid][Nick], buff, pInfo[playerid][IP]);

...
Thanks a lot. -solved-
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)