etiqueta.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <?php
  2. require_once 'shared/conexionBD.php';
  3. //encode utf8
  4. mysqli_query($conexion, "SET NAMES utf8");
  5. $nombreParametros = ["tEti", "nITM", "cLITM", "nLote", "cPzas", "uMed", "tDoc", "nDoc", "UKID"];
  6. if($_SERVER['METHOD'] == 'POST'){
  7. header("Location: https://www.solerpalau.mx");
  8. exit;
  9. }else{
  10. if(empty($_GET)){
  11. header("Location: https://www.solerpalau.mx");
  12. exit;
  13. }else{
  14. if(!array_key_exists("data", $_GET)){
  15. header("Location: https://www.solerpalau.mx");
  16. exit;
  17. }
  18. $parametrosStr = $_GET["data"];
  19. $parametrosArr = explode(" ", $parametrosStr);
  20. if(count($parametrosArr) < 9){
  21. header("Location: https://www.solerpalau.mx");
  22. exit;
  23. }
  24. $dataArr = array();
  25. for($i = 0; $i < count($nombreParametros); $i++){
  26. $dataArr[$nombreParametros[$i]] = $parametrosArr[$i];
  27. }
  28. $qryReg = "SELECT IDREGISTRO FROM ITT_ALP_TABLAS WHERE CONTENIDO LIKE '%" . $dataArr["cLITM"] . "%'";
  29. $gstReg = mysqli_query($conexion, $qryReg);
  30. $date = date('Y-m-d H:i:s');
  31. $ip = $_SERVER['REMOTE_ADDR'];
  32. $cadqr = "https://solerpalau.mx" . $_SERVER['REQUEST_URI'];
  33. if($gstReg->num_rows == 0){
  34. $accionForm = "errorEtiqueta.php";
  35. $esta = "Error";
  36. $method = "POST";
  37. }else{
  38. $idRegistro = '';
  39. while($rowReg = mysqli_fetch_assoc($gstReg)){
  40. $idRegistro = $rowReg["IDREGISTRO"];
  41. }
  42. $qryProducto = "SELECT GL.LINEA, GL.MODELO, GL.SUBMODELO, PR.ARCH_FICH FROM ITT_ALP_GLOBAL AS GL LEFT JOIN ITT_ASW_PROD AS PR ON PR.SUBM = GL.SUBMODELO WHERE GL.ID = '$idRegistro' LIMIT 1";
  43. $gstProducto = mysqli_query($conexion, $qryProducto);
  44. while($rowProd = mysqli_fetch_assoc($gstProducto)){
  45. $linea = $rowProd["LINEA"];
  46. $modelo = $rowProd["MODELO"];
  47. $submodelo = $rowProd["SUBMODELO"];
  48. $ficha = $rowProd["ARCH_FICH"];
  49. }
  50. $accionForm = "producto.php";
  51. $esta = "Exito";
  52. $method = "GET";
  53. }
  54. $qryRegistrarConsulta = "INSERT INTO ITT_ASW_ETQR (FEHR, IPUS, CAQR, ESTA) VALUES ('$date', '$ip', '$cadqr', '$esta')";
  55. $gstRegCons = mysqli_query($conexion, $qryRegistrarConsulta);
  56. if($ficha !== null){
  57. $location = $ficha;
  58. if(file_exists($location)){
  59. $name = basename($location);
  60. $name = urlencode($name);
  61. header("Content-type: application/pdf");
  62. header('Content-Disposition: inline; filename="' . $name . '"');
  63. header('Expires: 0');
  64. header('Cache-Control: must-rSomething is wrongidate');
  65. header('Pragma: public');
  66. header('Content-Length: ' . filesize($location));
  67. // Send the file to the browser.
  68. readfile($location);
  69. exit;
  70. }
  71. }
  72. }
  73. }
  74. ?>
  75. <!DOCTYPE html>
  76. <html xml:lang="es" lang="es">
  77. <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  78. <head>
  79. <!-- Global site tag (gtag.js) - Google Analytics -->
  80. <!--Producción-->
  81. <script async src="https://www.googletagmanager.com/gtag/js?id=UA-125019062-2"></script>
  82. <!--Producción-->
  83. <script>
  84. window.dataLayer = window.dataLayer || [];
  85. function gtag(){dataLayer.push(arguments);}
  86. gtag('js', new Date());
  87. gtag('config', 'UA-125019062-2');
  88. </script>
  89. <!-- End Global site tag (gtag.js) - Google Analytics -->
  90. <!-- [if IE]> -->
  91. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
  92. <meta http-equiv="cleartype" content="on"/>
  93. <!-- <![endif] -->
  94. <meta content="width=device-width, initial-scale=1" name="viewport"/>
  95. <title>Etiqueta – S&amp;P</title>
  96. <meta name="keywords" content="Varien, E-commerce"/>
  97. <meta name="robots" content="INDEX,FOLLOW"/>
  98. <link rel="icon" href="https://statics.solerpalau.com/skin/frontend/solerpalau/default/favicon.ico" type="image/x-icon"/>
  99. <!-- ================================================================================ -->
  100. <script type="text/javascript" src="js/events.js"></script>
  101. <!-- ================================================================================ -->
  102. <link rel="stylesheet" type="text/css" href="css/style-css01.css" media="all" />
  103. <!-- ================================================================================ -->
  104. <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
  105. <link href="css/flexslider.css" rel="stylesheet">
  106. <!-- ================================================================================ -->
  107. </head>
  108. <body>
  109. <form id="frm" action="<?php echo $accionForm; ?>" method="<?php echo $method; ?>">
  110. <?php if($esta == "Error") { ?>
  111. <input type="hidden" name="data" value="<?php echo base64_encode($cadqr); ?>">
  112. <?php } else { ?>
  113. <input type="hidden" name="linea" value="<?php echo $linea; ?>">
  114. <input type="hidden" name="modelo" value="<?php echo $modelo; ?>">
  115. <input type="hidden" name="submodelo" value="<?php echo $submodelo; ?>">
  116. <?php } ?>
  117. </form>
  118. <script>
  119. let frm = document.getElementById("frm");
  120. frm.submit();
  121. </script>
  122. </body>
  123. </html>