Tag Mismatch
#1

As the title says
on line 3
PHP код:
                    new pass[128];
                    
format(pass,sizeof(pass),"SELECT pPass FROM users WHERE pName = '%s'",PlayerName(playerid));
                    new 
pass2 mysql_query(1pass);
                    
PlayerInfo[playerid][pPass] = pass2
Reply
#2

Having non-threaded queries with R33+ would be something like the code below and if I understand correctly, your variable pPass is an integer?
PHP код:
new pass[128];
mysql_format(1pass,sizeof(pass),"SELECT pPass FROM users WHERE pName = '%e'"PlayerName(playerid));
new 
Cache:result mysql_query(1passtrue);
if (
cache_get_row_count()) PlayerInfo[playerid][pPass] = cache_get_row_int(00);
cache_delete(result); 
Though using threaded queries and a variable (global) for the connection handle is recommended.
Reply
#3

Yes it is because when I hash it the strings change into integers
Reply
#4

What do you mean the strings change into integers? It wouldn't do that if pPass has size of 129 in the enum, saving/loading the password as a string and in the table structure the type of the field for the password to be VARCHAR or CHAR.
Reply
#5

See:

The password hashed and changed into integer

Edit: the field is text not integer
Reply
#6

In that case use cache_get_row instead of cache_get_row_int.
Reply
#7

Ok but I don't understand what he did ?!
Reply
#8

I used mysql_format so we can escape strings using %e specifier (normally you'd use %s).
It executes the query (non-threaded) and cache is set to true so you can use the cache functions.
If there are rows, retrieve the data and assign them to the variable.
The last I suppose is like freeing the result.

I haven't used non-threaded for R33+ but I believe it's correct.

---

About the password, change the type to VARCHAR and length 129 in the table structure. Make sure that pPass has a size of 129 in your enum.
When registering and inserting the password, hash it (the size must be 129 in WP_Hash too) and insert it as a string.
When loading as dusk said, you need to use cache_get_row but as it's enum-array, you have to specify the length.
pawn Код:
cache_get_row(0, 0, PlayerInfo[playerid][pPass], 1, 129);
Reply
#9

You are amazing, Thank You again
Reply
#10

But it did't work, The value which recovered from the database is
""
So I login with "" not my password
and same for money, admin level, et...........
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)