<?php
session_start();
include_once("include/config.php");
include_once("include/auth.lib.php");
list($status, $user) = auth_get_status();
if($status == AUTH_LOGGED & auth_get_option("TRANSICTION METHOD") == AUTH_USE_LINK){
$link = "?uid=".$_GET['uid'];
}else $link = '';
switch($status){
case AUTH_LOGGED:
if(isset($_GET['club'])) {
$nomeclub = strtoupper($_GET['club']);
} else {
$nomeclub = strtoupper($user['name']);
}
$stagione = ($_GET['stagione'] == 'ind') ? '%' : $_GET['stagione'];
$from = isset($_GET['date1']) ? $_GET['date1'] : date("Y").'-01-01';
$to = isset($_GET['date2']) ? $_GET['date2'] : date("Y-m-d");
$club = isset($_GET['club']) ? $_GET['club'] : $user["username"];
$club = ($club == 'ind') ? '%' : $club;
$query = "SELECT s.cognome, s.nome, t.tessera, s.numdoc, s.datadoc, s.tel, s.cel, s.email,t.date FROM tessera t, socio s WHERE t.club LIKE '".$club."' AND t.date BETWEEN '$from' AND '$to' AND s.temp = '0' AND t.stagione LIKE '$stagione' AND t.idsocio = s.id ORDER BY t.date DESC";
$risultato = mysql_query($query) or die(mysql_error());
$num_rows = mysql_num_rows($risultato);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Database ACSI Comitato Provinciale di Padova</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" class="table5">
<!--DWLayoutTable-->
<tr>
<td height="20" colspan="9"><div align="center"><b>Database ACSI Comitato Provinciale di Padova - Lista Soci
<?php echo "$nomeclub dal ".ucfirst(strftime ("%d %B %Y", strtotime("$from")))." al ".ucfirst(strftime ("%d %B %Y", strtotime("$to"))).". (".$num_rows." soci)"; ?></b></div></td>
</tr>
</table>
<p></p>
<p></p>
<table width="100%" cellpadding="2px" class="table5">
<!--DWLayoutTable-->
<thead>
<tr>
<th width="5%" height="20">Tess.</th>
<th width="15%" height="20">Cognome</th>
<th width="15%" height="20">Nome</th>
<th width="20%" height="20">Documento</th>
<th width="5%" height="20">Telefono</th>
<th width="30%" height="20">Email</th>
<th width="5%" height="20">Data</th>
</th>
</tr></thead>
<?php
while ($array = mysql_fetch_array($risultato, MYSQL_BOTH)) {
echo "
<tr class='listaprint'>
<td class='listaprint' height='20' valign='middle'>".$array['tessera']."</td>
<td class='listaprint' valign='middle'>".strtoupper($array['cognome'])."</td>
<td class='listaprint' valign='middle'>".strtoupper($array['nome'])."</td>
<td class='listaprint' valign='middle'>".strtoupper($array['numdoc']." ".$array['datadoc'])."</td>
<td class='listaprint' valign='middle'>".strtoupper($array['tel'])."</td>
<td class='listaprint' valign='middle'>".$array['email']."</td>
<td class='listaprint' valign='middle'>".$array['date']."</td>
</tr>";
}
?>
</table>
</body>
</html>
<?php
break;
case AUTH_NOT_LOGGED:
header("Refresh: 0;URL=index.php");
break; } ?>