Exemplo n.º 1
0
 protected function administrar_tags()
 {
     $this->sql_con = new mysqli($this->link['host'], $this->link['user'], $this->link['pass'], $this->link['bd']);
     $this->datos['id'] = mysqli_real_escape_string($this->sql_con, $_POST['tId']);
     $this->datos['nombre'] = mysqli_real_escape_string($this->sql_con, $_POST['nombre']);
     $this->datos['codigo'] = mysqli_real_escape_string($this->sql_con, $_POST['codigo']);
     include_once 'sanear_string.php';
     $this->datos['codigo'] = sanear_string($this->datos['codigo']);
     if ($this->datos['id'] == '0') {
         $consulta_tag = $this->sql_con->prepare("INSERT INTO tag VALUES (null, ?, ?);");
         $consulta_tag->bind_param('ss', $this->datos['nombre'], $this->datos['codigo']);
         $consulta_tag->execute();
         if ($this->sql_con->affected_rows > 0) {
             $this->resultado = 1;
         }
         $consulta_tag->close();
     } else {
         $id = $this->datos['id'];
         $nombre = $this->datos['nombre'];
         $codigo = $this->datos['codigo'];
         $consulta_tag = "UPDATE tag SET tag_nombre = '{$nombre}', tag_codigo = '{$codigo}' WHERE tag_id = '{$id}';";
         if ($this->sql_con->query($consulta_tag) === false) {
             trigger_error('Wrong SQL: ' . $consulta_tag . ' Error: ' . $this->sql_con->error, E_USER_ERROR);
         } else {
             if ($this->sql_con->affected_rows > 0) {
                 $this->resultado = 1;
             } else {
                 $this->resultado = 2;
             }
         }
     }
 }
 function insertarExcel($array)
 {
     $uploadOk = 1;
     $time = time();
     $fecha = date("Y-m-d", $time);
     $target_dir = "../documents/";
     $target_file = $target_dir . basename($_FILES["archivoExcel"]["name"]);
     move_uploaded_file($array["archivoExcel"]["tmp_name"], $target_file);
     set_include_path(get_include_path() . PATH_SEPARATOR . '../complements/PHPExcel-1.8/Classes/');
     $inputFileType = 'Excel2007';
     include 'PHPExcel/IOFactory.php';
     $inputFileName = $target_file;
     $objReader = PHPExcel_IOFactory::createReader($inputFileType);
     $objReader->setReadDataOnly(true);
     $objPHPExcel = $objReader->load($inputFileName);
     $sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
     require_once "../db/conexiones.php";
     $consulta = new Conexion();
     foreach ($sheetData as $datos) {
         $nombreSinAcentos = sanear_string($datos['B']);
         $nombre = strtoupper(trim($nombreSinAcentos));
         $datosEmpleado = $consulta->Conectar("postgres", "SELECT * FROM userinfo WHERE UPPER(name)='" . $nombre . "'");
         if ($datosEmpleado) {
             $sqlInsert = $this->invoco->Conectar("postgres", "INSERT INTO horario_personal (user_id, banda_id, fecha) VALUES (" . $datosEmpleado[0]['userid'] . "," . $datos['C'] . ", '" . $fecha . "')");
         }
     }
     return "Se insertaron los datos Exitosamente!";
 }
Exemplo n.º 3
0
 protected function procesar()
 {
     $this->tipo_cuenta = $_SESSION['tipo_cuenta'];
     if ($this->tipo_cuenta == 1) {
         $this->accion = $_POST['accion'];
         switch ($this->accion) {
             case 1:
                 $this->obtener_parametros();
                 $codigo = mysqli_real_escape_string($this->sql_con, $this->datos['codigo']);
                 include 'sanear_string.php';
                 $codigo = sanear_string($codigo);
                 $nombre = mysqli_real_escape_string($this->sql_con, $this->datos['nombre']);
                 $descripcion = mysqli_real_escape_string($this->sql_con, $this->datos['descripcion']);
                 $unidad = mysqli_real_escape_string($this->sql_con, $this->datos['select_unidades']);
                 if ($unidad == 'otro') {
                     $unidad = mysqli_real_escape_string($this->sql_con, $this->datos['unidad']);
                 }
                 $u_medida = mysqli_real_escape_string($this->sql_con, $this->datos['u_medida']);
                 $this->insertar_materia($codigo, $nombre, $descripcion, $unidad, $u_medida);
                 break;
             case 2:
                 $this->obtener_parametros();
                 $codigo = mysqli_real_escape_string($this->sql_con, $this->datos['codigo']);
                 $nombre = mysqli_real_escape_string($this->sql_con, $this->datos['nombre']);
                 $descripcion = mysqli_real_escape_string($this->sql_con, $this->datos['descripcion']);
                 $unidad = mysqli_real_escape_string($this->sql_con, $this->datos['select_unidades']);
                 if ($unidad == 'otro') {
                     $unidad = mysqli_real_escape_string($this->sql_con, $this->datos['unidad']);
                 }
                 $u_medida = mysqli_real_escape_string($this->sql_con, $this->datos['u_medida']);
                 $this->actualizar_materia($codigo, $nombre, $descripcion, $unidad, $u_medida);
                 break;
             case 3:
                 $this->obtener_parametros();
                 $codigo = mysqli_real_escape_string($this->sql_con, $this->datos['codigo']);
                 $stock_r = mysqli_real_escape_string($this->sql_con, $this->datos['stock_r']);
                 $this->agregar_stock($codigo, $stock_r);
                 break;
             case 4:
                 $this->obtener_parametros();
                 $codigo = mysqli_real_escape_string($this->sql_con, $this->datos['codigo']);
                 $stock_m = mysqli_real_escape_string($this->sql_con, $this->datos['stock_m']);
                 $this->editar_stock_minimo($codigo, $stock_m);
                 break;
             case 5:
                 $productos = $_POST['productos'];
                 $materias = $_POST['materias'];
                 $unidades = $_POST['unidades'];
                 $this->asignar_productos($productos, $materias, $unidades);
                 break;
         }
     } else {
         $this->resultado = 6;
         //Sin permisos suficientes
     }
 }
