MySQL Registration - Storing the hashed password to the end of the reg?
#4

Quote:
Originally Posted by Hargrave
Посмотреть сообщение
You are correct. Is that a good idea? Want to prevent half-registered members. I know you can make them finish the dialogs they didn't, but I don't really want that. Want it all to be done at once.

Update: I tried to temporarily store the data, but apparently that didn't work out well haha. Any suggestions? Want it to be as efficient as possible.
Yes, it is possible to just not push a query if any part of the registration is invalid. I'll try to explain it a bit more:

Код:
//Globals
#define MAX_REGISTRATION_PASSWORD       128 + 1 //See Dialog input limit
#define MAX_REGISTRATION_ORIGIN         128 + 1 //See Dialog input limit
enum REGISTRATION_ENUM {
    PASSWORD[MAX_REGISTRATION_PASSWORD],
    bool:GENDER, //False = male, true = female
    YEAR,
    ORIGIN[MAX_REGISTRATION_ORIGIN]
}
new registrationInfo[MAX_PLAYERS][REGISTRATION_ENUM];

//OnPlayerConnect (reset variables before showing the dialogs)
format(registrationInfo[playerid][PASSWORD], MAX_REGISTRATION_PASSWORD, "");
registrationInfo[playerid][GENDER] = false;
registrationInfo[playerid][YEAR] = 0;
format(registrationInfo[playerid][ORIGIN], MAX_REGISTRATION_ORIGIN, "");

//OnDialogResponse
//Password dialog
//Successfull
format(registrationInfo[playerid][PASSWORD], MAX_REGISTRATION_PASSWORD, myHashFunction(inputtext));
//Unsuccessfull
kick or reshown dialog to try again
//Gender dialog
//Successfull
registrationInfo[playerid][GENDER] = response; //Female
//Unsuccessfull
registrationInfo[playerid][GENDER] = response; //Male
//Year dialog
//Successfull
registrationInfo[playerid][YEAR] = strval(inputtext);
//Unsuccessfull
kick or reshown dialog to try again
//Origin dialog
//Successfull
format(registrationInfo[playerid][ORIGIN], MAX_REGISTRATION_ORIGIN, inputtext);
push query
//Unsuccessfull
kick or reshown dialog to try again
If you would like me te rewrite the code you posted on pastebin, with the steps I posted above. Ask me and I will comment every step so you can learn something from it. If however you can figure it out on your own with the info I provided, glad I could help .
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)