php - Converting mysql_* to mysqli_* issue -
i using mysqlconvertertool
convert web application,
first issue faced code getting big dont understand means? small code before , see big.
//old code $ask_id = mysql_real_escape_string($_post['ask_id']); //after convert $ask_id = ((isset($globals["___mysqli_ston"]) && is_object($globals["___mysqli_ston"])) ? mysqli_real_escape_string($globals["___mysqli_ston"], $_post['ask_id']) : ((trigger_error("[mysqlconvertertoo] fix mysql_escape_string() call! code not work.", e_user_error)) ? "" : ""));
its working fine want know if correct way of mysqli_*
or there issue or bug need fix in line?
i want know how can make part secure
if (isset($_post['asking-money'])) { $dailybonus = 10000; $update = mysqli_query($globals["___mysqli_ston"], "update users set ask_time='$newtime', bonus='dailybonus' id='$userid'"); // more calculation }
the first bit of code looks (grossly) added giant ternary statement check variables using @ least set, other should able use:
mysqli_real_escape_string($globals["___mysqli_ston"], $_post['ask_id'])
as security sql query, try using prepared statements instead of directly querying variables
Comments
Post a Comment