Usuario: jape - Webeame Snippets


Añadir snippet

Últimos snippets de jape



Render más rápido de las tablas con CSS

La propiedad table-layout nos permite indicar si queremos que la tabla se dibuje con unos anchos fijos o dependientes del contenido:
  1. .fixed_table {
  2. table-layout: fixed;
  3. }
  4.  
  5. .auto_table {
  6. table-layout: auto;
  7. }
http://sentidoweb.com/2008/02/19/render-mas-rapido-de-las-tablas-con-css.php

En CSS tablas layout por jape hace on 19/2/08 | Comentarios



Descargar el contenido de una URL con cURL

  1. function abrir($url)
  2. {
  3. $sesion = curl_init($url);
  4.  
  5. curl_setopt($sesion, CURLOPT_RETURNTRANSFER, 1);
  6. curl_setopt($sesion, CURLOPT_FOLLOWLOCATION, 1);
  7. curl_setopt($sesion, CURLOPT_TIMEOUT, 5);
  8. curl_setopt($sesion, CURLOPT_CONNECTTIMEOUT, 5);
  9.  
  10. // Nos hacemos pasar por el Firefox
  11. curl_setopt($sesion, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7');
  12.  
  13. $resultado = curl_exec($sesion);
  14.  
  15. curl_close($sesion);
  16.  
  17. return $resultado;
  18. }

En PHP curl por jape hace on 1/2/08 | Comentarios



Función para validar IPs

  1. function validarIP($ip)
  2. {
  3. if (($longip = ip2long($ip)) !== false)
  4. {
  5. if ($ip == long2ip($longip))
  6. {
  7. return true;
  8. }
  9. else
  10. {
  11. return false;
  12. }
  13. }
  14. else
  15. {
  16. return false;
  17. }
  18. }

En PHP IP por jape hace on 1/2/08 | Comentarios