MANUAL DE PHP

(y algo mas)windsurf pozo izquierdo
Google
search for in the  
ELMARRAJO.COM mysql bulma desarrollo web linux fedora html ayuda

windsurf mercedes camper

Capítulo 31. Comillas Mágicas

Las comillas mágicas (o "Magic Quotes") se refieren a un proceso que automáticamente escapa datos de entrada en los scripts de PHP. Es recomendable escribir código con las comillas mágicas deshabilitadas, y en su lugar escapar los datos en tiempo de ejecución, a medida que se necesite.

Qué Son Las Comillas Mágicas

Cuando se habilitan, todos los caracteres ' (comilla sencilla), " (comilla doble), \ (barra invertida) y NULL se escapan con una barra invertida de forma automática. Esto es idéntico a lo que hace addslashes().

Existen tres directivas de comillas mágicas:

  • magic_quotes_gpc

    Afecta los datos de peticiones HTTP (GET, POST y COOKIE). No puede definirse en tiempo de ejecución, y su valor predeterminado es on en PHP.

    Vea también get_magic_quotes_gpc().

  • magic_quotes_runtime

    Si se habilita, la mayoría de funciones que devuelven datos de una fuente externa, incluyendo bases de datos y archivos de texto, escaparán las comillas con una barra invertida. Puede definirse en tiempo de ejecución, y su valor predeterminado en PHP es off.

    Vea también set_magic_quotes_runtime() y get_magic_quotes_runtime().

  • magic_quotes_sybase

    Si se habilita, una comilla sencilla se escapa con una comilla sencilla en lugar de una barra invertida. Asimismo, sobreescribe completamente magic_quotes_gpc. Habilitar ambas directivas quiere decir que sólo las comillas sencillas se escapan como ''. Las comillas dobles, las barras invertidas y los NULL permanecerán intactos y sin escapar.

    Vea también ini_get() para conocer su valor.



add a note add a note User Contributed Notes
Comillas Mágicas
judas dot iscariote at gmail dot com
07-Mar-2006 11:33
Just for the record. this feature has been removed as of PHP6.
now PHP works always like if magic_quotes_gpc Off.

get_magic_quotes_gpc, get_magic_quotes_runtime are kept but always return false, set_magic_quotes_runtime raises an E_CORE_ERROR.

this is great news, magic_quotes were a big annoyance.
27-Feb-2006 03:11
Using the .htaccess file may not always be possible for instance if you are running php on a windows IIS server.

Also the code by jfrim at idirect dot com doesn't actually fix the problem as it is stripping slashes, what you need to do is addslashes to things coming in.

the code by jfrim at idirect dot com is the right idea though although rather than saying stripslashes, you simply need to say addslashes and it should work.
edward at example dot com
07-Feb-2006 04:55
All the code listed on this page is not necessary if you use the php_flag directive in a .htaccess file. This allows you to disable magic quotes completely, without the need to adjust your php.ini file or (re)process the user's input.

Just take a look at http://www.php.net/manual/en/http://indices.com.es/security.magicquotes.html#55935

Gist of his note: in the .htaccess file, add a line

php_flag magic_quotes_gpc off

That's it. Thank you very much, richard dot spindler :) !
jfrim at idirect dot com
27-Jan-2006 10:31
Unfortunately magic_quotes_gpc can not be changed at run-time, but here's a code block which will effectively get rid of it when executed.  Use this for PHP scripts which must be portable or run on servers where magic_quotes_gpc could be configured either way.

Note that the PHP help is a little misleading...  Magic_quotes_gpc affects more than just the Get, Post, and Cookie data!

<?php
//Prevent Magic Quotes from affecting scripts, regardless of server settings

//Make sure when reading file data,
//PHP doesn't "magically" mangle backslashes!
set_magic_quotes_runtime(FALSE);

