07.11.2015, 18:05
Quote:
Can you show me ResetUserPassword function? And 'tName' 'Database' variables?
|
PHP код:
stock ResetUserPassword( DB:Database, Name[ ], Password[ ] )
{
new DBResult:Result;
if ( Database )
{
new
Query [ 512 ],
Pw[ 64 ];
format( Query, sizeof( Query ), "SELECT * FROM `users` WHERE `name`=lower('%s') AND `password`='%s'", Name, Pw );
Result = db_query( Database, Query );
if ( db_num_fields( Result ) )
{
db_free_result( Result );
format( Query, sizeof( Query ), "UPDATE `users` SET `password`='%s' WHERE `name`=lower('%s') AND `password`='%s'", Password, Name, Pw );
Result = db_query( Database, Query );
db_free_result( Result );
return 1;
}
else
{
db_free_result( Result );
return 0;
}
}
else
{
printf( "[ERROR] NO DATABASE!" );
return 0;
}
}