SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Thread Tools Display Modes
Old 19/05/2017, 07:42 PM   #1
Little Clucker
Join Date: May 2017
Posts: 5
Reputation: 0
Default Comparing two strings

Hi, I've seen a lot of topics on this topic, but none of them could help me in any way. I would like to compare the encrypted password from the database with the encrypted text entered in the dialog. Someone knows something?

		    new Hash2[80];
			new rows2, fields2;
            mysql_query(mySQLconnection, sprintf("SELECT haslo FROM ipb_characters WHERE char_name = '%s' LIMIT 1", pInfo[playerid][player_name]));
			cache_get_data(rows2, fields2);
			format(Hash2, sizeof(Hash2), "%s%s", MD5_Hash(gInfo[playerid][global_salt]), MD5_Hash(inputtext));
			format(Hash2, sizeof(Hash2), "%s", MD5_Hash(Hash2));
			if(!strcmp(Hash2,rows2, true))
			SendClientMessage(playerid, -1, "Nice Passwd, good boy");
			gInfo[playerid][global_logged] = true;
			SendClientMessage(playerid, -1, "Wrong Passwd");
			return 1;
Thanks for help!
addys1 is offline   Reply With Quote
Old 19/05/2017, 07:49 PM   #2
Huge Clucker
Join Date: Oct 2012
Posts: 219
Reputation: 11
Default Re: Comparing two strings

Can you show us the DIALOG_REGISTER?
Aly is offline   Reply With Quote
Old 20/05/2017, 12:48 AM   #3
Big Clucker
CheezIt's Avatar
Join Date: Apr 2017
Posts: 178
Reputation: 17
Default Re: Comparing two strings

Strcmp (native function) is used to compare strings (or more precisely, 2 strings). Do the same procedure on "inputtext" (var returned by OnDialogResponse, being the inputted text in the dialog) and compare it to the hash provided by an SQL statement (load the hash and use the variable/array to compare instead of a repetitive query).

Also, a hash isn't a form of encryption. Hashes are one way.
I'd like to bring back my old CNR server that was created from scratch & hosted years ago. I'll host & update everything (including the website & forum). You would pay for hosted tab and help manage the community. PM me if you're interested!
CheezIt is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing two strings. nerovani Scripting Help 6 24/03/2016 11:05 AM
Comparing 2 strings using strcmp. Black Axe Scripting Help 2 20/01/2016 07:26 AM
Comparing 2 strings Aa12 Scripting Help 8 08/01/2016 05:20 PM
comparing strings HondaCBR Scripting Help 2 02/01/2012 02:15 PM
Help with comparing two strings OUL Scripting Help 2 02/11/2011 05:11 PM

All times are GMT. The time now is 03:15 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.