//print_r($GLOBALS);
include("config.inc.php");
include ("inc/sql.scr");
include ("inc/txtmanip.scr");
$db=mysql_connect($db_host,$db_user,$db_password);
if($db==FALSE) die("Err connex. Chk parms into config.inc.php");
mysql_select_db($db_name,$db) or die("Err sel db. Chk parms into config.inc.php");
$it=$_GET['it'];
/***************************************************
* Aggiornamento counter
***************************************************/
$query="UPDATE documenti SET doc_click=doc_click+1 WHERE doc_ID='".$it."' ";
//echo $query. " ";
$result=mysql_query($query,$db);
/***************************************************
***************************************************/
//$query = "SELECT A.doc_nome, A.doc_path, A.doc_descr, C.ana_ID, C.ana_nome, C.ana_cognome FROM documenti AS A LEFT JOIN contributi AS B ON (B.media=A.doc_type AND B.film=A.doc_ID) LEFT JOIN anagrafica AS C ON (C.ana_ID=B.chi) WHERE doc_ID = '$it' ";
$query = "SELECT A.doc_nome, A.doc_path, A.doc_descr, C.ana_ID, C.ana_nome, C.ana_cognome FROM documenti AS A LEFT JOIN contributi AS B ON (B.media = '77' and B.film=A.doc_ID) LEFT JOIN anagrafica AS C ON (C.ana_ID=B.chi) WHERE A.doc_ID = '$it' ";
//echo $query." ";
//$reslt = mysql_query($query,$db);
$reslt = executequery($query,0,1);
$row13 = mysql_fetch_array($reslt);
$di = $row13[doc_ID];
$dn = $row13[doc_nome];
$dp = $row13[doc_path];
$dt = $row13[doc_descr];
$ai = $row13[ana_ID];
$an = $row13[ana_nome];
$ac = $row13[ana_cognome];
/***************************************************
* Estrazione argomenti correlati *
***************************************************/
$k = 0;
$elecorr = "";
$qry70 = "SELECT A.arg_ID, B.argomento FROM arglink AS A LEFT JOIN argomenti AS B ON (A.arg_ID = B.arg_ID) WHERE ((A.alk_media='77') AND (A.alk_issue = '$it') AND (A.alk_pubblicabile = 'S'))";
$res70 = executequery($qry70,0,1);
if ($numargs = mysql_num_rows($res70)) {
switch($numargs):
case '0': break; // per sicurezza!
case '1': {$elecorr = "È disponibile un elenco di materiale correlato per l'argomento "; break;}
default: {$elecorr = "Sono disponibili gli elenchi di materiali correlati per gli argomenti "; break;}
endswitch;
while($row70 = mysql_fetch_array($res70)) {
$k +=1;
$aid[$k] = $row70[arg_ID];
$agm[$k] = $row70[argomento];
if($k>1) { if ($k<$numargs) {$elecorr.=", ";} else {$elecorr.=" e ";} }
$elecorr.="" . $agm[$k] . "";
}
$elecorr .= ". ";
}
/***************************************************************************
* reperimento commenti sul muro
***************************************************************************/
$bc = "";
$qry5 = "SELECT * FROM muro_don_bosco WHERE (id_tab='77' AND id_disc='$it') ORDER by mu_ins_date";
$ris5 = executequery($qry5,0,1) or die("docu2::qry5 :: Impossibile eseguire l'interrogazione.");
switch ($xnc=mysql_num_rows($ris5)) {
case '0':
// $bc .= "Al momento non sono disponibili commenti al film. ";
break;
case '1':
$bc .= "Al momento è disponibile un solo commento. ";
break;
default:
$bc .= "Sono disponibili ".$xnc." commenti. ";
break;
}
/***************************************************
* Estrazione altri documenti *
***************************************************/
$k = 0;
$docus = "";
$qry71 = "SELECT doc_ID, doc_nome FROM documenti WHERE doc_ID NOT IN ('$it') ORDER BY doc_nome";
$res71 = executequery($qry71,0,1);
while($row71 = mysql_fetch_array($res71)) {
$aid = $row71[doc_ID];
$agm = $row71[doc_nome];
// if($k>1) { if ($k<$numargs) {$elecorr.=", ";} else {$elecorr.=" e ";} }
// if ($docus=="") $docus = "