Exemplo n.º 4
0
 protected function preparar()
 {
     $this->sql_con = new mysqli($this->link['host'], $this->link['user'], $this->link['pass'], $this->link['bd']);
     $this->productos_array = $_POST['productos'];
     $this->tags_array = $_POST['tags'];
     //Limpieza de valores de entrada
     /*for($i = 0; $i < count($this->productos_array); $i++){
           $this->productos_array = mysqli_real_escape_string($this->sql_con, $this->productos_array[$i]);
           echo $i;    
       }*/
     for ($i = 0; $i < count($this->tags_array); $i++) {
         $this->tags_array[$i] = mysqli_real_escape_string($this->sql_con, $this->tags_array[$i]);
         if ($this->tags_array == '') {
             array_splice($this->tags_array, $i, 1);
         }
     }
     //Verificar si tags existen
     for ($i = 0; $i < count($this->tags_array); $i++) {
         include_once 'sanear_string.php';
         $tag_codigo = sanear_string($this->tags_array[$i]);
         $consulta_tag_codigo = "SELECT tag_id as id FROM tag WHERE tag_codigo='{$tag_codigo}'";
         $result_tag_codigo = $this->sql_con->query($consulta_tag_codigo);
         if ($result_tag_codigo === false) {
             trigger_error('Ha ocurrido un error');
         } else {
             $id_tag = 0;
             while ($row_tag_codigo = $result_tag_codigo->fetch_assoc()) {
                 $id_tag = $row_tag_codigo['id'];
             }
             if ($id_tag > 0) {
                 $this->asignar_productos($id_tag);
             } else {
                 $insercion_tag = $this->sql_con->prepare("INSERT INTO tag VALUES (null, ?, ?)");
                 $insercion_tag->bind_param('ss', $tag_codigo, $tag_codigo);
                 $insercion_tag->execute();
                 $id_tag = $this->sql_con->insert_id;
                 $insercion_tag->close();
                 $this->asignar_productos($id_tag);
             }
         }
     }
 }
 protected function agregar_categoria()
 {
     $dato = array();
     $dato = $this->obtener_categoria();
     include 'sanear_string.php';
     $codigo = sanear_string($dato['nombre']);
     if ($this->verificar_categoria($codigo) > 0) {
         $fecha = date('Y-m-d H:i:s');
         $codigo = md5($fecha . $codigo);
     }
     $insercion = $this->sql_con->prepare("INSERT INTO categoria VALUES(null, ?, ?, ?)");
     $insercion->bind_param('ssi', $dato['nombre'], $codigo, $dato['padre']);
     $insercion->execute();
     $insertadas = $this->sql_con->affected_rows;
     if ($insertadas > 0) {
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 6
0
 protected function es_global($categoria)
 {
     $this->set_host(1);
     $consulta = "SELECT categoria_descripcion as descripcion FROM categoria WHERE categoria_nombre = '{$categoria}'";
     $rs = $this->sql_con->query($consulta);
     $nombre = sanear_string($categoria);
     if ($rs === false) {
         $descripcion = $nombre;
     } else {
         $row = $rs->fetch_assoc();
         if (mysqli_num_rows($rs) > 0) {
             $descripcion = $row['descripcion'];
         } else {
             if ($this->verificar_categoria($nombre) > 0) {
                 $fecha = date('Y-m-d H:i:s');
                 $descripcion = md5($fecha . $nombre);
             } else {
                 $descripcion = $nombre;
             }
         }
     }
     return $descripcion;
 }
Exemplo n.º 7
0
    $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;
}
$ds = DIRECTORY_SEPARATOR;
//1
srand(time());
$n = rand(1, 900);
$codlargo = 988766544322;
$dirmg = 'imagesmg';
$storeFolder = 'imagenes';
//2
if (!empty($_FILES)) {
    $tempFile = $_FILES['file']['tmp_name'];
    $nombreImagen = sanear_string($_FILES['file']['name']);
    $rutatemp = $n . $codlargo . $nombreImagen;
    $targetPath = dirname(__FILE__) . '/' . '../../../' . $dirmg . '/' . $storeFolder . '/';
    //4
    $targetFile = $targetPath . $rutatemp;
    //5
    $rutaDestino = $storeFolder . '/' . $rutatemp;
    move_uploaded_file($tempFile, $targetFile);
    //6
    $id = $_GET['id'];
    $updateSQL = sprintf("UPDATE sis_banners SET ruta=%s WHERE id_foto=%s", GetSQLValueString($rutaDestino, "text"), GetSQLValueString($id, "int"));
    mysql_select_db($database_sistemai, $sistemai);
    $Result1 = mysql_query($updateSQL, $sistemai) or die(mysql_error());
}
?>
   
Exemplo n.º 8
0
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' debe ser numerico.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' es obligatorio.\n'; }
    } if (errors) alert('Existen los siguientes errores:\n'+errors);
    document.MM_returnValue = (errors == '');
} }
        </script>
<body>
<div align="center"> 
<?php 
    if ($_POST["Grabar"]) {
        $url = str_replace(" ", "-", $_POST["nombre_maquina"]);
        $url = sanear_string($url);
        $listado = "select * from rout where url = '{$url}' ";
        $sentencia = $mysqli->query($listado);
        if ($rs = $sentencia->fetch_array()) {
            echo "Ya existe una ruta con el mismo nombre, cambien el titulo por otro o agregue mas texto a el";
        } else {
            $editar = "INSERT INTO noticias (titulo_noticia, breve_noticia, completo_noticia, url) \n\t\t\tVALUES ('{$_POST['nombre_maquina']}', '{$_POST['descripcion_breve']}', '{$_POST['contenido_detalle_maquina']}','{$url}')";
            $sentencia = $mysqli->query($editar, $conn) or die("Error al grabar: " . mysql_error);
            $editar = "INSERT INTO rout (url, destino) \n\t\t\tVALUES ('{$url}', 'novedades')";
            $sentencia = $mysqli->query($editar, $conn) or die("Error al grabar: " . mysql_error);
        }
    }
    ?>
