change password?
#1

this is my registration dialog,how do i make change password dialog?i tried it but still cant.

Код:
	if(dialogid == DIALOG_REGISTER)
    {
        // If the user clicked the register button
        if(response)
        {
            // Check if the password is within 1 and 100 characters
            if(!strlen(inputtext) || strlen(inputtext) > 24)
            {
                // Re-show the dialog
                ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register {58D3F7}Password harus lebih dari 0 huruf,maksimal 24 huruf.{FFFFFF}", "{FFFFFF}Username kamu belum ada/belum ter-register! Tolong Register dan masukan password.", "Register", "Cancel");
            }
            else if(strlen(inputtext) > 0 && strlen(inputtext) < 24)
            {
                // Password was a valid length
                new 
					escapedPass[100], 
					query[200],
					playerName[28],
					Seconds = gettime(),
					myIPAddress[16]
				;
			
				GetPlayerIp(playerid, myIPAddress, sizeof(myIPAddress));
				GetPlayerName(playerid, playerName, 24);

                // Clean the string before inserting to the MySQL database
                mysql_real_escape_string(inputtext, escapedPass);
				
				format(query, sizeof(query), "INSERT INTO playerdata (playerName, playerPass, firstLogged, playerIP) VALUES('%s', SHA1('%s'), '%i', '%s')", playerName, escapedPass, Seconds, myIPAddress);
				mysql_query(query, MYSQL_RESULT_REGISTER, playerid, connection);
            }
        }
        if(!response)
        {
			ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register {58D3F7}Password harus lebih dari 0 huruf,maksimal 24 huruf.{FFFFFF}", "{FFFFFF}Username kamu belum ada/belum ter-register! Tolong Register dan masukan password.", "Register", "Cancel");
        }
    }
Reply
#2

Use the same method of escaping the password and stuff but instead use UPDATE instead of INSERT INTO. I highly recommend you to switch to threaded queries though.

pawn Код:
UPDATE playerdata SET playerPass = '%s' WHERE (What do you use to identifiy a player) = string/integer
Reply
#3

still cant,i just fuck it up..
Reply
#4

MySQL] Error (0): Failed to exeute query. 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 '`playerID`='122799'' at line 1.
Reply
#5

Create 'CMD:changepassword' with sscanf
pawn Код:
(params,"s[20]",password))
then use this
Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
pawn Код:
UPDATE playerdata SET playerPass = '%s' WHERE (What do you use to identifiy a player) = string/integer
under the cmd!
Reply
#6

how do i create it with sscanf? :/
Reply
#7

Seems like you literally have no idea what are you even doing.

I suggest you reading:

sscanf v2.8.1 - Now supports npcmodes
zcmd 0.3.1 | Fast & Simple Command Processor
Using BlueG's MySQL plugin R7 and newer (with cache)
Reply
#8

Do you have any codes of the "change password"-dialog so far?
If not can you start as far as you can?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)