Skip to content

Instantly share code, notes, and snippets.

View xombra's full-sized avatar

Hector A. Mantellini xombra

View GitHub Profile
@xombra
xombra / nube_tag
Created April 26, 2014 01:30
Crear Nube de TAG
global $palabras;
$GLOBALS['palabras'] = array(
' a ',' ah ', ' al ', ' alla ',' alo ',' ano ',' ante ',' anti ',' am ',' aquel ', ' aquellos ',' aquellas ',' ay ',
' asi ',
' bajo ', ' bien ',' bueno ',
' casi ',' con ', ' contra ', ' coma ', ' comer ',' como ', ' cómo ', ' cambiar ',
' da ',' dando ',' de ' , ' del ', ' dejar ',' desde ',' di ', ' dia ', 'dice',' donde ',' dijo ',' don ',
' e ', ' el ', ' ella ', ' ellas ', ' ellos ',' en ' ,' entonces ', ' entre ', ' era ',' es ', ' esa ',' ese ',
' esas ',' eso ',' esos ',' esta ', ' estan ',' estas ',' esto ',' estos ',
' fue ',' fueron ',' fuese ',' fuesen ',' fui ',' fuimos ', ' full ',
@xombra
xombra / dtermina_movil
Created April 27, 2014 02:12
Determinar si se accede desde un Móvil
function MOVIL($lista_user_agents, $user_agents_capturado){
$List_User_Agent = array(
'android' => 'android', 'AvantGo' => 'AvantGo', 'PLAYSTATION' => 'PLAYSTATION','Mobile','Mobile',
'BlackBerry' => 'BlackBerry', 'blazer' => 'blazer', 'hiptop' => 'hiptop', 'GoBrowser' => 'GoBrowser',
'Cellphone' => 'Cellphone', 'EudoraWeb' => 'EudoraWeb', 'fennec' => 'fennec', 'IEMobile' => 'IEMobile',
'iPhone' => 'iPhone', 'iPod' => 'iPod', 'Googlebot-Mobile' => 'Googlebot-Mobile', 'Iris' => 'Iris',
'iphone' => 'iphone', 'GoogleMobilizer' => 'Google Wireless Transcoder', 'KYOCERA' => 'KYOCERA',
'LGE' => 'LGE', 'midp' => 'midp', 'Minimo' => 'Minimo', 'NetFront' => 'NetFront', 'Dorothy' => 'Dorothy',
'Nintendo' => 'Nintendo', 'Nitro' => 'Nitro', 'Nokia' => 'Nokia', 'Motorola' => 'mot-', 'TeaShark' => 'TeaShark',
'OperaMini' => 'Opera Mini', 'Palm' => 'Palm', 'PDA' => 'PDA', 'Blazer' => 'Blazer', 'iPad' => 'iPad',
@xombra
xombra / timezone
Created April 27, 2014 02:17
Formato Fecha y Localizacion
function TIMEZONE($time, $zone) {
setlocale(LC_ALL, 'es_VE');
$output = date("D, j-M-Y", ($time + (3600 * $zone)));
return $output;
}
function TIMEZONE_SHORT($time, $zone) {
setlocale(LC_ALL, 'es_VE');
$output = date("d/m/Y", ($time + (3600 * $zone)));
return $output;
@xombra
xombra / pub_google
Created April 27, 2014 02:15
Para mostrar publicidad de Google
function PUB_GOOGLE($google_ad_client,$google_ad_slot,$google_ad_width,$google_ad_height)
{
?>
<script async type="text/javascript">
google_ad_client = "<?php echo $google_ad_client; ?>";
google_ad_slot = "<?php echo $google_ad_slot; ?>";
google_ad_width = <?php echo $google_ad_width; ?>;
google_ad_height = <?php echo $google_ad_height; ?>;
</script>
<script async type="text/javascript"
@xombra
xombra / verifica_puertos
Created April 27, 2014 02:07
Verifica Puertos Abiertos
// Verificación de puertos
$ip = gethostbyaddr($_SERVER['REMOTE_ADDR']); // direccion IP
$timeout = 1; // 1 segundo de espera Máximo recomendado 10
$puertos_TCP = array(21, // puertos usados
22,
23,
25,
79,
80,
110,
@xombra
xombra / compress
Created April 27, 2014 02:03
Comprimir Texto o sitio web
function compress($buffer)
{ $search = array('/\>[^\S ]+/s','/[^\S ]+\</s','/(\s)+/s',"/\s+/");
$replace = array('>','<','\\1',' ');
$buffer = trim(preg_replace($search, $replace, $buffer));
$buffer = str_replace(' }','}', $buffer);
$buffer = str_replace('{ ','{', $buffer);
return $buffer;
}
@xombra
xombra / exif
Created April 27, 2014 02:00
exif de una imagen
$exif = exif_read_data('aqui_la_imagen.jpg', 0, true);
header("Content-type: image/jpeg");
$imagen = exif_thumbnail("IMG-20140326-WA0010.jpg");
imagejpeg($imagen,NULL,100);
foreach ($exif as $clave => $seccion) {
foreach ($seccion as $nombre => $valor) {
if ( "$clave.$nombre" == 'FILE.FileDateTime'){ $valor = date("d-m-Y",$valor); }
echo "$clave.$nombre : $valor<br />\n";
}
}
@xombra
xombra / User_Agent
Created May 6, 2014 15:24
User_Agent para moviles (redireccionamiento)
$List_User_Agent = array(
'android' => 'android', 'AvantGo' => 'AvantGo', 'PLAYSTATION' => 'PLAYSTATION','Mobile','Mobile',
'BlackBerry' => 'BlackBerry', 'blazer' => 'blazer', 'hiptop' => 'hiptop', 'GoBrowser' => 'GoBrowser',
'Cellphone' => 'Cellphone', 'EudoraWeb' => 'EudoraWeb', 'fennec' => 'fennec', 'IEMobile' => 'IEMobile',
'iPhone' => 'iPhone', 'iPod' => 'iPod', 'Googlebot-Mobile' => 'Googlebot-Mobile', 'Iris' => 'Iris',
'iphone' => 'iphone', 'GoogleMobilizer' => 'Google Wireless Transcoder', 'KYOCERA' => 'KYOCERA',
'LGE' => 'LGE', 'midp' => 'midp', 'Minimo' => 'Minimo', 'NetFront' => 'NetFront', 'Dorothy' => 'Dorothy',
'Nintendo' => 'Nintendo', 'Nitro' => 'Nitro', 'Nokia' => 'Nokia', 'Motorola' => 'mot-', 'TeaShark' => 'TeaShark',
'OperaMini' => 'Opera Mini', 'Palm' => 'Palm', 'PDA' => 'PDA', 'Blazer' => 'Blazer', 'iPad' => 'iPad',
'BOLT' => 'BOLT', 'Fennec' => 'Fennec', 'Opera Mobi' => 'Opera Mobi', 'Series60' => 'Se
@xombra
xombra / redimensiona
Last active August 5, 2017 13:29
Redimensionar imagen en caliente
function REDIMENSIONAR($anchura,$maxima_y,$nombre)
{ $img_nueva = $nombre;
$datos = getimagesize($nombre);
$maxima_y = $datos[1];
switch ($datos[2]) {
case 2:
$img = imagecreatefromjpeg($nombre);
break;
case 3:
$img = imagecreatefrompng($nombre);
@xombra
xombra / .htaccess
Last active August 5, 2017 20:30
Aumentando seguridad .htaccess
Options +FollowSymlinks
FileETag None
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} libwww [NC,OR]
RewriteCond %{QUERY_STRING} ^(.*)=http [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]