Ver Mensaje Individual
  #10 (permalink)  
Antiguo 14/03/2012, 10:28
mateo_disseny
 
Fecha de Ingreso: marzo-2012
Mensajes: 8
Antigüedad: 12 años, 1 mes
Puntos: 0
Respuesta: addslashes, mysql_real_escape_string o similare

Tienes razón Bray, fallo mio...el código no da error, pero sigue sin funcionarme...

Te pongo todo eñ código que hay en la página en dos mensajes, a ver si veis que hago mal, porqué a mi se me escapa! El código nuevo está prácticamente al final!

Muchas gracias

Código PHP:
Ver original
  1. <?php
  2. ini_set('display_errors', 1);
  3. //set_time_limit(120);
  4. ini_set('memory_limit','512M');
  5.  
  6. //*********Incluir esta linea en todos los scripts**************
  7. include($_SERVER['DOCUMENT_ROOT'].'/inicio/inicio.php');
  8. //**************************************************************
  9. /**
  10.  * +-----------------------------------------------------------------------+
  11.  * | Control de acceso a la pagina                                         |
  12.  * +-----------------------------------------------------------------------+
  13.  */
  14. define ('ACCESO',PRIVADO);
  15. include($_SERVER['DOCUMENT_ROOT'].'/inicio/islogin.php');
  16. /**
  17.  * +-----------------------------------------------------------------------+
  18.  * | Include de clase y funciones                                          |
  19.  * +-----------------------------------------------------------------------+
  20.  */
  21. include($_SERVER['DOCUMENT_ROOT'].'/clases/c_ofertas.php');
  22. include($_SERVER['DOCUMENT_ROOT'].'/clases/validation_class.php');
  23. include($_SERVER['DOCUMENT_ROOT'].'/clases/class.upload.php');
  24. include($_SERVER['DOCUMENT_ROOT'].'/clases/c_paginacion.php');
  25. /**
  26.  * +-----------------------------------------------------------------------+
  27.  * | Incialización de variables y constantes                               |
  28.  * +-----------------------------------------------------------------------+
  29.  */
  30. define('BODY',TEMPLATES_ADMIN.'t_contenedor.php');
  31. define('T_BODY',TEMPLATES_ADMIN.'t_ofertas.php');
  32. define('T_LISTADO',TEMPLATES_ADMIN.'t_ofertas_list.php');
  33. define('T_EDIT',TEMPLATES_ADMIN.'t_ofertas_edit.php');
  34. define('T_ADD',TEMPLATES_ADMIN.'t_ofertas_add.php');
  35. /**
  36.  * +-----------------------------------------------------------------------+
  37.  * | Declaración de funciones                                              |
  38.  * +-----------------------------------------------------------------------+
  39.  */
  40.  
  41. /**
  42.  * +-----------------------------------------------------------------------+
  43.  * | Inicio del programa                                                   |
  44.  * +-----------------------------------------------------------------------+
  45.  */
  46. $tabla = 'ofertas';
  47. $bAdd = false;
  48. $aOpciones = array(
  49.     'add' => '',
  50.     'delete' => '',
  51.     'edit' => '',
  52.     'add_home' => '',
  53.     'del_home' => '',
  54.     );
  55. /**
  56.  * +-----------------------------------------------------------------------+
  57.  * | Salida por pantalla                                                   |
  58.  * +-----------------------------------------------------------------------+
  59.  */
  60.  
  61. $opcion_menu = 'ofertas';
  62. $body = T_BODY;
  63.  
  64. if(ID_USUARI!='1')
  65. {
  66.  
  67.         if (isset($_GET['option']))
  68.             $option = getValue($_GET['option']);
  69.         if (isset($_POST['option']))
  70.             $option = getValue($_POST['option']);
  71.         if (!isset($option))
  72.             $option = 'list';
  73.  
  74.     $ofertas = new ofertas($tabla);
  75.  
  76.     switch ($option)
  77.     {
  78.         case 'delete':
  79.  
  80.                         $aOpciones['delete'] = ' class="selected"';
  81.                         $ofertas -> del(getValue($_GET['o']));
  82.  
  83.                         mysql_close($dao -> Link_ID);
  84.                         header('location: ofertas.php?option=list?add_oferta=true');
  85.                         die;
  86.                         break;
  87.  
  88.         case 'edit':
  89.  
  90.                         $aOpciones['edit'] = ' class="selected"';
  91.                    
  92.             $subBody = T_EDIT;
  93.  
  94.             if(!empty($_POST))
  95.             {
  96.                                 $id = getValue($_POST['id']);
  97.  
  98.                 $old = $ofertas->get($id);
  99.  
  100.                 $oValidador = new Validate_fields();
  101.                 $oValidador -> language = 1;//CASTELLANO
  102.                 $oValidador -> check_4html = true;
  103.  
  104.  
  105.                 foreach ($aIdiomas as $idioma)
  106.                 {
  107.                                         $titulos[$idioma['sub']] = trim(getValue($_POST['titulo_'.$idioma['sub']]));
  108.                     $oValidador -> add_text_field('Título en '.$idioma['nombre'], $titulos[$idioma['sub']], 'text', $idioma['obligatorio']);
  109.                                         $descripciones1[$idioma['sub']] = trim(getValue($_POST['descripcion1_'.$idioma['sub']]));
  110.                     $oValidador -> add_text_field('Descripción (Línea 1) en '.$idioma['nombre'], $descripciones1[$idioma['sub']], 'text', $idioma['obligatorio']);
  111.                                         $descripciones2[$idioma['sub']] = trim(getValue($_POST['descripcion2_'.$idioma['sub']]));
  112.                     $oValidador -> add_text_field('Descripción (Línea 2) en '.$idioma['nombre'], $descripciones2[$idioma['sub']], 'text', $idioma['obligatorio']);
  113.                 };
  114.  
  115.                                 $precio = getValue($_POST['precio']);
  116.                                 $oValidador ->add_num_field("Precio ", $precio,'y');
  117.                                 $link = getValue($_POST['link_oferta']);
  118.                                 $oValidador ->add_text_field("Link ", $link,'y');
  119.  
  120.  
  121.                 $handle = new Upload($_FILES['imagen']);
  122.  
  123.                 if($handle->uploaded)
  124.                 {
  125.                                     $handle -> image_ratio_fill = true;
  126.                                     $handle -> image_background_color = '#cccccc';
  127.                                     $handle -> image_resize     = true;
  128.                     $handle -> image_x          = 84;
  129.                     $handle -> image_y          = 79;
  130.  
  131.                     $handle -> image_convert    = 'jpg';
  132.                                     $handle -> jpeg_quality     = 85;
  133.  
  134.                                     $handle -> Process(IMAGENES);
  135.                                     $new_name = $handle->file_src_name_body;
  136.  
  137.  
  138.                                     if($handle->processed)
  139.                                     {
  140.                                             $imagen = $handle ->file_dst_name;
  141.                                             $handle -> clean();
  142.                                             $bProcesada = true;
  143.                                     }
  144.                                     else
  145.                                     {
  146.                                             $oValidador -> setError('Imatge',2,$handle->error);
  147.                                     }
  148.  
  149.                 }
  150.                 else