MySQL login/register problem - Case Sensitive.
#1

Hey,

I'm currently having problems with my registration system and it's quite major... Say a player has the name "John", someone can sign up under "john" and it allows them both to have the same name... Now I've been messing around with the collation of the database along with the query and I can't seem to get it fixed.

My current query to check if they're already registered:
Код:
format(Query, 500, "SELECT * FROM `playerdata` WHERE `username` COLLATE latin1_general_cs = '%s' AND `password` = md5('%s')", pInfo[playerid][User], inputtext); 
            mysql_query(Query);
            mysql_store_result();
            if(mysql_num_rows() > 0)
Reply
#2

I think you're looking for strcmp which is it's third parameter.
Код:
(const string1[], const string2[], bool:ignorecase, length)

ignorecase (optional) - When set to true, the case doesn't matter - HeLLo is the same as Hello. When false, they're not the same.
Reply
#3

Doesn't seem to work.
Reply
#4

Here's an example:
pawn Код:
if(!strcmp("word", "Word", false)) // This would return FALSE since it's case sensitive)
And if you change it to true:
pawn Код:
if(!strcmp("word", "Word", true)) // Returns words matches (case ignored)
Reply
#5

Have you try using BINARY?

pawn Код:
format(Query, 500, "SELECT * FROM `playerdata` WHERE BINARY `username` = '%s' AND `password` = md5('%s')", pInfo[playerid][User], inputtext);
I will suggest you use more strong hash method then md5
Reply
#6

Quote:
Originally Posted by doreto
Посмотреть сообщение
Have you try using BINARY?

pawn Код:
format(Query, 500, "SELECT * FROM `playerdata` WHERE BINARY `username` = '%s' AND `password` = md5('%s')", pInfo[playerid][User], inputtext);
I will suggest you use more strong hash method then md5
Or... None?

pawn Код:
SELECT * FROM `playerdata` WHERE `username` = '%s' AND `password` = md5('%s')
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)