"; /******************************************************/ /*Funzione di visualizzazione globale */ /*****************************************************/ //crea la pagina delle affluenze function all() { global $bgcolor1, $bgcolor2, $prefix, $dbi, $offset, $min,$id_cons_gen; echo "

" ."" .""; # echo ""; echo ""; $res = mysql_query("SELECT * FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data,orario", $dbi); $max = mysql_num_rows($res); echo "" ."" ."" .""; echo ""; echo ""; echo ""; if ($max != "0") { $i=1; while(list($id_cons2,$orario,$data) = mysql_fetch_row($res)){ // esplode la data $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1']; list($av1,$msv1,$gv1) = explode("-",$data); list($ov1,$mv1,$sv1) = explode(":",$orario); $i++; echo ""; echo ""; echo ""; echo "" .""; } } echo "
"._ORA.""._DATA."  
"; echo ""; minuti(); echo ""; $aff = mysql_query("SELECT data_inizio FROM ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen'", $dbi); list($data) = mysql_fetch_row($aff); list ($anno,$mese,$giorno)=explode('-',$data); echo ""; mese(); echo "" ."
 
$ov1,$mv1$gv1-$msv1-$av1
" .""; echo "" .""; echo "" ."" ."" ."" ."" ."" ."" ."
"; } // memorizza le affluenze function rec_add_aff($do,$ov,$mv,$gv,$msv,$av,$tipo,$ok, $modello) { global $prefix, $dbi,$id_cons_gen; $perms=ChiSei(0); if ($perms<256) die("Non hai i permessi per eseguire questa operazione!"); $data="$av-$msv-$gv"; $orario="$ov:$mv:00"; $confr = mysql_query("SELECT data_inizio, data_fine FROM ".$prefix."_ele_consultazione WHERE id_cons_gen ='$id_cons_gen'", $dbi); list($dadata, $adata) = mysql_fetch_row($confr); $dadata=strtotime($dadata); $adata=strtotime($adata); $cdata=strtotime($data); // verifica se data e ora esiste e fa l'upgrade $res = mysql_query("select * from ".$prefix."_ele_rilaff where id_cons_gen='$id_cons_gen' and data='$data' and orario='$orario'", $dbi); $tipo= mysql_num_rows($res); if(($tipo==0) and ($dadata <= $cdata) and ($adata >= $cdata)){ if(checkdate(intval($msv),intval($gv),intval($av))){ $result = mysql_query("insert into ".$prefix."_ele_rilaff values ('$id_cons_gen','$orario','$data')", $dbi)|| die("Impossibile inserire i dati! ".mysql_error()); } Header("Location: admin.php?op=rec_add_aff&id_cons_gen=$id_cons_gen"); } elseif ($do==2) { if ($ok !="1") { ele(); OpenTable(); echo "


"._DOMCANCELLA." ?
"; echo "[ "._NO." ] - ["._YES." ]"; CloseTable(); include("footer.php"); die(); }else{ $res = mysql_query("select id_cons from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen'", $dbi); while (list($id_cons2) = mysql_fetch_row($res)) mysql_query("delete from ".$prefix."_ele_voti_parziale where id_cons='$id_cons2' and data='$data' and orario='$orario'", $dbi)|| die("Impossibile cancellare i dati! ".mysql_error()); mysql_query("delete from ".$prefix."_ele_rilaff where id_cons_gen='$id_cons_gen' and data='$data' and orario='$orario'", $dbi)|| die("Impossibile cancellare i dati! ".mysql_error()); Header("Location: admin.php?op=rec_add_aff&id_cons_gen=$id_cons_gen&contr=$data"); } }else{ Header("Location: admin.php?op=rec_add_aff&id_cons_gen=$id_cons_gen&contr=$data"); } } if($do) rec_add_aff($do,$ov,$mv,$gv,$msv,$av,$tipo,$ok, $modello); ele(); OpenTable(); all(); CloseTable(); include("footer.php"); ?>