<?php 
function dmy($data){
	$novadata=substr($data,8,2)."/".substr($data,5,2)."/".substr($data,0,4);
	return $novadata;
}
function ymd($data){
	$novadata=substr($data,6,4)."-".substr($data,3,2)."-".substr($data,0,2);
	return $novadata;
}

function RandomPass($numchar){  
   $letras = "a,b,c,d,e,f,g,h,i,j,k,m,n,p,q,r,s,t,u,v,w,x,y,z,1,2,3,4,5,6,7,8,9,0";  
   $array = explode(",", $letras);  
   shuffle($array);  
   $senha = implode($array, "");  
   return substr($senha, 0, $numchar);  
} 

function encripta($string){
	$criptografada = base64_encode($string);
	return $criptografada;
}

function decripta($string){
	$descriptografada=base64_decode($string);
	return $descriptografada;
}


function CompletaComZeros($tamMax, $strIn) {
	$strOut = "";
	$tamStr = strlen($strIn);
	for ($i = $tamStr ; $i < $tamMax ; $i++) $strOut .= "0";
	return $strOut . $strIn;
}

?>