source: trunk/client/file.php@ 392

Last change on this file since 392 was 360, checked in by roby, 3 years ago

ATTENZIONE: con questa rev viene cambiato il charset che da ora viene impostato su utf8. Fate tutte le vostre verifiche prima di installarla.
Seconda fase di rivisitazione e completamento delle funzioni necessarie per l'accesso al servizio tramite cellulare.
Effettuate alcune sistemazioni per gli avvisi di incongruenza.

File size: 1.9 KB
RevLine 
[2]1<?php
2
3include("config.php");
[265]4 try{
[360]5 $dbi = new PDO("mysql:host=$dbhost;charset=utf8", $dbuname, $dbpass, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION));
[265]6 $sql = "use $dbname";
7 $dbi->exec($sql);
8 }
9 catch(PDOException $e)
10 {
11 echo $sql . "<br>" . $e->getMessage();
12 }
[360]13 $sth = $dbi->prepare("SET NAMES 'utf8'");
14 $sth->execute();
15
16
[2]17$fase=intval($_GET['fase']);
18
[265]19
[2]20if ($fase=='1'){
[265]21 $sql="SELECT id_cons_gen,descrizione from ".$prefix."_ele_consultazione order by descrizione";
22 $res = $dbi->prepare("$sql");
23 $res->execute();
24
[360]25Header("content-type: application/x-javascript; charset=utf-8");
[2]26echo "document.write(\"<b><select name=\'id_cons_gen2\'>";
27
[265]28while(list($id_cons_gen2,$descr) = $res->fetch(PDO::FETCH_NUM)) {
[360]29 echo "<option value=\'$id_cons_gen2\'>$descr</option>";
[2]30 }
31 echo "</select>";
[265]32 $res = $dbi->prepare("$sql");
33 $res->execute();
34while(list($id_cons_gen2,$descr) = $res->fetch(PDO::FETCH_NUM)) {
[2]35 echo "<input type=\'hidden\' name=\'$id_cons_gen2\' value=\'$descr\'>";
36 }
37echo "</b>\")";
38
39}elseif ($fase=='2'){
40 $id_cons_gen2=intval($_GET['id_cons_gen2']);
[265]41 $sql="SELECT descrizione from ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen2'";
42 $rescons = $dbi->prepare("$sql");
43 $rescons->execute();
44
45 list($descr_cons) = $rescons->fetch(PDO::FETCH_NUM);
46 $sql="SELECT t2.id_comune,t2.descrizione from ".$prefix."_ele_cons_comune as t1 left join ".$prefix."_ele_comuni as t2 on t1.id_comune=t2.id_comune where t1.id_cons_gen=$id_cons_gen2 order by t2.descrizione ";
47 $res = $dbi->prepare("$sql");
48 $res->execute();
49
[360]50Header("content-type: application/x-javascript; charset=utf-8");
[2]51echo "document.write(\"<b><input type=\'hidden\' name=\'id_cons_gen2\' value=\'$id_cons_gen2\'><select name=\'id_comune2\'>";
52
[265]53while(list($id_comune2,$descr) = $res->fetch(PDO::FETCH_NUM)) {
[360]54 echo "<option value=\'$id_comune2\'>$descr</option>";
[2]55 }
56 echo "</select>";
57echo "</b>\")";
58}
59
60
61?>
Note: See TracBrowser for help on using the repository browser.