note 111466 added to security.database.sql-injection

From: Date: Fri, 22 Feb 2013 09:53:17 +0000
Subject: note 111466 added to security.database.sql-injection
Groups: php.notes 
Request: Send a blank email to php-notes+get-193727@lists.php.net to get a copy of this message
Sorry there must be an upgrade of the script modurator can you delete the past <?php /** * @author Lieven Roegiers * @copyright 2009 * @CMS autosite * opensource http://code.google.com/p/autosite/ * <script language='JavaScript' src='<?php print $autosite['javascript']?>form.val.js'></script> * <form onsubmit="return formCheck()" enctype="text/plain" method="GET"></form> */ class valid{ public function is_valid(&$GETorPOST){ if(is_array($GETorPOST)){ foreach($GETorPOST as $key=>$value){ $V2 = strtoupper($value); //print_r($GETorPOST); //print "XXXXXXXX".$key; if($this->is_phpkeyinject($V2)){ //print "1"; return false; } if( $this->is_phpinject($V2)|| $this->is_sqlinject($V2) ){ //print "2"; return false; } } } //print "3"; return true; } /** * Prevention of * files.php?login_id=1234567890 OR 1=1 * De volgende SQL query wordt uitgevoerd: * SELECT * FROM files WHERE id = 1234567890 OR 1=1 * * * @param mixed $var * @return */ function is_sqlinject($var){//DROP TABLE return strpos($var,"DROP TABLE")|| strpos($var,"DROP")|| strpos($var,"OR 1=1")|| (strpos($var," WHERE ") && strpos($var," OR "))|| (strpos($var," OR ") && strpos($var," LIKE "))|| (strpos($var,"\'' ") < strpos($var," LIKE "))|| (strpos($var,"UPDATE ") && (strpos($var,"SET ") < strpos($var,"WHERE ")))|| (strpos($var,"INSERT INTO ") && strpos($var,"VALUES "))|| strpos($var,"SELECT * FROM"); } /** * @param mixed $var * @return */ function is_phpinject($var){ return false;//($var,"DROP");//||strpos($var,"print_r("); } /** * prevention of * .php?a[]=asd&a[]=asdasd&b[]=$a * @param mixed $var * @return */ function is_phpkeyinject($var){ return strpos($var,"["); } /** * @param mixed $var * @return */ function is_spaminject($var){ return strpos($var,"sex")||strpos($var,"SEX"); } // %&#37 (&#40 )&#41 function illegalcharconverter($str){ $chars=array("&" ,"<" , ">" ,"!" ,'"' ,"," ,"$" ,"'" ,"*" ,"+" ); $ascii=array("&#38;","&lt;", "&gt;","&#33;","&#34;","&#44;","&#36;","&#39;","&#42;","&#43;"); return str_replace($chars,$ascii , $str); } } ?> ---- Server IP: 69.147.83.199 Probable Submitter: 213.118.47.34 ---- Manual Page -- http://php.net/manual/en/security.database.sql-injection.php Edit -- https://master.php.net/note/edit/111466 Del: integrated -- https://master.php.net/note/delete/111466/integrated Del: useless -- https://master.php.net/note/delete/111466/useless Del: bad code -- https://master.php.net/note/delete/111466/bad+code Del: spam -- https://master.php.net/note/delete/111466/spam Del: non-english -- https://master.php.net/note/delete/111466/non-english Del: in docs -- https://master.php.net/note/delete/111466/in+docs Del: other reasons-- https://master.php.net/note/delete/111466 Reject -- https://master.php.net/note/reject/111466 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#193727) next »