Is there a risk of injection? Solution

Source: Internet
Author: User
Is there a risk of injection? Is there a risk of injection? After reading this basic query method, it seems that you have made any filtering measures for $ SQL, but mysql_query directly queries. PHPcodepublicfunction_query ($ SQL) {global $ Config; if (! $ This-& gt; does MysqlConnec AMP have the risk of being injected?
Is there a risk of injection? After reading this basic query method, it seems that you have made any filtering measures for $ SQL, but directly queried by mysql_query.
PHP code
      public function _query($sql)     {        global $Config;        if(!$this -> MysqlConnect) Return false;        $this -> QueryStatus = '(0)';        $this -> Affected = 0;        if($Config['DebugSql']) $this -> SqlBug .= "\n". '
  ' . "\n";        $result = mysql_query($sql, $this -> MysqlConnect);        if (!$result) Return false;        $this -> Affected = mysql_affected_rows();        $this -> QueryStatus = '(ok)';        Return $result;    }


------ Solution --------------------
Hello. Both the main site and demonstration use this framework. external parameters are filtered by default.
It may be risky unless you filter Config. php out and do not judge it.


If you have any questions, please feel free to give feedback,
------ Solution --------------------
From this method, there is no risk of injection.
The internal implementation of mysql_query has eliminated known injection methods.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.