AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Query doesn't work with format? (https://forums.alliedmods.net/showthread.php?t=27032)

Migs Davis 04-13-2006 16:42

Query doesn't work with format?
 
It's basically working, except one part. You'll find the line

fResult = dbi_query(forum, "SELECT username FROM `phpbb_users` WHERE user_password = MD5('%s')", Arg2)

in the code somewhere. It checks the password they type in via amx_reg arg1 arg2 against the password stored in the database.. but it doesn't work. When I hardcode my own password instead of %s it works, but if I type my password as arg2 it doesnt. Any ideas?

Code:
public cmd_reg(id){      client_print(id, print_console, "Command Started")      new Arg1[24]      new Arg2[24]      new forumName[15]      new returnName[15]      //Get the command arguments from the console      read_argv(1, Arg1, 23)      read_argv(2, Arg2, 23)      client_print(id, print_console, "Command Got Past Arg Read")      forum = dbi_connect("67.19.24.146","rideout_foruma","password","rideout_phpb1", ferror, 50)      server_print(error)      if (dbc == SQL_FAILED)      {         client_print(id, print_console, "DB connect failed")         new err[255]         new errNum = dbi_error(dbc, err, 254)         server_print("error1: %s|%d", err, errNum)         log_amx("MySQL connect failed")         log_amx(err)      }  else {         client_print(id, print_console, "DB connect Succeeded")         server_print("Connected Successfully To Database")         log_amx("[list] Connected Successfully to Database")         init=1      }      new authid[32]      new num      get_user_authid(id,authid,31)      fResult = dbi_query(dbc,"SELECT forumname FROM list WHERE steamid = '%s'",authid)      if (fResult == RESULT_NONE)         client_print(id, print_console, "You haven't registered a forum name yet")      else if (fResult == RESULT_FAILED)         client_print(id, print_console, "Query Failed")      else {         client_print(id, print_console, "Query Succeeded Too Well")         num = dbi_num_rows (fResult)         client_print(id, print_console, "The number of rows returned is %d", num)         dbi_nextrow (fResult)         dbi_result(fResult, "forumname" ,forumName,14)         client_print(id, print_console, "The value of forumname is %s", forumName)         if ( (forumName[0] == 'N') && (forumName[1] == 'O') && (forumName[2] == 'T') )         {            client_print(id, print_console, "You haven't registered yet, %s, %s", Arg1, Arg2)            fResult = dbi_query(forum, "SELECT username FROM `phpbb_users` WHERE user_password = MD5('%s')", Arg2)            if (fResult == RESULT_NONE)               client_print(id, print_console, "some error none")            else if (fResult == RESULT_FAILED)               client_print(id, print_console, "some error failed")            else {               dbi_nextrow (fResult)               dbi_result(fResult, "username" ,returnName,14)               client_print(id, print_console, "The value of returnName is %s", returnName)            }         }         else         client_print(id, print_console, "You've already registered!")      }      dbi_free_result(fResult)      dbi_close(forum)      return PLUGIN_HANDLED }


All times are GMT -4. The time now is 05:01.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.