<?php 
class DataForms{

	function GET($received){
			$safe = new SafeHtml();
			$parameter = $safe->safeHtml($_GET[$received]);

		return $parameter;
	}
	
	function POST($received){
			$safe = new SafeHtml();
			$parameter = $safe->safeHtml($_POST[$received]);
		
		return $parameter;
	}		
	
	public function DataFormValidate($data,$type){
	
			 switch (strtolower($type)){
				 case "alphanum" : 	
						$pattern = '/^[a-zA-Z0-9 αινσϊAΙΝΣΪΡρ\.,;:-|)(Ί_@><#&?Ώ‘!]$/i'; 
						break;
				 case "email" : 	
						$pattern = '/^[A-Za-z\.][A-Za-z0-9_\.]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/i'; 
						break;
				 case "username" : 	
						$pattern = '/^[A-Za-z][A-Za-z0-9_\.-]{5,27}$/i'; 
						break;
				 case "password" : 	
						$pattern = '/^[A-Za-z0-9]{5,28}$/i'; 
						break;
			 }
		 
	  return preg_match($pattern, $data);
	}

	function DateFormmat($Date,$direc=true){
			$in  = $direc ? "/" :"-";
			$out = $direc ? "-" :"/";
			
			$arrayDate = explode($in,$Date);
			$arrayDate = array_reverse($arrayDate);	
			$formattedDate = implode($arrayDate,$out);
			
		return($formattedDate);
	}
	
}
?>