This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Debuging { | |
private $filePath; #Ruta del archivo log | |
private $fileName; #Nombre del archivo que invoca el debug | |
/** | |
* Clase de debugeo | |
* @param string $fileName nombre del archivo que invoca la clase | |
* @param string $filePath nombre del archivo donde se almacenará la traza | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function limpiaParametros( $param ) { | |
$cross_site_scripting = array ( '@<script[^>]*?>.*?</script>@si', // Remover javascript | |
'@<[\/\!]*?[^<>]*?>@si' ); // Remover etiquetas HTML | |
$inyeccion_sql = array ( '/\bAND\b/i', '/\bOR\b/i', '/\bSELECT\b/i', | |
'/\bFROM\b/i', '/\bWHERE\b/i', '/\bUPDATE\b/i', | |
'/\bDELETE\b/i', '/\b\*\b/i', '/\bCREATE\b/i' ); | |
$retorno = preg_replace ( $inyeccion_sql, "", $param ); | |
$retorno = preg_replace ( $cross_site_scripting, "", $retorno ); | |
$retorno = htmlentities( $retorno, ENT_QUOTES ); // Acá es importante verificar la codificación (ISO o UTF-8) | |
return trim( $retorno ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Validador de RUT Chileno | |
/// Hace uso del algoritmo Modulo 11 | |
/// | |
/// Chilean ID Number validator | |
/// Use the algorithm called Module 11 | |
/// </summary> | |
class Rut { | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Creación de la tabla | |
CREATE TABLE IF NOT EXISTS `paises` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID único del país', | |
`name` varchar(30) COLLATE latin1_spanish_ci NOT NULL COMMENT 'Nombre descritivo', | |
`iso_name` varchar(30) COLLATE latin1_spanish_ci NOT NULL COMMENT 'Nombre standard ISO', | |
`alfa2` varchar(2) COLLATE latin1_spanish_ci NOT NULL COMMENT 'Código de 2 caracteres', | |
`alfa3` varchar(3) COLLATE latin1_spanish_ci NOT NULL COMMENT 'Código de 3 caracteres', | |
`numerico` int(3) NOT NULL COMMENT 'Código único por país', | |
PRIMARY KEY (`id`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TABLE IF EXISTS `comuna_cl`; | |
/*!40101 SET @saved_cs_client = @@character_set_client */; | |
/*!40101 SET character_set_client = utf8 */; | |
CREATE TABLE `comuna_cl` ( | |
`id_co` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID unico de la comuna', | |
`id_pr` int(11) NOT NULL COMMENT 'ID de la provincia asociada', | |
`str_descripcion` varchar(30) COLLATE latin1_spanish_ci DEFAULT NULL COMMENT 'Nombre descriptivo de la comuna', | |
PRIMARY KEY (`id_co`,`id_pr`) | |
) ENGINE=InnoDB AUTO_INCREMENT=347 DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci COMMENT='Lista de comunas por provincias'; | |
/*!40101 SET character_set_client = @saved_cs_client */; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BubleSort { | |
BubleSort (int ... array) { | |
long time_start, time_end; | |
time_start = System.currentTimeMillis(); | |
for(int i = 0; i < array.length; i++) { | |
for(int j = i + 1; j < array.length; j++) { | |
if(array[j] < array[i]) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.trim = function() { | |
return this.replace(/^\s+|\s+$/g,""); | |
} | |
String.prototype.ltrim = function() { | |
return this.replace(/^\s+/,""); | |
} | |
String.prototype.rtrim = function() { | |
return this.replace(/\s+$/,""); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(".solo-numero").keyup(function(){ | |
if ($(this).val() != '') | |
$(this).val($(this).attr('value').replace(/[^0-9]/g, "")); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class FN { | |
/** | |
* Valida la forma de una dirección de correo | |
* @param email cadena de texto con el email a validar | |
* @return | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Ejemplo de implementación en un campo input que sólo admite 5 dígitos | |
* <input type="text" placeholder="#####" regexp="[0-9]{0,5}" > | |
*/ | |
var UXAPP = UXAPP || {}; | |
// paquete de validaciones | |
UXAPP.validador = {}; |