<?php



session_start();



include("include/connect.inc.php");



include("include/function.php");







if(empty($_SESSION['user']) || empty($_SESSION['time'])) {



echo "Non sei loggato! ";
print("<a href=home.php>
inserisci password </a>");
print("<a href=index.html>
torna alla home </a>");



exit();



}





include("include/header.php");



?>



<table width="100%" border="0" cellspacing="0" cellpadding="9">



<tr>



<td width="15%" valign="top">

<?php echo $admin_panel; ?>



<?php include("include/menu.php"); ?>



</td>



<td width="85%" align="left" valign="top">



<?php







//seleziono la squadra



$q_squadra = @mysql_query("SELECT $societa.*, $utenti.*, $ingaggi.*, $giocatori.*



FROM $utenti



INNER JOIN $societa ON $societa.id_utente = $utenti.id



INNER JOIN $ingaggi ON $ingaggi.id_societa = $societa.id



INNER JOIN $giocatori ON $giocatori.matricola = $ingaggi.id_giocatore



WHERE $utenti.id = $_SESSION[user] ORDER BY $giocatori.nome_non_reale"



) or die(mysql_error());

$q_bud = @mysql_query("SELECT * FROM $societa WHERE id_utente = $_SESSION[user]") or

die(mysql_error());

$row_bud = mysql_fetch_assoc($q_bud);



$q_logo = @mysql_query("SELECT * FROM $societa WHERE id_utente = " . $_SESSION['user'] . "") or



die(mysql_error());



$row_logo = @mysql_fetch_assoc($q_logo);







if($row_logo['logo'] != "")



{



$logo = "<img src=\"img/club/$row_logo[logo]\" alt=\"squadra\" >";



} else {



$logo = "";



}







vedi_scambi($_SESSION['user']);

offerte($_SESSION['user']);















echo "



<table width=\"400\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\" class=\"nome_squadra\">



<tr>



<td width=\"17\">" . $logo . "</td>



<td nowrap=\"nowrap\">" . $row_logo['nome'] . "</td>



</tr>



</table>";







echo "



<table width=\"80%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">



<tr>



<td width=\"12%\"></td>



<td width=\"88%\">



<table width=\"500\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\" class=\"nome_squadra\">



<tr>



<td colspan=\"2\">



<table width=\"400\" height=\"20\" border=\"0\" cellpadding=\"7\" cellspacing=\"5\" class=\"tab_cont\">



<tr>



<td align=\"center\" valign=\"middle\" class=\"back_g\">Matricola</td>



<td width=\"150\" align=\"center\" class=\"back_g\">Giocatore</td>



<td align=\"center\" class=\"back_g\">Costi</td>



</tr>";







while($row = mysql_fetch_assoc($q_squadra))



{



if($row['costo'] == 0) $row['cost'] = "-";



echo "



<tr>



<td width=\"10%\" class=\"back_g2\" align=\"center\">" . $row['matricola'] . "</td>



<td class=\"back_g2\" align=\"center\" nowrap=\"nowrap\"><a href=\"dettagli.php?matricola=" . $row['matricola'] . "\" class=\"back_g2\">" . $row['nome_reale'] . "</a></td>



<td width=\"10%\" class=\"back_g2\" align=\"center\">" . $row['costo'] . "</td>



</tr>";

$row_bud['fondi'] -= $row['costo'];

}



$q_up = @mysql_query("UPDATE $societa SET fondi = $row_bud[fondi] WHERE id_utente = $_SESSION[user]") or

die(mysql_error());



echo "

<tr>

<td></td>

<td align=\"right\"><font style=\"font-size: 11px;\">Budget rimanente:</font></td>

<td class=\"back_g2\">$row_bud[fondi]</td>

</tr>



</table>



</td>



</tr>



</table>



</td>



</tr>



</table>";



?>



</td>



</tr>



</table>



<?php include("include/footer.php"); ?>