<?php

/**
 * Subclass for performing query and update operations on the 'USUARIOS' table.
 *
 *
 *
 * @package lib.model
 */
class UsuariosPeer extends BaseUsuariosPeer
{
  public static function getNuevaContrasenia($length=6, $uc=TRUE, $n=FALSE, $sc=FALSE)
  {
    $source = 'abcdefghijklmnopqrstuvwxyz';
    if($uc == 1) $source .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    if($n  == 1) $source .= '1234567890';
    if($sc == 1) $source .= '|@#~$%()=^*+[]{}-_';
    if($length > 0){
      $rstr = "";
      $source = str_split($source,1);
      for($i=1; $i<=$length; $i++){
        mt_srand((double)microtime() * 1000000);
        $num = mt_rand(1,count($source));
        $rstr .= $source[$num-1];
      }
    }
    return $rstr;
  }

  static public function limpiarValor($valor)
  {
    return str_replace(',','',$valor);
  }
}
