$arrayFecha = explode("/", $fecha); $nuevaFecha = $arrayFecha[1] . "/" . $arrayFecha[0] . "/" . $arrayFecha[2]; return $nuevaFecha; } function crearTabla($nombreTabla) { scraperwiki::sqliteexecute("create table " . $nombreTabla . " (idContrato int, `fecha` string, `objeto` string, `importe` string, `adjudicatario` string, `NIF` string)"); scraperwiki::sqlitecommit(); } function insertar($nombreTabla, $idContrato, $fecha, $objeto, $importe, $adjudicatario, $NIF) { scraperwiki::sqliteexecute("insert into " . $nombreTabla . " values (?,?,?,?,?,?)", array($idContrato, $fecha, utf8_decode($objeto), $importe, utf8_decode($adjudicatario), $NIF)); scraperwiki::sqlitecommit(); } $nombreTabla = "contratos2T2013"; crearTabla($nombreTabla); $arrayPDF = array("https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_2_1.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_30_2.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_31_2.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_32_2.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_33_2.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_34_2.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_35_2.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_36_3.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_36_4.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_50_5000.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_50_5001.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_50_5002.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_50_5003.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_50_5004.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_50_5005.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_50_5006.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_50_5007.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_50_5008.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_51_5101.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_53_5301.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_61_1.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_61_6101.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_63_6302.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_65_3.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_65_4.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_65_5%20(2).pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_65_5.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_69_1.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_69_2.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_69_4.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_69_8.pdf", "https://dl.dropboxusercontent.com/u/71960705/Contratos%20Menores%20Junta/Q2%202013/2013_2_74_2.pdf"); $idContrato = 1; foreach ($arrayPDF as $src_pdf) { # Some temporary files $pdf_f = tempnam('/tmp', 'inp') . '.pdf'; $xml_f = tempnam('/tmp', 'out') . '.xml'; # Download the PDF into a temporary file file_put_contents($pdf_f, file_get_contents($src_pdf)); # Convert the PDF to XML $cmd = '/usr/bin/pdftohtml -xml -nodrm -zoom 1.5 -enc UTF-8 -noframes "' . $pdf_f . '" "' . $xml_f . '" >/dev/null 2>&1'; system($cmd); # Load the XML and parse it. $xml = new SimpleXMLElement(file_get_contents($xml_f)); $objeto = ""; $adjudicatario = "";
<?php $VOCALES = array("a", "e", "i", "o", "u", "A", "E", "I", "O", "U"); $NUM_PALABRAS = 4; do { generarPalabras($palabraelegida, $coincidencias, $palabras); $tabla = crearTabla($palabraelegida, $coincidencias); } while ($tabla == false); function generarPalabras(&$palabraelegida, &$coincidencias, $palabras) { global $VOCALES, $NUM_PALABRAS; shuffle($palabras); $palabrasrestantes = $palabras; $palabraelegida = [$palabras[0]]; unset($palabrasrestantes[0]); $palabraconsonantes = str_replace($VOCALES, "", $palabraelegida[0]); $coincidencias = []; while (count($palabraelegida) < $NUM_PALABRAS) { $found = false; for ($i = 0; $i < strlen($palabraconsonantes) && !$found; $i++) { $c = $palabraconsonantes[$i]; foreach ($palabrasrestantes as $key => $value) { if (strpos($value, $c) !== false) { array_push($palabraelegida, $value); $palabraconsonantes = str_replace($c, "", str_replace($VOCALES, "", $value)); array_push($coincidencias, $c); unset($palabrasrestantes[$key]); $found = true; break; } }
<?php require '../../db/abrirBD.php'; require '../../utils/Tablas.php'; $consulta = "call SaldosGeneralTarjetaCredito(1)"; if (!mysqli_set_charset($conn, "utf8")) { printf("Error cargando el conjunto de caracteres utf8: %s\n", mysqli_error($conn)); } $resultado = $conn->query($consulta); crearTabla($resultado); require '../../db/cerrarBD.php';
<?php if (isset($_POST['name'])) { if ($_POST['name'] == 'valid') { crearTabla(); } } function crearTabla() { $tabla = '<table class="table table-bordered" > <tbody> <tr> <td> <img id="img1" src="controller/img/img1.jpg" alt="Disco 1" class="img-circle"> </td> <td><img id="img2" src="controller/img/img2.jpg" alt="Disco 2" class="img-circle"></td> <td><img id="img3" src="controller/img/img3.jpg" alt="Disco 3" class="img-circle"></td> </tr> <tr> <td><img id="img4" src="controller/img/img4.jpg" alt="Disco 4" class="img-circle"></td> <td><img id="img5" src="controller/img/img5.jpg" alt="Disco 5" class="img-circle"></td> <td><img id="img6" src="controller/img/img1.jpg" alt="Disco 6" class="img-circle"></td> </tr> <tr> <td><img id="img7" src="controller/img/img2.jpg" alt="Disco 7" class="img-circle"></td> <td><img id="img8" src="controller/img/img3.jpg" alt="Disco 8" class="img-circle"></td> <td><img id="img9" src="controller/img/img4.jpg" alt="Disco 9" class="img-circle"></td> </tr> </tbody> </table>'; $value = array("tabla" => $tabla);
<div class="box-body" id="body"> <?php require '../../db/abrirBD.php'; require '../../utils/Tablas.php'; $consulta1 = "call SaldosGeneralCuentaBancaria(1)"; $consulta2 = "call SaldosGeneralEfectivo(1)"; $consulta3 = "call SaldosGeneralTarjetaCredito(1)"; if (!mysqli_set_charset($conn, "utf8")) { printf("Error cargando el conjunto de caracteres utf8: %s\n", mysqli_error($conn)); } $resultado1 = $conn->query($consulta1); crearTabla($resultado1); require '../../db/cerrarBD.php'; require '../../db/abrirBD.php'; $resultado2 = $conn->query($consulta2); crearTabla($resultado2); require '../../db/cerrarBD.php'; require '../../db/abrirBD.php'; $resultado3 = $conn->query($consulta3); crearTabla($resultado3); ?> </div><!-- /.box-body --> <div class="box-footer"> <!--Aqui podria decir algo--> </div><!-- /.box-footer--> </div><!-- /.box -->
<?php session_start(); $jugador = $_SESSION['jugador']; $aciertos = $_SESSION['aciertos']; $fallos = $_SESSION['fallos']; $final = new DateTime($final); $inicio = $_SESSION['tiempo_inicio']; //$finalF = $final->format("H:i:s"); //$inicioF = $inicio->format("H:i:s"); $tiempo = $inicio->diff($final); $tiempo = $tiempo->format("%H:%I:%S"); $_SESSION['tiempo_total'] = $tiempo; $f1 = fopen("ejercicio-8.txt", "a"); fwrite($f1, "---------------------------------------------\r\n" . "Usuario: " . $jugador . "\r\n" . "Aciertos: " . $aciertos . "\r\n" . "Fallos: " . $fallos . "\r\n" . "Duración de partida: " . $tiempo . "\r\n" . "---------------------------------------------\r\n"); fclose($f1); require_once "bd_acceso.php"; $crearBD = crearBD(); $crearTabla = crearTabla(); require_once "resultado_vista.php";