if (
get_magic_quotes_gpc()) {
  
/*
   All these global variables are slash-encoded by default,
   because    magic_quotes_gpc is set by default!
   (And magic_quotes_gpc affects more than just $_GET, $_POST, and $_COOKIE)
   */
  
$_SERVER = stripslashes_array($_SERVER);
  
$_GET = stripslashes_array($_GET);
  
$_POST = stripslashes_array($_POST);
  
$_COOKIE = stripslashes_array($_COOKIE);
  
$_FILES = stripslashes_array($_FILES);
  
$_ENV = stripslashes_array($_ENV);
  
$_REQUEST = stripslashes_array($_REQUEST);
  
$HTTP_SERVER_VARS = stripslashes_array($HTTP_SERVER_VARS);
  
$HTTP_GET_VARS = stripslashes_array($HTTP_GET_VARS);
  
$HTTP_POST_VARS = stripslashes_array($HTTP_POST_VARS);
  
$HTTP_COOKIE_VARS = stripslashes_array($HTTP_COOKIE_VARS);
  
$HTTP_POST_FILES = stripslashes_array($HTTP_POST_FILES);
  
$HTTP_ENV_VARS = stripslashes_array($HTTP_ENV_VARS);
   if (isset(
$_SESSION)) {    #These are unconfirmed (?)
      
$_SESSION = stripslashes_array($_SESSION, '');
      
$HTTP_SESSION_VARS = stripslashes_array($HTTP_SESSION_VARS, '');
   }
  
/*
   The $GLOBALS array is also slash-encoded, but when all the above are
   changed, $GLOBALS is updated to reflect those changes.  (Therefore
   $GLOBALS should never be modified directly).  $GLOBALS also contains
   infinite recursion, so it's dangerous...
   */
}

function
stripslashes_array($data) {
   if (
is_array($data)){
       foreach (
$data as $key => $value){
          
$data[$key] = stripslashes_array($value);
       }
       return
$data;
   }else{
       return
stripslashes($data);
   }
}
?>
06-Dec-2005 06:09
You should try to avoid magic_quotes in all its flavors, use add_slashes() and strip_slashes() instead with user input and you will save time and avoid common problems that come along.

You should know also that if your server has php suexec enabled you won't be able use php_flag in .htaccess file to change php values like magic_quotes or register_globals. In this case you might wanna try creating a php.ini file on the same directory as your script and add something like this:

magic_quotes_runtime=off
magic_quotes_gpc=off
magic_quotes_sybase=off
register_globals=on ; only as an example

----
Mel
http://www.webhostingjournal.net/
richard dot spindler at gmail dot com
18-Aug-2005 01:59
to turn of magic quotes put the following line into the .htaccess file:

php_flag magic_quotes_gpc off
16-Jul-2005 07:44
Bright minds will have noticed, that one uses stripslashes() once on the input and saves that content for further processing. Then use addslashes() once before sending the content to the database or flat file.

Hint: if the application is using a MySql database, don't use addslashes() but mysql_real_escape_string().
nitrous at fuckoff dot com
26-Jan-2005 11:01
This "feature" is the cause of so many escaping problems.  It's very important to understand the implications of what magic quotes really do.

Nearly every call, except those being written directly to the database, using user submitted data will require a call to strip_slashes.  It gets very ugly very fast.

What should be done is proper escaping of shell parameters and database parameters. PHP provides several escaping functions intended for this purpose. Slashes alone don't cut it anyway.

Citas célebres

La belleza es una promesa de bondad.

Stendhal
Citas en tu mail
©Contenidos Gratis

Ilusiones Opticas
ilusion_optica_042.jpg
Contenidos Web

Chiste de... Varios
El ángel de los deseos

En cierta universidad se hallaban el rector y la mayor parte del profesorado discutiendo temas variados durante una reunión, cuando de repente se les apareció un ángel. Se hizo un gran silencio, y el ángel dijo:

- Rector. En recompensa a todos los servicios que has prestado a tus conciudadanos, a la humanidad, y por tu gran corazón... He sido enviado para concederte un premio. Puedes elegir entre:

1) la sabiduria absoluta,
2) riquezas sin fin
3) una belleza perfecta que te hara irresistible a todas las mujeres.

Sin pensarlo mucho, el rector respondió:

- Escojo la sabiduría.

Y al tiempo que desaparecía entre una nube de humo, dijo el ángel:

- Tu deseo ha sido concedido.

Pasaron varios minutos en total silencio. Mudos por la sorpresa, los asistentes no reaccionaban.

Hasta que por fin se situaron, y maravillados dijeron:

- Por favor, rector, ahora que posee usted la sabiduría perfecta, digamos algo.

- ...debí haber elegido el dinero
Chistes en tu mail
©ContenidosGratis

