Spulciando un po a destra e manca sono arrivato a questa soluzione ma non funge?
Codice PHP:
<?
include_once("include/config.php");
include_once("include/auth.lib.php");
include_once("include/reg.lib.php");
include_once("include/gd.php");
include_once("include/function.php");
list($status, $user) = auth_get_status();
if ($status == AUTH_LOGGED){
if ((isset($_GET["id"])) AND ($prof = get_profilo($user["id_user"]))){
?>
<?
if ((isset($_POST["act"])) AND ($_POST["act"] == "ok")){
$size = "800000"; //What do you want size limited to be if there is one
$id = $_POST["id_user"];
//all image types to upload
$cert1 = "jpg"; //Jpeg type 1
$cert2 = "jpeg"; //Jpeg type 2
$cert3 = "gif"; //Gif type
//percorso della cartella dove mettere i file caricati
$uploaddir = '../community/public/utenti/';
$uploaddir_thumb = '../community/public/thumb/';
//Recupero il percorso temporaneo del file
$userfile_tmp = $_FILES['Foto']['tmp_name'];
//recupero il nome originale del file caricato
$userfile_name = $_FILES['file']['name'];
if ($userfile_name == "") {
echo "<div class='grassettoarancio' align='center'>
Nessun file selezionato.
</div>
";
}else{
$ext = explode('.', $userfile_name);
$pos = sizeof($ext) - 1;
$userfile_name = $id.'.'.$ext[$pos];
$userfile_type = $ext[$pos];
$img1_size = $_FILES['file']['size'];
list($w,$h) = dimimage($userfile_tmp);
if (($img1_size > $size) OR ($w > 1024) OR ($h > 1024)) {
echo "<div class='grassettoarancio' align='center'>
Il file ha una dimensione troppo grande.
</div>
";
}else{
//Checks if file is an image
if (($userfile_type != $cert1) AND ($userfile_type != $cert2) AND ($userfile_type != $cert3)){
echo "<div class='grassettoarancio' align='center'>
Il File non ha un'estensione consentita.
</div>";
}else{
//Cancella foto vecchia
if(($_POST["foto"]!="")AND(file_exists($uploaddir.$_POST["foto"]))){
unlink($uploaddir.$_POST["foto"]);
unlink($uploaddir_thumb.$_POST["foto"]);
}// FINE IF CANCELLAZIONE FILE
//copio il file dalla locazione temporanea alla mia cartella upload
if (move_uploaded_file($userfile_tmp, $uploaddir . $userfile_name))
{
//Se l'operazione è andata a buon fine...
//echo $uploaddir.$userfile_name." ".$uploaddir."thumb/".$userfile_name;
thumb($uploaddir.$userfile_name,$uploaddir_thumb.$userfile_name,100);
echo "<div class='grassettoarancio' align='center'>
Foto caricata!!!
</div>";
$sql="update utenti set foto = '$userfile_name' where id = $id";
$result = rs_comm($sql);
}
else
{
//Se l'operazione è fallta...
echo "<span class='messaggi' align='center'>
Operazione Fallita!!!
</span>";
//print_r($_FILES);
}
}
}
}
}else{
$sql= "SELECT Foto FROM utenti WHERE id = ".$_GET["id"]."";
$result = rs_select($sql);
$rs = mysql_fetch_array($result);
?>
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="0" class="sezcenter">
<tr>
<td height="20" class="blu"><span class="grassettoarancio">Modifica
logo </span></td>
</tr>
<tr>
<td><form action="" method="post" enctype="multipart/form-data" name="form1" id="form1">
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td>Logo Attuale:</td>
<td align="center">
<?
if ($rs["foto"] != ""){
list($wt,$ht) = dimimage('../community/public/thumb/'.$rs["foto"]);
list($w,$h) = dimimage('../community/public/utenti/'.$rs["foto"]);
$w = $w + 20;
$h = $h + 90;
echo "<a href=\"javascript:popUpWindow('../view_foto.php?file=".$rs["foto"]."', '50', '50', '$w', '$h')\" >[img]../community/public/thumb/".$rs["foto"]."[/img]</a>";
}else{
echo "[img]../community/public/thumb/empty.gif[/img]";
}
?>
<input name="logo" type="hidden" value="<? echo $rs["foto"]; ?>" />
</td>
</tr>
<tr>
<td colspan="2" class="trattoGiallo"></td>
</tr>
<tr>
<td>File:</td>
<td><input name="file" type="file" id="file" size="35" /></td>
</tr>
<tr>
<td colspan="2" class="trattoGiallo"></td>
</tr>
<tr>
<td></td>
<td align="right"><input name="id_ass" type="hidden" id="id_ass" value="<? echo $_GET["id"];?>" />
<input name="act" type="hidden" id="act" value="ok" />
<input name="imageField2" type="image" src="../img/tasto_modifica.gif" width="64" height="13" border="0" />
</td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td height="20" class="blu"></td>
</tr>
</table>
<? } ?>
<?
}
}else{
header("Refresh: 3;URL=home.php");
echo '<div align="center">NON Sei connesso ... ... </div>';
}
?>
sapreste indicarmi dove sbaglio ? Grazie