| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- <?php
- require 'shared/extraeInfo.php';
- $accesoPortal = new AccesoPortal();
- error_reporting(0);
- if (isset($_POST['compare'])) {
- $arrComparador = json_decode($_POST['compare'],true);
- $arrJson = $_POST['compare'];
- if (!empty($arrComparador)) {
- foreach ($arrComparador as $key => $datos) {
- foreach ($datos as $key => $detalles) {
-
- $idx = $detalles['Id'];
- $model = $detalles['Model'];
- $serie = $detalles['codSerie'];
- $categoria = $detalles['catId'];
-
- $imagen = $accesoPortal->compara($model,$idx,$serie,$categoria);
- }
- }
- ?>
- <div class="row">
- <div id="compare" class="section">
- <div class="container title-only">
- <div class="row">
- <div class="col-md-12 section-title">
- <h2 id="compare-fans-header">Comparar ventiladores</h2>
- <hr>
- </div>
- </div>
- <div class="saved-container">
- <div class="row">
- <div class="col-md-5">
- <div class="saved-chart-container" style="margin-bottom:30px">
- <?php if(!empty($imagen)) echo $imagen; ?>
- </div>
- </div>
- <div class="col-md-7">
- <div class="saved-grid-container">
- <table id="saved-grid" style="width:100%;" class="table table-hover table-striped dt-responsive no-wrap">
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script>
-
- if (compareEnabled) {
- $j("#saved-grid").DataTable({
- language: {
- url: 'js/0.js'
- },
- searching: false,
- lengthChange: false,
- data: [],
- responsive: {
- details: {
- type: 'column'
- },
- },
- rowId: 'RowId',
- columns: [
- {
- title: "", data: "Id", orderable: false, render: function (data, type, full, meta) {
- return "<a class=\"delete-saved\" style=\"cursor: pointer;\" onclick=\"removeFan(" + data + ")\" data-val=\"" + data + "\"><i class=\"fa fa-times\" aria-hidden=\"true\"></i></a>";
- }
- },
- { data: "Model", title: ColumnCode, visible: true },
- { data: "Description", title: ColumnDescription, visible: true }
- /*{
- title: "", data: "Id", orderable: false, render: function (data, type, full, meta) {
-
- return "<a style=\"cursor: pointer;\" class='tree quickview btn btn-primary btn-xs' data-val=\"" + data + "\"><i class=\"fa fa-search\" aria-hidden=\"true\"></i> " + ViewStr + "</a>";
- // return ;
- }
- }*/
- ]
- });
- var $grid = $j('#saved-grid').DataTable();
- $grid.clear();
- //pasamos el array de php a Js
- var datos = '<?php echo $arrJson ?>';
- //le damos formato tipo json
- var res = datos.split('"').join("'");
- var json = JSON.stringify(eval("(" + res + ")"));
- arrToJson = JSON.parse(json);
- //los agregamos a la tabla
- for (var i = 0; i < arrToJson.datos.length; i++) {
- $grid.row.add(arrToJson.datos[i]).draw();
- }
- //desaparecer comparador si no tenemos datos
- if (Object.keys(arrToJson.datos).length === 0) {
- $j("#comparador").hide();
- }
- }
- </script>
- <?php
- }
- }
- // Imprimimos el modelo en 3D
- if (isset($_POST['url'])) {
- $url = trim($_POST['url']);
- // Mandamos a llamar el método getTablas
- $accesoPortal->buscarInfo($url);
- }
- // Extraer la tabla de modelos
- if (isset($_POST['table'])) {
- $url = $_POST['table'];
- extraerTabla($url);
- }
- function extraerTabla($url){
- require_once 'shared/conexionBD.php';
- //hacemos una consulta para obtener los modelos de hábitat
- mysqli_query($conexion, "SET NAMES utf8");
- $idProducto = $_POST['id'];
- $queryConsulta = "SELECT IDPROD, DATATABLE, FECHAMOD FROM ITT_ASW_EASYVENT WHERE IDPROD = '" . trim($idProducto) . "'";
- $resultado = mysqli_query($conexion, $queryConsulta) or die("Algo ha ido mal en la consulta a la base de datos");
- $arrTabla = array();
- while ($columna = mysqli_fetch_assoc($resultado)) {
- $arrTabla[] = $columna;
- }
- if(!empty($arrTabla)){
- echo $arrTabla[0]['DATATABLE'];
- }/* else{
- $exito = false;
- $errorDescripcion = '';
- // Los servidores se obtuvieron de la página https://www.proxyscan.io/ ** Todos son de México
- $arrProxies = array(); // Lista de Proxies para realizar las peticiones
- //$arrProxies[0]['proxyAndPuerto'] = '187.188.168.57:9991'; // No funciona (puede servir para realizar pruebas del ciclo)
- //$arrProxies[0]['tipoProxy'] = CURLPROXY_SOCKS4;
-
- // $arrProxies[0]['proxyAndPuerto'] = '190.9.54.24:5678';
- // $arrProxies[0]['tipoProxy'] = CURLPROXY_SOCKS4;
- // $arrProxies[1]['proxyAndPuerto'] = '187.216.90.46:5678';
- // $arrProxies[1]['tipoProxy'] = CURLPROXY_SOCKS4;
- // $arrProxies[2]['proxyAndPuerto'] = '201.148.28.17:5678';
- // $arrProxies[2]['tipoProxy'] = CURLPROXY_SOCKS4;
- // $arrProxies[3]['proxyAndPuerto'] = '187.189.81.246:4153';
- // $arrProxies[3]['tipoProxy'] = CURLPROXY_SOCKS4;
- // $arrProxies[4]['proxyAndPuerto'] = '187.217.39.66:5678';
- // $arrProxies[4]['tipoProxy'] = CURLPROXY_SOCKS4;
- // $arrProxies[5]['proxyAndPuerto'] = '177.242.150.6:5678';
- // $arrProxies[5]['tipoProxy'] = CURLPROXY_SOCKS4;
-
- // Proxy No Disponible
- // $arrProxies[0]['proxyAndPuerto'] = '169.57.64.4:3128';
- // $arrProxies[0]['tipoProxy'] = CURLPROXY_HTTP;
-
- // Los servidores se obtuvieron de la página http://proxydb.net/?country=MX ** Todos son de México
- $arrProxies[0]['proxyAndPuerto'] = '201.159.22.164:46809';
- $arrProxies[0]['tipoProxy'] = CURLPROXY_SOCKS4;
- $arrProxies[1]['proxyAndPuerto'] = '201.144.20.231:5678';
- $arrProxies[1]['tipoProxy'] = CURLPROXY_SOCKS4;
- $arrProxies[2]['proxyAndPuerto'] = '45.167.253.129:999';
- $arrProxies[2]['tipoProxy'] = CURLPROXY_HTTPS;
-
- $totalProxies = count($arrProxies) - 1;
-
- for ($i = 0; $i <= $totalProxies; $i++) {
- //echo $arrProxies[$i]['proxyAndPuerto'].'<br>';
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url); // Dirección URL a capturar
- curl_setopt($ch, CURLOPT_PROXY, $arrProxies[$i]['proxyAndPuerto']); // El proxy HTTP para enviar peticiones a través de tunel.
- curl_setopt($ch, CURLOPT_PROXYTYPE, $arrProxies[$i]['tipoProxy']); // Puede ser CURLPROXY_HTTP (por defecto), CURLPROXY_SOCKS4, CURLPROXY_SOCKS5, CURLPROXY_SOCKS4A o CURLPROXY_SOCKS5_HOSTNAME
- curl_setopt($ch, CURLOPT_TIMEOUT, 60); // Número máximo de segundos permitido para ejectuar funciones cURL
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60); // Número de segundos a esperar cuando se está intentado conectar. Use 0 para esperar indefinidamente
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // "true" para seguir cualquier encabezado "Location: " que el servidor envíe como parte del encabezado HTTP (observe la recursividad, PHP seguirá tantos header "Location: " como se envíen, a no ser que la opción CURLOPT_MAXREDIRS esté establecida)
- //curl_setopt($ch, CURLOPT_MAXREDIRS, 10); // Número máximo de redirecciones HTTP a seguir. Use esta opción con CURLOPT_FOLLOWLOCATION
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // "true" para devolver el resultado de la transferencia como string del valor de curl_exec() en lugar de mostrarlo directamente
- $data = curl_exec($ch); // Ejecuta la sesión cURL que se le pasa como parámetro
- $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); // Obtener información sobre una transferencia específica -> El último código de respuesta. A partir de PHP 5.5.0 y cURL 7.10.8, este es un alias heredado de CURLINFO_RESPONSE_CODE
- curl_close($ch); // Cierra la sesión cURL
-
- if (($httpcode >= 200) && ($httpcode < 300)) {
- $contenido = $data;
-
- if ($contenido) {
- $tablaHTML = "<div class='section section-grey'>";
- $seccionGris = strstr($contenido, "section section-grey");
- $removeFooter = strstr($seccionGris, "section cookie-warning", true);
- $tablaHTML .= ("<div class=\" " . $removeFooter . "\" >");
- $tablaHTML .= "</div>";
- $tablaHTML = str_replace("'", '"', $tablaHTML);
- $exito = true;
- $idProducto = $_POST['id'];
- $fechaMod = date("Y-m-d H:i:s");
- // $queryUpdate = "UPDATE ITT_ASW_EASYVENT SET DATATABLE = '" . trim($tablaHTML) . "', FECHAMOD = '" . trim($fechaMod) . "' WHERE (IDPROD = '" . trim($idProducto) . "');";
- $queryInsert = "INSERT INTO ITT_ASW_EASYVENT (IDPROD, DATATABLE, FECHAMOD) VALUES ('" . trim($idProducto) . "', '" . trim($tablaHTML) . "', '" . trim($fechaMod) . "');";
- if (mysqli_query($conexion, $queryInsert)) {
- var_dump('TEST REGISTRO');
- }
- echo $queryInsert;
- } else {
- $exito = false;
- }
- goto fin_extraerTabla;
- }else{
- $exito = false;
- }
-
- } // Fin del ciclo
-
- fin_extraerTabla :
- if($exito == false){
- if(empty($errorDescripcion)){
- echo "<p style='text-align: center;'>Los servidores proxy dejarón de funcionar. Por favor contacte con al administrador del sistema si el problema continua.</p>";
- }else{
- echo $errorDescripcion;
- }
- }
- } */
- }
- ?>
|