Humor Gráfico
humor_grafico_039.jpg
Contenidos Web

Inicio | Acción | Estrategia | Palabras | Puzzles | Solitarios | Foro Trucos
Cake ManiaCake Mania
Jugadores: 6835
Categoría del juego: Acción
Objetivo del juego: Ayuda a Jill a recuperar la pastelería de su abuela llevando su propia pastelería; consigue clientes y gana dinero.
Rainbow WebRainbow Web
Jugadores: 2199
Categoría del juego: Puzzles
Objetivo del juego: Rompe un pegajoso hechizo y salva un reino de fantasía en Rainbow Web. Tendrás toneladas de diversión mientras juegas a este mágico desafío para la mente.
Mahjongg FortunaMahjongg Fortuna
Jugadores: 12462
Categoría del juego: Solitarios
Objetivo del juego: Velocidad y habilidad mental son las armas más importantes en esta versión de un antiguo juego asiático. Despeja el tablero lo antes posible haciendo clic en las fichas iguales y gánate la fama eterna de la puntuación más alta.
Chainz 2Chainz 2
Jugadores: 6955
Categoría del juego: Puzzles
Objetivo del juego: Entra en el mundo de las combinaciones con Chainz 2: Relinked, emocionante secuela del exitazo del año pasado, Chainz. Gira eslabones y crea combinaciones de 3 ó más.
DeliciousDelicious
Jugadores: 4405
Categoría del juego: Acción
Objetivo del juego: ¿Eres un as de la multitarea? ¿Quieres que tus clientes estén contentos? ¡Pues Delicious es tu juego! Sacia el apetito de los clientes y tenlos contentos; ¡no te arriesgues!
BookwormBookworm
Jugadores: 4568
Categoría del juego: Palabras
Objetivo del juego: Junta las letras para formar palabras. ¡Las palabras más largas valen más puntos!
ZumaZuma
Jugadores: 4976
Categoría del juego: Acción
Objetivo del juego: Controla el ídolo de la rana de piedra de los antiguos Zuma en este intrigante enigma de acción. ¡Dispara bolas para formar conjuntos de tres, pero si dejas que lleguen a la calavera dorada morirás!
Jewel of AtlantisJewel of Atlantis
Jugadores: 3798
Categoría del juego: Puzzles
Objetivo del juego: Descubre la ciudad hundida de la Atlántida y busca valiosos tesoros. Viaja más allá de las profundidades del mar y vive trepidantes aventuras en Jewel of Atlantis.
Jewel QuestJewel Quest
Jugadores: 3727
Categoría del juego: Puzzles
Objetivo del juego: Convierte la arena de la antigua selva en oro tan rápido como puedas juntando grupos de 3 elementos. ¡Los grupos más grandes valen más puntos!
Bejeweled 2Bejeweled 2
Jugadores: 3659
Categoría del juego: Puzzles
Objetivo del juego: Con cuatro modos de juego únicos y fascinantes, nuevas piezas de juego explosivas e imponentes fondos planetarios, Bejeweled 2 es mucho más adictivo que nunca.
Contenidos gratis en tu webSiguiente >>

Fotos divertidas
fotos_increibles_0023.jpg
Contenidos Web
microrobots avion deportes riesgo recetas cocina canaria juegos online gratis moto motociclismo horoscopos naranjas valencianas surf canarias montañismo ciudades turismo postales gratis library Horoscopos Diarios Windsurf Canarias
fregadero microondas placa electrica bañopreparar camper pantalla plananevera compresor electricacamper fiat ducato camper baño quimicomampara enrollable bañocamper aire climatizadofurgoneta surf windsurffurgoneta surf windsurftelevisor furgonetas camperfurgonetas camper cama

Sudoku del día
Nivel de dificultad: Fácil



Cómo jugar:
El juego consiste en colocar los números del 1 al nueve de tal forma que no se repita el mismo número en la columna, fila y caja (bloques 3x3 enmarcados).

©Contenidos Gratis | Sudoku en tu mail

Warning: array_rand(): First argument has to be an array in /var/www/html/contenidos/efemerides.php on line 14
Sucedió el...

31 de agosto de

Efemérides en tu mail
©Contenidos Gratis
windsurf canarias youtube porno canarias baleares valencia madrid