Current Path : /web/htdocs/www.entinoprofit.org/home/database/
Upload File :
Current File : /web/htdocs/www.entinoprofit.org/home/database/lista_referenti.php

<?php
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 ($user["username"] == 'acsi'){

if(isset($_POST['addreferente'])) {

$date = date('Y-m-d');
$queryInsert = "INSERT INTO referente (idclub,nome,cognome,indirizzo,mail,tel,progetto,note,regdate) VALUES
('".$_POST['idclub']."','".$_POST['nome']."','".$_POST['cognome']."','".$_POST['indirizzo']."','".$_POST['mail']."','".$_POST['tel']."','".$_POST['progetto']."','".$_POST['note']."','".$date."')";
$resultInsert = mysql_query($queryInsert) or die (mysql_error());


}

if(isset($_POST['modreferente'])) {


$queryInsert = "UPDATE referente SET idclub = '".$_POST['idclub']."', nome = '".$_POST['nome']."', cognome = '".$_POST['cognome']."', indirizzo = '".$_POST['indirizzo']."', mail = '".$_POST['mail']."',tel = '".$_POST['tel']."',
progetto = '".$_POST['progetto']."',note = '".$_POST['note']."' WHERE id = '".$_POST['id']."'";
$resultInsert = mysql_query($queryInsert) or die (mysql_error());


}

if (isset($_POST['e-postmain']))
{
	while(list($key, $val) = each($_POST["delete"])) 
		{ 
    if($val == 'del')
        $deleteIds[] = $key;
	$delmail = "DELETE FROM referente WHERE id='$key'";
	$delres = mysql_query($delmail) or die("Query 1 failed");
	
	} 

}	

$inSospeso = $_GET['inSospeso'];

if($inSospeso == 1) {

$query = "SELECT * FROM referente WHERE idclub = 0";

} else {

$query = "SELECT * FROM referente WHERE idclub != 0";

}
$risultato = mysql_query($query) or die("Query 1 failed");
}

?>
<!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="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"> 
<table width="100%" class="table2">
  <!--DWLayoutTable-->
  <tr>
    <td height="22" colspan="25" valign="center">
      <div align="center">Lista referenti 
	  
	  </div></td>
  </tr></table>
<form name="modulo" id="modulo" method="post" action="lista_referenti.php">
  <table width="100%" class="table2">
    <!--DWLayoutTable-->
	<thead>
		<tr><th height="20">ID</th>
 <th height="20">Cognome</th>
 <th height="20">Nome</th>
 <th height="20">Progetto</th>
 <th height="20">Mail</th>
 <th height="20">Tel</th> 
 <th height="20">Data</th>
 <th height="20">Club</th>
 <TH height="20"></TH>
</tr></thead> 
<?php
while ($array = mysql_fetch_array($risultato, MYSQL_BOTH)) { 

echo "<tr valign='middle'>";

echo "<td height='20' class='form'><a href='modreferente.php?id=".$array['id']."' >".$array['id']."</a></td>
<td valign='middle' class='form'><a href='viewreferente.php?id=".$array['id']."' >".$array['cognome']."</a></td>
 <td valign='middle' >".$array['nome']."</td>
<td valign='middle' >".$array['progetto']."</td>
 <td valign='middle' >".$array['mail']."</td></a>
 <td valign='middle' >".$array['tel']."</td>
 <td valign='middle'>".$array['regdate']."</td>
 <td valign='middle' >";
 
 if($array['idclub'] != '0') {
 
 	$queryClub = "SELECT id,username,name FROM utenti WHERE id = ".$array['idclub']."";
	$resultClub = mysql_query($queryClub) or die (mysql_error());
	$arrayClub = mysql_fetch_array($resultClub, MYSQL_BOTH);
 
 	echo "<a href='schedaclub.php?club=".$arrayClub['username']."' target='_blank'>".$arrayClub['name']."</a>";
 
 } else {
 
 echo "<img src='images/add.png'><a href='affiliazione_ins.php?idreferente=".$array['id']."' target='_blank'>Crea club</a>";
 
 
 }
 echo "</td><TD><input type='checkbox' name='delete[".$array['id']."]' value='del'  ></TD></tr>";
}
?>

</table>
<input type="submit" name="e-postmain" value="Cancella referenti" >
<input type="submit" name="e-sendmail" value="Invia mail" onclick="document.modulo.action='mail.php';">
</FORM>

</div> 
</body>
</html>
<?php } ?>