parent
5192291ae5
commit
44a9cff478
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
namespace Verification;
|
||||
|
||||
class Verification
|
||||
{
|
||||
public static function verifChar(?string $text) : ?string{
|
||||
if($text==NULL){
|
||||
return NULL;
|
||||
}
|
||||
$charInterdi=['|','/','\\','%','$','=','<','>','(',')'];
|
||||
$chaineInterdi=["AND","OR","WHERE","FROM","SELECT"];
|
||||
$textVerif="";
|
||||
|
||||
foreach( str_split($text,1) as $char){
|
||||
if( !in_array($char,$charInterdi) ){
|
||||
$textVerif=$textVerif.$char;
|
||||
}
|
||||
}
|
||||
|
||||
$text=$textVerif;
|
||||
$textVerif="";
|
||||
$tabText=explode(" ",$text);
|
||||
for( $i=0 ; $i<count($tabText) ; $i++){
|
||||
if( !in_array( strtoupper($tabText[$i]) , $chaineInterdi )){
|
||||
$textVerif=$textVerif.$tabText[$i];
|
||||
|
||||
if($i != count($tabText)-1){
|
||||
$textVerif=$textVerif." ";
|
||||
}
|
||||
}
|
||||
}
|
||||
return $textVerif;
|
||||
}
|
||||
|
||||
public static function verifArrayChar(?array $tabText) : ?array{
|
||||
for( $i=0 ; $i<count($tabText) ; $i++){
|
||||
$tabText[$i]=$this->verifChar($tabText[$i]);
|
||||
}
|
||||
return $tabText;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
namespace Verification{
|
||||
|
||||
class VerificationChar
|
||||
{
|
||||
public static function verifChar(string $text) : string{
|
||||
$charInterdi=['&','|','/','\\','%','$'];
|
||||
$textVerif="";
|
||||
foreach( $text as $char){
|
||||
if( !in_array($char,$charInterdi) ){
|
||||
$textVerif=$textVerif+$char;
|
||||
}
|
||||
}
|
||||
return $textVerif;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
Loading…
Reference in new issue