<?php
//class invalid characters
class InvalidCharacters
{
private $allowed;
public function reviews_allowed($view)
{
$charactersok = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";//Please insert here the characters that you consider as valid.
for ($i=0; $i<strlen($view); $i++){
if (strpos($charactersok, substr($view,$i,1))===false){
$this->allowed=false;return $this->allowed;
}
}
$this->allowed=true;return $this->allowed;
}
public function go()
{
if ($this->allowed==true){return;}
if ($this->allowed==false){echo 'Invalid character(s)';exit();}
}
}
//example of how to apply
$info=new InvalidCharacters();
$info->reviews_allowed("lkjiñ");//Please insert here the characters to be checked.
$info->go();
echo "Ok";//The script continues here.
?>
|