/Upload/documents/handbook/developer-guide/developer-guide-safe/to-prevent-sql-injection.html
HTML | 112 lines | 107 code | 5 blank | 0 comment | 0 complexity | 424f89460582c53a0d0544965cb7bb06 MD5 | raw file
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
- <html>
- <head>
- <title>The DoYouHaoBaby PHP Framework For PHP5 | ????????</title>
- <meta http-equiv="content-type" content="text/html; charset=gbk" />
- <meta name="Author" content="???Dyhb">
- <meta name="Keywords" content="DoYouHaoBaby,Framework">
- <meta name="Description" content="The DoYouHaoBaby PHP Framework | ?????????????">
- <link rel="stylesheet" type="text/css" href="./../../media/css/style.css" />
- <link rel="stylesheet" type="text/css" href="./../../media/css/highlight.css" />
- </head>
- <body style="margin:0">
- <div id="header"><img src="./../../media/images/logo.png" border="0" title="The DoYouHaoBaby PHP Framework Logo" ></div>
- <div id="content">
- <div id="version">
- The DoYouHaoBaby PHP Framework????????<br>
- Copyright(c) <a href="http://doyouhaobaby.net">DoYouHaoBaby.NET</a>
- All Rights Reserved.
- </div>
-
-
- <div class="menu">
- <table cellspacing=0 cellpadding=0 width="95%" border=0>
- <tbody>
- <tr>
- <th align=middle colspan=3>The DoYouHaoBaby PHP Framework????????</th>
- </tr>
- <tr>
- <td valign=bottom align=left width="25%">
- <a accesskey="p" href="../../index.html">??</a>?
- </td>
- <td valign=bottom align=middle width="50%">
- </td>
- <td valign=bottom align=right width="25%">
- <a accesskey="n" href="./index.html">??</a>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
-
- <div id="box">
- <div class="title">[ ??SQL?? ]</div>
- <div class="detail">
- <p>
- ??WEB?????SQL???????????????????????????????????????????????????</p>
- <p>
- ?????????<span style="color: rgb(0, 128, 0);"><strong>DoYouHaoBaby\LibPHP\App\Package\Db\DbObj\DbObjDriver\DbQualifyStrMysql.class.php</strong></span>?????????</p>
- <p><DIV class=dp-highlighter><DIV class=bar></DIV>
- <OL class=dp-j>
- <LI class=alt><SPAN><SPAN class=keyword>public</SPAN><SPAN> function qualifyStr($Value){ </SPAN></SPAN></LI>
- <LI><SPAN> </SPAN><SPAN class=keyword>if</SPAN><SPAN>(is_array($Value)){</SPAN><SPAN class=comment>// ????? </SPAN><SPAN> </SPAN></SPAN></LI>
- <LI class=alt><SPAN> foreach($Value as $nOffset=> $sV){ </SPAN></LI>
- <LI><SPAN> $Value[$nOffset]=$</SPAN><SPAN class=keyword>this</SPAN><SPAN>->qualifyStr($sV); </SPAN></SPAN></LI>
- <LI class=alt><SPAN> } </SPAN></LI>
- <LI><SPAN> </SPAN><SPAN class=keyword>return</SPAN><SPAN> $Value; </SPAN></SPAN></LI>
- <LI class=alt><SPAN> } </SPAN></LI>
- <LI><SPAN> </SPAN><SPAN class=keyword>if</SPAN><SPAN>(is_int($Value)){ </SPAN><SPAN class=keyword>return</SPAN><SPAN> $Value; }</SPAN><SPAN class=comment>// int </SPAN><SPAN> </SPAN></SPAN></LI>
- <LI class=alt><SPAN> </SPAN><SPAN class=keyword>if</SPAN><SPAN>(is_bool($Value)){ </SPAN></SPAN></LI>
- <LI><SPAN> </SPAN><SPAN class=keyword>return</SPAN><SPAN> $Value?$</SPAN><SPAN class=keyword>this</SPAN><SPAN>->_oConnect->getTrueValue(): $</SPAN><SPAN class=keyword>this</SPAN><SPAN>->_oConnect->getFalseValue(); </SPAN></SPAN></LI>
- <LI class=alt><SPAN> } </SPAN></LI>
- <LI><SPAN> </SPAN><SPAN class=keyword>if</SPAN><SPAN>(is_null($Value)){</SPAN><SPAN class=comment>// Null? </SPAN><SPAN> </SPAN></SPAN></LI>
- <LI class=alt><SPAN> </SPAN><SPAN class=keyword>return</SPAN><SPAN> $</SPAN><SPAN class=keyword>this</SPAN><SPAN>->_oConnect->getNullValue(); </SPAN></SPAN></LI>
- <LI><SPAN> } </SPAN></LI>
- <LI class=alt><SPAN> </SPAN><SPAN class=keyword>if</SPAN><SPAN>(!($Value </SPAN><SPAN class=keyword>instanceof</SPAN><SPAN> DbExpression)){ </SPAN></SPAN></LI>
- <LI><SPAN> </SPAN><SPAN class=keyword>return</SPAN><SPAN> G::getMagicQuotesGpc()?</SPAN><SPAN class=string>"'"</SPAN><SPAN>.$Value.</SPAN><SPAN class=string>"'"</SPAN><SPAN>:</SPAN><SPAN class=string>"'"</SPAN><SPAN>.mysql_real_escape_string($Value,$</SPAN><SPAN class=keyword>this</SPAN><SPAN>->_oConnect->getCurrentConnect()).</SPAN><SPAN class=string>"'"</SPAN><SPAN>; </SPAN></SPAN></LI>
- <LI class=alt><SPAN> } </SPAN></LI>
- <LI><SPAN> </SPAN><SPAN class=keyword>return</SPAN><SPAN> $Value->makeSql($</SPAN><SPAN class=keyword>this</SPAN><SPAN>->_oConnect); </SPAN></SPAN></LI>
- <LI class=alt><SPAN> } </SPAN></LI></OL></DIV></p>
- <p>
- ???</p>
- <p><DIV class=dp-highlighter><OL class=dp-j>
- <LI class=alt><SPAN><SPAN>$oUser=UserModel::F('user_id=?',$_GET['id'])->getOne(); </SPAN></SPAN></LI></OL></DIV></p>
- <p>
- ????????????id????????????????????????DoYouHaoBaby ???????CURD??????????????????</p>
- <p>
- ???????????????????????????????????????????????????SQL??????????</p>
- <p>
- ????????????????????????????</p>
- <p>
- ??????????????????????????<span style="color: rgb(255, 0, 0);"><strong>??????</strong></span></p>
- <p>
- ??????????????????????????</p>
- <p>
- ?????????????????<DIV class=dp-highlighter><OL class=dp-j>
- <LI class=alt><SPAN><SPAN>$nId=intval(G::getGpc('id','G')); </SPAN></SPAN></LI></OL></DIV></p>
- <p>
- ??????????????????????????????</p>
- </div>
- </div>
-
- <div class="menu">
- <table cellspacing=0 cellpadding=0 width="95%" border=0>
- <tbody>
- <tr>
- <td valign=top align=middle width="34%">
- <a accesskey="h" href="../../index.html">??</a>
- </td>
- </tr>
- <tr>
- <td valign=top align=middle width="34%">
- <a accesskey="u" href="./index.html">??</a>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
-
- </div>
- <div id="footer">Copyright (c) <a href="http://doyouhaobaby.net" title="The DoYouHaoBaby Framework" >DoYouHaoBaby</a> All rights reserved.?</div>
- </body>
- </html>