<form action="novedades.php" method="post" name="form1" id="form1" >
  <table width="70%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
Exemplo n.º 9
0
body,td,th {
	color: #000000;
}
-->
</style>
<link href="../css/admin.css" rel="stylesheet" type="text/css">

<title>admin</title></head>

<body>
<div align="center">
  <p>
    <?php 
    if ($_POST["Grabar"]) {
        $urlnovedades = str_replace(" ", "-", $_POST["Nombre"]);
        $urlnovedades = sanear_string($urlnovedades);
        $listado = "select * from rout where url = '{$urlnovedades}' ";
        $sentencia = mysql_query($listado, $conn);
        if ($rs = mysql_fetch_array($sentencia, $mibase)) {
            echo "Ya existe una ruta con el mismo nombre, cambien el titulo por otro o agregue mas texto a el";
        } else {
            $insertar = "INSERT INTO rout (url,destino ) ";
            $insertar .= "VALUES( '{$urlnovedades}','detalle-producto')";
            $sentencia = mysql_query($insertar, $conn) or die("Error al grabar una ruta: " . mysql_error);
            $insertar = "INSERT INTO catalogo (Nombre, Descripcion, Servicios ) ";
            $insertar .= "VALUES('{$_POST['Nombre']}', '{$_POST['Descripcion']}', '{$_POST['Servicios']}')";
            $sentencia = mysql_query($insertar, $conn) or die("Error al grabar un detalle en el catalogo: " . mysql_error);
        }
    }
    ?>
    
Exemplo n.º 10
0
                                     <thead>
                                         <tr>
                                             <th width="30%">Nombre</th>
                                             <th width="15%">IP</th>
                                             <th width="30%">Perfil</th>
                                         </tr>
                                     </thead>
                                     <tbody>
                                      <?php 
 $API->write("/ip/hotspot/active/getall", true);
 $READ = $API->read(false);
 $ARRAY = $API->parse_response($READ);
 if (count($ARRAY) > 0) {
     // si hay mas de 1 queue.
     for ($x = 0; $x < count($ARRAY); $x++) {
         $name = sanear_string($ARRAY[$x]['user']);
         $datos_user_hotspot = '<tr>';
         $datos_user_hotspot .= '<td>' . $name . '</td>';
         $datos_user_hotspot .= '<td>' . $ARRAY[$x]['address'] . '</td>';
         $datos_user_hotspot .= '<td>' . $ARRAY[$x]['login-by'] . '</td>';
         $datos_user_hotspot .= '</tr>';
         echo $datos_user_hotspot;
     }
 } else {
     // si no hay ningun binding
     echo "No hay ningun IP-Bindings. //<br/>";
 }
 //var_dump($ARRAY);
 ?>
                                     </tbody>
                                 </table>                                    
