[#] hm X_Shell Backd00r [#]

Current Path : /var/www/clients/client35/web46/web/modelo/
Upload File :
Current File : /var/www/clients/client35/web46/web/modelo/validate.class.php

<?php
class Validate{
	
	private $datos;
	private $error;


	public function sanearString($value){
		$value = trim($value);
		$value = strip_tags($value);
    	$value = preg_replace('([^A-Za-z0-9_-ñÑ_ ])', '', $value);		
		return $value;
	}
	
	public function setUsuario($valor,$name){
		$this->datos = array("valor"=>trim($valor),"Name"=>$name);
		return $this;
	}
	
	public function nombre(){
		$valor = $this->sanearString($this->datos['valor']);
		if(empty($valor) || strlen($valor) == 0){
			$this->error[] = $this->datos['Name'];
		}
		return $this;		
	}
	public function email(){
		if(!filter_var($this->datos['valor'], FILTER_VALIDATE_EMAIL)){
			$this->error[] = $this->datos['Name'];
		}
		return $this;
	}
	public function claveElect(){
		$valor = $this->sanearString($this->datos['valor']);
		if( !preg_match("|^[A-Z0-9]+$|",$valor) || empty($valor) || strlen($valor) < 18 || strlen($valor) > 18){
			$this->error[] = $this->datos['Name'];
		}
		return $this;
	}
	
	/*********************************************************/
	public function getSuccess(){
		if(count($this->error) > 0){
			return false;
		}else{
			return true;
		}
	}
	
	public function getErrors(){
		return $this->error;
	}
	
}

?>

Mr.hm X_Shell Backd00r 1.0, Coded By Mr.hm X_Shell Backd00r