Codice PHP:
<?
include("db.php");
include("domicilio.php");
if ($_REQUEST["tipo"] == 'pro'):
$titolo = "PROFESSIONISTI";
elseif ($_REQUEST["tipo"] == 'pra'):
$titolo = "PRATICANTI";
elseif ($_REQUEST["tipo"] == 'pub'):
$titolo = "PUBBLICISTI";
elseif ($_REQUEST["tipo"] == 'spe'):
$titolo = "SPECIALI";
else:
print "<h1>ERRORE CODICE LISTA </h1>
";
endif;
$tipo=$_REQUEST["tipo"];
if ($_REQUEST["alfa"] == '0'):
// ELENCO NORMALE
$query_elenco = "SELECT id_ass, cognome_nome, indirizzo_res, concat(cap_res,'-',comune_res,'-','(',prov_res,')') as indirizzoresidenza, indirizzo_dom, concat(cap_dom,'-',comune_dom,'-','(',prov_dom,')') as indirizzodomicilio, selezione_ind, selezione_ind2, moroso, morosoucsi, morosoussi, morosogus FROM anagrafica WHERE (".$_REQUEST["tipo"]."_att !=0) AND sospeso=0 AND cancellato=0 AND deceduto=0 ORDER BY cognome_nome";
// print $query_elenco;
$risultato = mysql_query($query_elenco, $connessione);
$num_righe = mysql_num_rows($risultato);
elseif ($_REQUEST["alfa"] == '1'):
//ELENCO IN ORDINE ALFABETICO
$query_elenco = "SELECT cognome_nome, ".$_REQUEST["tipo"]."_num, ".$_REQUEST["tipo"]."_dataiscr indirizzo_res, concat(cap_res,'-',comune_res,'-','(',prov_res,')') as indirizzoresidenza, indirizzo_dom, concat(cap_dom,'-',comune_dom,'-','(',prov_dom,')') as indirizzodomicilio, selezione_ind, selezione_ind2, moroso, morosoucsi, morosoussi, morosogus FROM anagrafica WHERE (".$_REQUEST["tipo"]."_att !=0) AND sospeso=0 AND cancellato=0 AND deceduto=0 ORDER BY cognome_nome";
// print $query_elenco;
$risultato = mysql_query($query_elenco, $connessione);
endif;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>|
<? if ($_REQUEST["alfa"] == '0'):
print("LISTA ".$titolo);
elseif ($_REQUEST["alfa"] == '1'):
print("ELENCO ALFABETICO ".$titolo);
endif;?>
|</title>
<style type="text/css">
<!--
body {
background-color: #68B2B5;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: small;
font-style: normal;
margin: 5;
text-align: center;
text-decoration: none;
cursor: crosshair;
}
-->
</style>
<link href="yoko.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="200" border="0">
<tr>
<td>[url="index.php"][img]immagini/stampasarda_r1_c1.jpg[/img][/url]</td>
</tr>
<tr>
<td>:: [url="ricerca.php"]RICERCA[/url] :: [url="macro.php"]RICERCA AVANZATA[/url] :: [url="comunicazioni<? echo($tipo);?>.php"]COMUNICAZIONI[/url] :: <a href="javascript:self.print()" class="PrintVersion">[b]STAMPA IL DOCUMENTO[/b]
<link rel="stylesheet" type="text/css" href="yokoprint.css"
media="print" /></td>
</tr>
</table>
<h3>
<? if ($_REQUEST["alfa"] == '0'):
print("".$num_righe);
print(" in lista ".$titolo);
elseif ($_REQUEST["alfa"] == '1'):
print("ELENCO ALFABETICO ".$titolo);
endif;?>
</h3>
<table width=760 border=0 align="center" cellpadding=1 cellspacing=5 bgcolor="#6BA49E">
<tr>
<td></td>
<td align="left"></td>
<td align="left"></td>
<td colspan="2" align="left"></td>
</tr>
<tr>
<td colspan="5"></td>
</tr>
<tr>
<td width="65" height="18" bgcolor="#9FC4C0"><div align="left" id="iscritto">[b]n°[/b]</div></td>
<td width="271" align="left" bgcolor="#9FC4C0">[b]COGNOME e Nome [/b]</td>
<td width="97" align="left" bgcolor="#9FC4C0">[b]indirizzo[/b]</td>
<td width="109" align="left" bgcolor="#9FC4C0">[b]Comune[/b]</td>
<td width="218" align="left" bgcolor="#9FC4C0"><div align="center">Note</div></td>
</tr>
<tr>
<td bgcolor="#6BA49E"></td>
<td align="left" bgcolor="#6BA49E"></td>
<td align="left" bgcolor="#6BA49E"></td>
<td align="left" bgcolor="#6BA49E"></td>
<td align="left" bgcolor="#6BA49E"></td>
</tr>
<?
$value = array($row['moroso'], $row['morosoucsi'], $row['morosoussi'], $row['morosogus']);
function scegli($val) {
global $value;
if ($val == $value[0]) $str = "morquota.jpg";
if ($val == $value[1]) $str = "morucsi.jpg";
if ($val == $value[2]) $str = "morussi.jpg";
if ($val == $value[3]) $str = "morgus.jpg";
$retval = "<img src=\"immagini/$str\" width=\"8\" height=\"8\" border=\"0\" title=\"Moroso quota annuale\">";
return $retval;
}
while ($row = mysql_fetch_array($risultato))
if ($_REQUEST["alfa"] == '0' AND $row["selezione_ind"] == "res"):
$i = 0;
{
$i++;
$riga ="<tr><td><div id=\"Layer3\"><a href=\"singolo.php?id_ass=$row[id_ass]&tipo=$tipo\">$row[id_ass]</a></div></td><td align=\"left\">$row[cognome_nome] </td><td width=\"260\" align=\"left\">$row[indirizzo_res]</td><td width=\"232\" align=\"left\">$row[indirizzoresidenza]</td>
<td width=\"232\" align=\"left\">".scegli('mor')."</td>
</tr> ";
}
elseif ($_REQUEST["alfa"] == '0' AND $row["selezione_ind2"] == "dom"):
$riga ="<tr><td><div id=\"Layer3\"><a href=\"singolo.php?id_ass=$row[id_ass]&tipo=$tipo\">$row[id_ass]</a></div></td><td align=\"left\">$row[cognome_nome] </td><td width=\"260\" align=\"left\">$row[indirizzo_dom]</td><td width=\"232\" align=\"left\">$row[indirizzodomicilio]</td>
<td width=\"232\" align=\"left\">".scegli('mor')."</td>
</tr> ";
echo "$riga";
endif;
if ($_REQUEST["alfa"] == '1'):
$i = 0;
?>
<?
while ($row = mysql_fetch_array($risultato))
{
$i++;
//print_r($row);
$riga = "<tr height=25><td>$i</td><td align=\"left\">$row[0] </td><td align=\"left\">$row[1]</td><td width=\"50\" align=\"left\"> ";
echo "$riga";
format_date($row[2]);
print("</td></tr> ");
}
endif;
?>
</table>
</body>
</html>