Exemplo n.º 11
0
    $string = str_replace(array("\\", "¨", "º", "-", "~", "#", "@", "|", "!", "\"", "\$", "%", "&", "/", "(", ")", "?", "'", "¡", "¿", "[", "^", "`", "]", "+", "}", "{", "¨", "´", ">", "< ", ";", ",", ":", " ", '\\"'), '-', $string);
    return $string;
}
// SQL PARA REGISTRO DE DATOS
srand(time());
$n = rand(1, 900);
$cod = $_POST['cod_prod'];
$codlargo = 9887665;
$rutaprin = '../../../imagesmg/';
$rutaEnServidor = 'imagenes';
$rutaTemporal = $_FILES['imagen']['tmp_name'];
$nombreImagen = sanear_string($_FILES['imagen']['name']);
if ($nombreImagen == "") {
    $rutaDestino = $rutaprin . $rutaEnServidor . '/' . $nombreImagen;
    $rutaDestinoBD = $rutaEnServidor . '/' . $nombreImagen;
} else {
    $rutaDestino = $rutaprin . $rutaEnServidor . '/' . $n . $codlargo . $nombreImagen;
    $rutaDestinoBD = $rutaEnServidor . '/' . $n . $codlargo . $nombreImagen;
}
move_uploaded_file($rutaTemporal, $rutaDestino);
$alias = sanear_string($_POST['titulo_articulo']);
$contenido = $_POST['contenido'];
$insertSQL = sprintf("INSERT INTO sis_plantilla_articulos(id_articulo,id_art_cate, titulo_articulo, alias, contenido, orden, tipo_articulo,  status, ruta) VALUES ( %s,%s,%s,%s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['id_articulo'], "int"), GetSQLValueString($_POST['id_art_cate'], "int"), GetSQLValueString($_POST['titulo_articulo'], "text"), GetSQLValueString($alias, "text"), GetSQLValueString($contenido, "text"), GetSQLValueString($orden, "int"), GetSQLValueString($_POST['tipo_articulo'], "int"), GetSQLValueString($_POST['status'], "int"), GetSQLValueString($rutaDestinoBD, "text"));
mysql_select_db($database_sistemai, $sistemai);
$Result1 = mysql_query($insertSQL, $sistemai) or die(mysql_error());
$return_loc = "index.php";
//header("Location: ".$return_loc);
ob_end_flush();
?>

Exemplo n.º 12
0
                            <th>Nombre Cliente</th>
                            <th>MAC CPE</th>
                            <th>IP</th>
                            <th>Tiempo Conexi&oacute;n</th>
                        </tr>
                    </thead>

                    <tbody>
                        <?php 
    $API->write("/ppp/active/getall", true);
    $READ = $API->read(false);
    $ARRAY = $API->parse_response($READ);
    if (count($ARRAY) > 0) {
        // si hay mas de 1 queue.
        for ($x = 0; $x < count($ARRAY); $x++) {
            $name = sanear_string($ARRAY[$x]['name']);
            $datos_pppoe = '<tr>';
            $datos_pppoe .= '<td>' . $name . '</td>';
            $datos_pppoe .= '<td>' . $ARRAY[$x]['caller-id'] . '</td>';
            $datos_pppoe .= '<td>' . $ARRAY[$x]['address'] . '</td>';
            $datos_pppoe .= '<td>' . $ARRAY[$x]['uptime'] . '</td>';
            $datos_pppoe .= '</tr>';
            echo $datos_pppoe;
        }
    } else {
        // si no hay ningun binding
        echo "No hay ningun IP-Bindings. //<br/>";
    }
    //var_dump($ARRAY);
    ?>
            </tbody>
Exemplo n.º 13
0
function leer_cabeceras()
{
    global $servername, $username, $password, $dbname, $cursoActivo;
    $conn = mysqli_connect($servername, $username, $password, $dbname);
    $sql = "SELECT * FROM cabecera" . $cursoActivo;
    $result = mysqli_query($conn, $sql);
    $row = mysqli_fetch_array($result, MYSQLI_NUM);
    $arrlength = count($row);
    for ($x = 0; $x < $arrlength; $x++) {
        $var = $row[$x];
        echo "<div class='form-group form-alumnos col-sm-6'>" . "<label class='text-left pull-left'>" . $var . "</label>" . "<input type='text' " . "id='" . sanear_string($var) . "' " . "name='" . sanear_string($var) . "' " . "class='form-control pull-right' /></div>";
    }
}
Exemplo n.º 14
0
 protected function activar()
 {
     if (!$this->registro_nuevo) {
         $this->obtener_datos(7);
     }
     $resultados_pasos = array();
     $this->verificar_bd();
     if ($this->crear_bd()) {
         $resultado = array();
         $resultado['resultado'] = 1;
         $resultado['codigo'] = 14;
         array_push($resultados_pasos, $resultado);
         if ($this->insertar_empresa(1)) {
             $resultado = array();
             $resultado['resultado'] = 1;
             $resultado['codigo'] = 13;
             array_push($resultados_pasos, $resultado);
             if ($this->crear_conex_empresa(1)) {
                 $resultado = array();
                 $resultado['resultado'] = 1;
                 $resultado['codigo'] = 12;
                 array_push($resultados_pasos, $resultado);
                 if ($this->registro_nuevo) {
                     $this->login = $this->datos_cuenta['cli_mail'];
                 } else {
                     $this->login = sanear_string(substr($this->datos_cuenta['cli_nombre'], 0, 1));
                     $this->login .= sanear_string($this->datos_cuenta['cli_app']);
                     $this->login = strtolower($this->existe_login($this->login, 1));
                 }
                 if ($this->crear_usuario(1)) {
                     $resultado = array();
                     $resultado['resultado'] = 1;
                     $resultado['codigo'] = 11;
                     array_push($resultados_pasos, $resultado);
                     if ($this->crear_pass(1)) {
                         $resultado = array();
                         $resultado['resultado'] = 1;
                         $resultado['codigo'] = 10;
                         array_push($resultados_pasos, $resultado);
                         if ($this->relacionar_usuario_empresa(1)) {
                             $resultado = array();
                             $resultado['resultado'] = 1;
                             $resultado['codigo'] = 9;
                             array_push($resultados_pasos, $resultado);
                             if ($this->relacionar_usuario_rol(1, 1)) {
                                 $resultado = array();
                                 $resultado['resultado'] = 1;
                                 $resultado['codigo'] = 8;
                                 array_push($resultados_pasos, $resultado);
                                 if ($this->relacionar_usuario_sucursal(1, 1, 1)) {
                                     $resultado = array();
                                     $resultado['resultado'] = 1;
                                     $resultado['codigo'] = 7;
                                     array_push($resultados_pasos, $resultado);
                                     if ($this->insertar_empresa($this->nuevo_host)) {
                                         $resultado = array();
                                         $resultado['resultado'] = 1;
                                         $resultado['codigo'] = 6;
                                         array_push($resultados_pasos, $resultado);
                                         if ($this->crear_usuario($this->nuevo_host)) {
                                             $resultado = array();
                                             $resultado['resultado'] = 1;
                                             $resultado['codigo'] = 5;
                                             array_push($resultados_pasos, $resultado);
                                             if ($this->crear_pass($this->nuevo_host)) {
                                                 $resultado = array();
                                                 $resultado['resultado'] = 1;
                                                 $resultado['codigo'] = 4;
                                                 array_push($resultados_pasos, $resultado);
                                                 if ($this->relacionar_usuario_empresa($this->nuevo_host)) {
                                                     $resultado = array();
                                                     $resultado['resultado'] = 1;
                                                     $resultado['codigo'] = 3;
                                                     array_push($resultados_pasos, $resultado);
                                                     if ($this->relacionar_usuario_sucursal($this->nuevo_host, 1, 1)) {
                                                         $resultado = array();
                                                         $resultado['resultado'] = 1;
                                                         $resultado['codigo'] = 2;
                                                         array_push($resultados_pasos, $resultado);
                                                         if ($this->crear_sucursal($this->nuevo_host, $this->nueva_empresa, "SUCURSAL WEB", 1)) {
                                                             if (!$this->registro_nuevo) {
                                                                 $this->crear_datos_contacto(0);
                                                                 $this->crear_datos_contacto(1);
                                                                 $this->actualizar_cuenta(7, 1);
                                                             }
                                                             $resultado = array();
                                                             $resultado['resultado'] = 1;
                                                             $resultado['codigo'] = 1;
                                                             array_push($resultados_pasos, $resultado);
                                                             $this->obtener_datos_acceso();
                                                             //$this->enviar_correo();
                                                         } else {
                                                             $resultado = array();
                                                             $resultado['codigo'] = 1;
                                                             $resultado['resultado'] = $this->preparar_eliminacion($resultado['codigo']);
                                                             array_push($resultados_pasos, $resultado);
                                                         }
                                                     } else {
                                                         $resultado = array();
                                                         $resultado['codigo'] = 2;
                                                         $resultado['resultado'] = $this->preparar_eliminacion($resultado['codigo']);
                                                         array_push($resultados_pasos, $resultado);
                                                     }
                                                 } else {
                                                     $resultado = array();
                                                     $resultado['codigo'] = 3;
                                                     $resultado['resultado'] = $this->preparar_eliminacion($resultado['codigo']);
                                                     array_push($resultados_pasos, $resultado);
                                                 }
                                             } else {
                                                 $resultado = array();
                                                 $resultado['codigo'] = 4;
                                                 $resultado['resultado'] = $this->preparar_eliminacion($resultado['codigo']);
                                                 array_push($resultados_pasos, $resultado);
                                             }
                                         } else {
                                             $resultado = array();
                                             $resultado['codigo'] = 5;
                                             $resultado['resultado'] = $this->preparar_eliminacion($resultado['codigo']);
                                             array_push($resultados_pasos, $resultado);
                                         }
                                     } else {
                                         $resultado = array();
                                         $resultado['codigo'] = 6;
                                         $resultado['resultado'] = $this->preparar_eliminacion($resultado['codigo']);
                                         array_push($resultados_pasos, $resultado);
                                     }
                                 } else {
                                     $resultado = array();
                                     $resultado['codigo'] = 7;
                                     $resultado['resultado'] = $this->preparar_eliminacion($resultado['codigo']);
                                     array_push($resultados_pasos, $resultado);
                                 }
                             } else {
                                 $resultado = array();
                                 $resultado['codigo'] = 8;
                                 $resultado['resultado'] = $this->preparar_eliminacion($resultado['codigo']);
                                 array_push($resultados_pasos, $resultado);
                             }
                         } else {
                             $resultado = array();
                             $resultado['codigo'] = 9;
                             $resultado['resultado'] = $this->preparar_eliminacion($resultado['codigo']);
                             array_push($resultados_pasos, $resultado);
                         }
                     } else {
                         $resultado = array();
                         $resultado['codigo'] = 10;
                         $resultado['resultado'] = $this->preparar_eliminacion($resultado['codigo']);
                         array_push($resultados_pasos, $resultado);
                     }
                 } else {
                     $resultado = array();
                     $resultado['codigo'] = 11;
                     $resultado['resultado'] = $this->preparar_eliminacion($resultado['codigo']);
                     array_push($resultados_pasos, $resultado);
                 }
             } else {
                 $resultado = array();
                 $resultado['codigo'] = 12;
                 $resultado['resultado'] = $this->preparar_eliminacion($resultado['codigo']);
                 array_push($resultados_pasos, $resultado);
             }
         } else {
             $resultado = array();
             $resultado['codigo'] = 13;
             $resultado['resultado'] = $this->preparar_eliminacion($resultado['codigo']);
             array_push($resultados_pasos, $resultado);
         }
     } else {
         $resultado = array();
         $resultado['codigo'] = 14;
         $resultado['resultado'] = $this->preparar_eliminacion($resultado['codigo']);
         array_push($resultados_pasos, $resultado);
     }
     $this->comprobar_resultado($resultados_pasos);
 }
Exemplo n.º 15
0
                                             <tr>
                                                 <th width="50%">Nombre Interfaz</th>
                                                 <th width="20%">Estado</th>
                                                 <th width="30%">Velocidad LAN</th>
                                             </tr>
                                         </thead>
                                         <tbody>
                                         <?php 
 $API->write("/interface/ethernet/getall", true);
 $READ = $API->read(false);
 $ARRAY = $API->parse_response($READ);
 if (count($ARRAY) > 0) {
     // si hay mas de 1 queue.
     for ($x = 0; $x < count($ARRAY); $x++) {
         $name = sanear_string($ARRAY[$x]['name']);
         $speed = sanear_string($ARRAY[$x]['speed']);
         if ($ARRAY[$x]['running'] == "true") {
             $estado = "<span class='ok'>conectado</span>";
         } else {
             $estado = "<span class='fail'>desconectado</span>";
         }
         $datos_interface = '<tr>';
         $datos_interface .= '<td>' . $name . '</td>';
         $datos_interface .= '<td>' . $estado . '</td>';
         $datos_interface .= '<td>' . $speed . '</td>';
         $datos_interface .= '</tr>';
         echo $datos_interface;
         //var_dump($ARRAY);
     }
 } else {
     // si no hay ningun binding
Exemplo n.º 16
0
 * - $page['footer_thirdcolumn']: Items for the third footer column.
 * - $page['footer_fourthcolumn']: Items for the fourth footer column.
 * - $page['footer']: Items for the footer region.
 *
 * @see template_preprocess()
 * @see template_preprocess_page()
 * @see template_process()
 * @see bartik_process_page()
 * @see html.tpl.php
 */
$url = $GLOBALS['base_url'] . '/' . $directory . '/';
$titulo = $node->title;
$conrenido = $node->body['und'][0]['value'];
$precio = $node->field_precio_plan_2['und'][0]['value'];
$titulook = sanear_string($titulo);
$preciook = sanear_string($precio);
// $ApiKey = "w2n4SfgH60H3s4V70e5f8tcvOA";
// $Apilogin = "******";
// $Llavepublica = "PK6d47t0R4656RN268Y4187J0V";
// $merchantId = "529534";
// $accountId = "531394";
$cadenaorginal = "6u39nqhq8ftd0hlvnjfs66eh8c~500238~" . $titulook . "~" . $preciook . "~COP";
$firma = md5($cadenaorginal);
?>
 <div class="col-sm-4  text-center">



	<div class="yotta-plan">
		<div class="yotta-plan-i"></div>
		<div class="yotta-plan-d"></div>
Exemplo n.º 17
0
        //recuerden que deben crear un directorio con este mismo nombre
        //en el mismo lugar donde se encuentra el archivo subir.php
        $ruta = $_FILES['archivo']['name'];
        $ruta = sanear_string($ruta);
        $ruta = $codigo_fecha . $ruta;
        //comprobamos si este archivo existe para no volverlo a copiar.
        //pero si quieren pueden obviar esto si no es necesario.
        //o pueden darle otro nombre para que no sobreescriba el actual.
        if (!file_exists($ruta)) {
            //aqui movemos el archivo desde la ruta temporal a nuestra ruta
            //usamos la variable $resultado para almacenar el resultado del proceso de mover el archivo
            //almacenara true o false
            $resultado = @move_uploaded_file($_FILES["archivo"]["tmp_name"], "../profesorado/recursos/imagenes/" . $ruta);
            if ($resultado) {
                $nombre = $_FILES['archivo']['name'];
                $nombre = sanear_string($nombre);
                $nombre = $codigo_fecha . $nombre;
                //@mysql_query("INSERT INTO recursos (IMAGENES) VALUES ('$nombre')") ;
                //echo "<script>alert('el archivo ha sido movido exitosamente');</script>";
            } else {
                echo "ocurrio un error al mover el archivo.";
            }
        } else {
            echo $_FILES['archivo']['name'] . ", este nombre de archivo ya existe, cambialo por favor.";
        }
    } else {
        echo "archivo no permitido, es tipo de archivo prohibido o excede el tamano de {$limite_kb} Kilobytes";
    }
}
//termina subir imagen
$recurso_profesor = $_REQUEST['nombre_profesor'];
Exemplo n.º 18
0
 public function __construct()
 {
     session_start();
     require '../hosts.php';
     require 'conexion_new.php';
     $hosteo = new Host();
     $hosteo->obtener_conexion(0);
     $this->set_conexion($hosteo->datos_conexion['host'], $hosteo->datos_conexion['user'], $hosteo->datos_conexion['pass'], $hosteo->datos_conexion['bd']);
     $this->datos['nombre'] = mysqli_real_escape_string($this->sql_con, $_POST['nombre']);
     $this->datos['codigo'] = mysqli_real_escape_string($this->sql_con, $_POST['codigo']);
     include 'sanear_string.php';
     $this->datos['codigo'] = sanear_string($this->datos['codigo']);
     $this->datos['select_marcas'] = mysqli_real_escape_string($this->sql_con, $_POST['select_marcas']);
     $this->datos['categoria'] = mysqli_real_escape_string($this->sql_con, $_POST['categoria']);
     $this->datos['modelo'] = mysqli_real_escape_string($this->sql_con, $_POST['modelo']);
     $this->datos['descripcion'] = mysqli_real_escape_string($this->sql_con, $_POST['descripcion']);
     $this->datos['talla'] = mysqli_real_escape_string($this->sql_con, $_POST['talla']);
     $this->datos['alto'] = mysqli_real_escape_string($this->sql_con, $_POST['alto']);
     $this->datos['alto_unidad_medida'] = mysqli_real_escape_string($this->sql_con, $_POST['alto_unidad_medida']);
     $this->datos['ancho'] = mysqli_real_escape_string($this->sql_con, $_POST['ancho']);
     $this->datos['ancho_unidad_medida'] = mysqli_real_escape_string($this->sql_con, $_POST['ancho_unidad_medida']);
     $this->datos['largo'] = mysqli_real_escape_string($this->sql_con, $_POST['largo']);
     $this->datos['largo_unidad_medida'] = mysqli_real_escape_string($this->sql_con, $_POST['largo_unidad_medida']);
     $this->datos['peso'] = mysqli_real_escape_string($this->sql_con, $_POST['peso']);
     $this->datos['peso_unidad_medida'] = mysqli_real_escape_string($this->sql_con, $_POST['peso_unidad_medida']);
     $this->datos['volumen'] = mysqli_real_escape_string($this->sql_con, $_POST['volumen']);
     $this->datos['volumen_unidad_medida'] = mysqli_real_escape_string($this->sql_con, $_POST['volumen_unidad_medida']);
     if (isset($_POST['check_pesable'])) {
         $this->datos['pesable'] = mysqli_real_escape_string($this->sql_con, $_POST['check_pesable']);
     } else {
         $this->datos['pesable'] = 0;
     }
     if (isset($_POST['precio_u'])) {
         $this->datos['precio_u'] = mysqli_real_escape_string($this->sql_con, $_POST['precio_u']);
     } else {
         $this->datos['precio_u'] = 0;
     }
     if (isset($_POST['precio_m'])) {
         $this->datos['precio_m'] = mysqli_real_escape_string($this->sql_con, $_POST['precio_m']);
     } else {
         $this->datos['precio_m'] = 0;
     }
     if (isset($_POST['costo_compra'])) {
         $this->datos['costo_compra'] = mysqli_real_escape_string($this->sql_con, $_POST['costo_compra']);
     } else {
         $this->datos['costo_compra'] = 0;
     }
     if (isset($_POST['stock_r'])) {
         $this->datos['stock_r'] = mysqli_real_escape_string($this->sql_con, $_POST['stock_r']);
     } else {
         $this->datos['stock_r'] = 0;
     }
     if (isset($_POST['stock_m'])) {
         $this->datos['stock_m'] = mysqli_real_escape_string($this->sql_con, $_POST['stock_m']);
     } else {
         $this->datos['stock_m'] = 0;
     }
     $this->usuario = $_SESSION['id'];
     $this->empresa = $_SESSION['empresa'];
     $this->agregar_producto();
 }
