Клас за защита

dakata__92

Super Moderator
Драснах си един код за защита нааа страничките на моето фреймче и то базова защита и се чудех дали според вас добре съм се справил? Нещо така не сигурно ми се вижда много много затова да попитам. С тази забрана съм се чудил дали ще ми минават спокойно $_POST и $_GET заявките.
PHP:
class Security{
	private $options = null;
	private $URL = null;
	
	public function __construct($options){
		$this->options = $options;
		$this->permittedURLcontent($this->getPageURL());
	}
	
	public function getPageURL(){
		$this->URL = isSet($_SERVER['HTTPS']) == 'on' ? 'https://' : 'http://';
		$this->URL .= $_SERVER['SERVER_PORT'] != '80' ? $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"] : $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
		return $this->URL;
	}
	
	public function permittedURLcontent($url){
		if(!preg_match($this->options['URLcontent'],trim(urldecode($url)))){
			throw new \Exception($this->options['ErrorContent'],$this->options['StatusContent']);
		}
	}
}
Опции които постъпват:
PHP:
"URLcontent" => "/^[a-z0-9~%.:#_\-+=&?\/]+$/iu",
"ErrorContent" => "Illegal char contained in the URL.",
"StatusContent" => "500"
 

Back
Горе