You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.4 KiB
48 lines
1.4 KiB
<?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;
|
|
}
|
|
|
|
public static function verifNotNull($val) :bool{
|
|
return empty($var);
|
|
}
|
|
|
|
}
|
|
|
|
?>
|