<?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:
?>
<!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">
<SCRIPT language="javascript">
function PrintBtnClicked(nomeclub,email,socio,datareg)
{
var DymoAddIn, DymoLabel;
DymoAddIn = new ActiveXObject('DYMO.DymoAddIn');
DymoLabel = new ActiveXObject('DYMO.DymoLabels');
var etichetta = nomeclub+' - '+email+'\n'+socio+'\n'+datareg+'\nACSI - Tel. 0497801907 - www.acsipadova.it';
if (DymoAddIn.Open('C:\\Documents and Settings\\All Users\\Documenti\\DYMO Label\\Label Files\\Indirizzo mittente (11352).LWL'))
{
DymoLabel.SetAddress(1,etichetta);
DymoAddIn.Print(1, true);
}
else if (DymoAddIn.Open('C:\\Program Files\\DYMO Label\\Label Files\\Address (30252, 30320).LWL'))
{
DymoLabel.SetAddress(1,etichetta);
DymoAddIn.Print(1, true);
}
else if (DymoAddIn.Open('C:\\Program Files\\Dymo Label\\Label Files\\Address (30252, 30320).LWT'))
{
DymoLabel.SetAddress(1,etichetta);
DymoAddIn.Print(1, true);
}
else
alert('Attenzione: sembra che non sia stata correttamente installata la stampante DYMO LabelPrinter 400!');
}
</SCRIPT>
</head>
<body>
<table width="100%" class="table1">
<!--DWLayoutTable-->
<tr>
<td height="20" colspan="9"><div align="center">Database ACSI Comitato Provinciale di Padova</div></td>
</tr>
<tr>
<td height="20"></td>
</tr>
<tr>
<td height="20" colspan="9"><div align="center"><?php include('in.php'); ?></div></td>
</tr>
</table>
<div id="main">
<div class="alert">
<form name="form" method="get" action="">
Cognome <input name="cognome" type="text" id="cognome" value="<?php if(!empty($_GET['cognome'])) echo "$cognome"; ?>">
Nome <input name="nome" type="text" id="nome" value="<?php if(!empty($_GET['nome'])) echo "$nome"; ?>">
<input type="submit" name="search" value="Cerca un socio">
</form>
<?php if (isset($_GET['search'])) { ?>
</div>
<table width="100%" class="table3">
<!--DWLayoutTable-->
<thead>
<tr><th height="20">ID</th>
<th height="20">Cognome</th>
<th height="20">Nome</th>
<th height="20">Club</th>
<th height="20">Documento</th>
<th height="20">Data Reg.</th>
<th height="20"></th>
<th height="20"></th>
<th width="20px"></th>
</th>
</tr></thead>
<?php
$cognome = '%';
if(!empty($_GET['cognome'])) {
$cognome = $_GET['cognome'];
}
$query = "SELECT * FROM socio WHERE cognome LIKE '%$cognome%' ";
$nome = '%';
if(!empty($_GET['nome'])) {
$nome = $_GET['nome'];
$query .= "AND nome LIKE '%$nome%' ";
}
if ($user['admin'] != '1') {
$query .= "AND club = '".$user['username']."' ORDER BY cognome ASC,nome ASC";
} else {
$query .= "ORDER BY cognome ASC ,nome ASC";
}
$risultato = mysql_query($query) or die(mysql_error());
$num_rows = mysql_num_rows($risultato);
while ($array = mysql_fetch_array($risultato, MYSQL_BOTH)) {
echo "
<tr >
<td valign='top'><a href='modsocio.php?id=".$array['id']."' >".$array['id']."</a></td>
<td valign='top'>".strtoupper($array['cognome'])."</td>
<td valign='top'>".strtoupper($array['nome'])."</td>
<td valign='top'>".strtoupper($array['club'])."</td>
<td valign='top'>".$array['numdoc']." ".$array['datadoc']."</td>
<td valign='top'>".$array['regdate']."</td>
<td><input type='checkbox' name='delete[".$array['id']."]' value='del'></td>
<td><a href='schedasocio.php?id=".$array['id']."'><img src='images/info.gif' border='0' alt='Vai alla scheda del socio'></a></td>
<td><a href=\"javascript:PrintBtnClicked('".$nome_club."','".$mail_club."','".strtoupper($array['nome'])." ".strtoupper($array['cognome'])."','".$data."');\"><img src=\"images/dymo.jpg\" border=\"0\" alt=\"Etichetta\"></a></td>
</tr>";
}
?>
</table>
<?php } ?>
</div>
</body>
</html>
<?php
break;
case AUTH_NOT_LOGGED:
header("Refresh: 0;URL=index.php");
break; } ?>