Exemplo n.º 19
0
	  <p class="bckWh ml5">12 pagos de: <em class="red2">$ <?php 
echo number_format($meses, 2);
?>
</em></p>
	</fieldset>
	<fieldset>
		<input type="hidden" name="ofertaID" value="<?php 
echo $productoInfo->ofertaID;
?>
" />
		<input type="hidden" name="ofertaPrecio" value="<?php 
echo $productoInfo->ofertaPrecio;
?>
" />
		<input type="hidden" name="ofertaTitulo" value="<?php 
echo sanear_string($productoInfo->ofertaTitulo);
?>
" />
		<input type="hidden" name="ofertaEnvio" value="<?php 
echo $productoInfo->costoEnvio;
?>
" />
		<input type="hidden" name="gananciaPt" value="<?php 
echo $productoInfo->gananciaPt;
?>
" />
	<input class="narBotonBig mtb10" type="submit" value="Comprar" alt="Comprar" />
	</fieldset>
	<fieldset>
	</fieldset>
</form>
Exemplo n.º 20
0
 }
 // conversion de datos
 myLog(">>>>>Leído registro :" . $contador, 4, "");
 myLog("\$APP1         : {$APP1}", 5, "");
 myLog("\$Perfil1      : {$Perfil1}", 5, "");
 myLog("\$DescBreve    : {$DescBreve}", 5, "");
 myLog("\$Quorum       : {$Quorum},", 5, "");
 myLog("\$rpt          : {$rpt}", 5, "");
 myLog("\$unidad       : {$unidad}", 5, "");
 myLog("\$plataforma   : {$plataforma}", 5, "");
 myLog("---------------", 5, "");
 //print_r($data);
 // ** Comprobación de los datos
 // Eliminar caracteres extraños del nombre
 $APP = sanear_string($APP1);
 $Perfil = sanear_string($Perfil1);
 $description = trim($DescBreve);
 $description = trim($description) == "" ? "Pendiente" : $description;
 $description = $description . "|es~" . $description;
 // **
 // ** Generación arrays
 // **
 // Lista de aprobadores
 //$approver=array('approverDN'=>"cn=uaadmin,ou=sa,o=data", 'sequence'=>0);
 //$grantApprovers=array($approver);
 // Lista de propietarios, la aplicación no ncesita, así que ponemos al admin
 // El propietario lo asignamos a la UNIDAD que nos pasan
 if (trim($rpt) == "") {
     $propietario = "cn=uaadmin,ou=sa,o=data";
 } else {
     $propietario = "ou=" . $rpt . ",ou=admreg,ou=Organizacion,ou=Auxiliar,o=data";
function nombre_db($nombre_empresa, $id_empresa)
{
    $nom_empresa = str_replace(" ", "_", sanear_string($nombre_empresa));
    $nom_db = "smc_" . $id_empresa . "_" . $nom_empresa;
    return $nom_db;
}
    $con = mysql_connect("174.142.39.204", "root", "Guidored2013");
    if (!$con) {
        die('Could not connect: ' . mysql_error());
    }
    mysql_select_db("grupo_integral", $con);
    return $con;
}
$q = $_POST['q'];
$idempresa = $_POST['idempresa'];
$con = conexion();
$sql = "select * from productos where descripcion LIKE '%" . $q . "%' AND tipo_cfdi = 1 AND idempresa=" . $idempresa . "; ";
$res = mysql_query($sql, $con);
if (mysql_num_rows($res) == 0) {
    echo '<b>No hay sugerencias</b>';
} else {
    while ($fila = mysql_fetch_array($res)) {
        echo '<ul id="ulResultListClient" class="nav nav-tabs nav-stacked"><li><a onclick="mostrarInfoProducto(' . $fila["id_producto"] . '); RecibirProductoEncontrado(' . $fila["id_producto"] . ');" >' . sanear_string($fila['descripcion']) . '</a></li></ul>';
    }
    // onclick="myFunction2("'.$fila["id_producto"].'")
}
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);
    return $string;
}
Exemplo n.º 23
0
function activar_curso($file, $cursoActivar, $nombreCursoActivar)
{
    global $servername, $username, $password, $dbname;
    $datos = fgetcsv($file, 0, ',', '"');
    $arrlength = count($datos);
    $conn = mysqli_connect($servername, $username, $password, $dbname);
    // Variable de activación del curso, salta a cero si hay algún error
    $activar = 1;
    $sql = "INSERT IGNORE INTO cursos VALUES(" . "'{$cursoActivar}'" . ", " . "'{$nombreCursoActivar}'" . ");";
    if (!mysqli_query($conn, $sql)) {
        $activar = 0;
        echo "Error al insertar el curso: " . mysqli_error($conn) . "<br>";
    }
    // Crear tabla de alumnos
    $sql = "CREATE TABLE IF NOT EXISTS alumnos" . $cursoActivar . " (";
    for ($x = 0; $x < $arrlength; $x++) {
        $var = $datos[$x];
        $var = sanear_string($var);
        if ($x != $arrlength - 1) {
            if ($var === "N_Id_Escolar") {
                //fijar la clave primaria
                $sql .= $var . " VARCHAR(40)" . " PRIMARY KEY, ";
            } else {
                $sql .= $var . " VARCHAR(40)" . ", ";
            }
        } else {
            //añadir el código de ENGINE al último registro
            $sql .= $var . " VARCHAR(40)" . ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
        }
    }
    if (!mysqli_query($conn, $sql)) {
        $activar = 0;
        echo "Error al crear la tabla alumnos: " . mysqli_error($conn) . "<br>";
    }
    // Crear tabla de cabeceras, tabla especial con una sola fila,
    // que asocia los nombres completos de los campos de Séneca, al valor saneado
    $sql = "CREATE TABLE IF NOT EXISTS cabecera" . $cursoActivar . " (";
    for ($x = 0; $x < $arrlength; $x++) {
        $var = $datos[$x];
        $var = sanear_string($var);
        if ($x != $arrlength - 1) {
            $sql .= $var . " VARCHAR(40)" . ", ";
        } else {
            $sql .= $var . " VARCHAR(40)" . ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
        }
    }
    if (!mysqli_query($conn, $sql)) {
        $activar = 0;
        echo "Error al crear la tabla cabecera: " . mysqli_error($conn) . "<br>";
    }
    // Crear tabla de asignaturas
    $sql = "CREATE TABLE IF NOT EXISTS asignaturas" . $cursoActivar . " ( " . "id_asignatura VARCHAR(10) NOT NULL PRIMARY KEY, " . "nombre_completo VARCHAR(255), " . "area_competencial VARCHAR(255)) ENGINE=InnoDB;";
    if (!mysqli_query($conn, $sql)) {
        $activar = 0;
        echo "Error al crear la tabla asignaturas: " . mysqli_error($conn) . "<br>";
    }
    // Crear tabla de evaluaciones
    $sql = "CREATE TABLE IF NOT EXISTS evaluaciones" . $cursoActivar . " ( " . "id_evaluacion VARCHAR(10) NOT NULL PRIMARY KEY, " . "nombre_evaluacion VARCHAR(255)) ENGINE=InnoDB;";
    if (!mysqli_query($conn, $sql)) {
        $activar = 0;
        echo "Error al crear la tabla evaluaciones: " . mysqli_error($conn) . "<br>";
    }
    // Insertar datos de los tres trimestres principales
    $sql = "INSERT IGNORE INTO evaluaciones" . $cursoActivar . " VALUES (1, 'Primer Trimestre')," . " (2, 'Segundo Trimestre'), (3, 'Tercer Trimestre');";
    if (!mysqli_query($conn, $sql)) {
        $activar = 0;
        echo "Error al insertar los datos de los trimestres: " . mysqli_error($conn) . "<br>";
    }
    // Crear tabla de notas
    $sql = "CREATE TABLE IF NOT EXISTS notas" . $cursoActivar . " ( " . "N_Id_Escolar VARCHAR(40) NOT NULL,\n         id_evaluacion VARCHAR(10) NOT NULL,\n         id_asignatura VARCHAR(10) NOT NULL,\n         Nota INT,\n         FOREIGN KEY (N_Id_Escolar) REFERENCES alumnos" . $cursoActivar . "(N_Id_Escolar), " . "FOREIGN KEY (id_asignatura) REFERENCES asignaturas" . $cursoActivar . "(id_asignatura), " . "FOREIGN KEY (id_evaluacion) REFERENCES evaluaciones" . $cursoActivar . "(id_evaluacion), " . "PRIMARY KEY (N_Id_Escolar, id_evaluacion, id_asignatura, Nota) ) ENGINE=InnoDB;";
    if (!mysqli_query($conn, $sql)) {
        $activar = 0;
        echo "Error al crear la tabla notas: " . mysqli_error($conn) . "<br>";
    }
    // Insertar datos sin sanear en la tabla de cabeceras
    $sql = "SELECT COUNT(*) FROM cabecera" . $cursoActivar . ";";
    $result = mysqli_query($conn, $sql);
    $fila = mysqli_fetch_array($result, MYSQLI_NUM);
    if ($fila[0] != 1) {
        //Comprobar que no haya ya datos
        $sql = "INSERT INTO cabecera" . $cursoActivar . " VALUES(";
        for ($x = 0; $x < $arrlength; $x++) {
            $var = $datos[$x];
            $sql .= "'{$var}'" . ", ";
        }
        $sql = substr($sql, 0, -2);
        //quitar espacio y coma sobrantes y añadir ;
        $sql .= ");";
        if (!mysqli_query($conn, $sql)) {
            $activar = 0;
            echo "Error al insertar los datos de las cabeceras: " . $cursoActivar . mysqli_error($conn) . "<br>";
        }
    }
    // ./ end INSERT INTO cabecera
    // Comprobar si la activación se ha realizado con éxito
    if ($activar === 0) {
        echo "El curso " . $nombreCursoActivar . " no se ha activado correctamente" . "<br>";
    } else {
        echo "Curso " . $nombreCursoActivar . " activado correctamente" . "<br>";
        if ($cursoActivar != 1) {
            //si $cursoActivar no es el de prueba
            //crear archivo dentro de conf con los datos del cursoActivo
            $sql = "UPDATE conf SET cursoActivo = " . "{$cursoActivar}" . ", nombreCursoActivo = " . "'{$nombreCursoActivar}'" . " WHERE installed = 1;";
            mysqli_query($conn, $sql);
            $conf = fopen('../config/cursoActivo.php', 'w+');
            fwrite($conf, "<?php\n");
            fwrite($conf, "\$" . "cursoActivo" . " = " . $cursoActivar . ";");
            fwrite($conf, "\n" . "\$" . "nombreCursoActivo" . " = " . "'{$nombreCursoActivar}'" . ";");
            fclose($conf);
        } else {
            //si se está activando el curso de prueba, crear archivo cursoPrueba.php
            $sql = "UPDATE conf SET cursoPrueba = " . "{$cursoActivar}" . ", nombreCursoPrueba = " . "'{$nombreCursoActivar}'" . " WHERE installed = 1;";
            mysqli_query($conn, $sql);
            $conf = fopen('../config/cursoPrueba.php', 'w+');
            fwrite($conf, "<?php\n");
            fwrite($conf, "\$" . "cursoPrueba" . " = " . $cursoActivar . ";");
            fwrite($conf, "\n" . "\$" . "nombreCursoPrueba" . " = " . "'{$nombreCursoActivar}'" . ";");
            fclose($conf);
        }
    }
    // ./ end comprobación de la activación
}