Ciao a tutti sto cercando di modificare questa pagina php che in php 4 mi permetteva di inserire/modificare/eliminare news e fare l'upload di una immagine.

sono riuscita a sistemare le variabili per inserimento/modifica/elimina ma non riesco a capire come modificare il codice relativo alle immagini
qualcuno può darmi una manina?

grazie


il form
<td><input type=\"FILE\" name=\"file1\"></td>

codice file

codice:
  

if (isset($aggiungi)) {

$ora=date("d-m-Y", time());


if(($file1_name!="") && ((substr($file1_name, -3) == "jpg") || (substr($file1_name, -3) == "gif"))) {



$temp_file = $_FILES[$file1]['tmp_name'];
$file_name = $_FILES[$file1]['name'];
$file_size = $_FILES[$file1]['size'];



$file1_name=str_replace("-","c","$file1_name");


$file1_name=strtolower($file1_name);



$temp_file = $_FILES[$file1]['tmp_name'];
$file_name = $_FILES[$file1]['name'];
$file_size = $_FILES[$file1]['size'];
$ore=date("H");
$min=date("m");
$sec=date("s");



$file_dir = "$path/img_news";
$file1_name=strtolower($file1_name);
if(substr($file1_name, -3) == "jpg") {
$date=date("dmYHi", time());
$temp1=$date.$file1_name;



move_uploaded_file ($file1, "$path/img_news/temp/$temp1") or die ("Impossibile uplodare il file sul server");

$size = getimagesize ("$path/img_news/temp/$temp1");


if($size[0]<="550") {

copy ("$path/img_news/temp/$temp1", "$path/img_news/$temp1") or die ("Impossibile copiare il file sul server");



} else {

$new_w=550; 

	$new_h=$new_w*$size[1]/$size[0];

	$src_img = imagecreatefromjpeg ("$path/img_news/temp/$temp1"); 

	$dst_img = ImageCreateTrueColor($new_w,$new_h); 

	ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img)); 

	$copy = imagejpeg ($dst_img,"$path/img_news/$temp1",550);

	
}


$new_w=133; 

	$new_h=$new_w*$size[1]/$size[0];

	$src_img = imagecreatefromjpeg ("$path/img_news/temp/$temp1"); 

	$dst_img = ImageCreateTrueColor($new_w,$new_h); 

	ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img)); 

	$copy = imagejpeg ($dst_img,"$path/img_news/small/$temp1",70);

	imagedestroy($src_img);

}



$file1_name=strtolower($file1_name);

if(substr($file1_name, -3) == "gif") {

$date=date("dmYHi", time());

$temp1=$date.$file1_name;



move_uploaded_file ($file1, "$path/img_news/temp/$temp1") or die ("Impossibile uplodare il file sul server");



$size = getimagesize ("$path/img_news/temp/$temp1");



if($size[0]<="550") {



copy ("$path/img_news/temp/$temp1", "$path/img_news/$temp1") or die ("Impossibile copiare il file sul server");



} else {

$new_w=550; 

	$new_h=$new_w*$size[1]/$size[0];

	$src_img = imagecreatefromgif ("$path/img_news/temp/$temp1"); 

	$dst_img = ImageCreate($new_w,$new_h); 

	ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img)); 

	$copy = imagejpeg ($dst_img,"$path/img_news/$temp1",550);

	



}



$new_w=133; 

	$new_h=$new_w*$size[1]/$size[0];

	$src_img = imagecreatefromgif ("$path/img_news/temp/$temp1"); 

	$dst_img = ImageCreate($new_w,$new_h); 

	ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img)); 

	$copy = imagejpeg ($dst_img,"$path/img_news/small/$temp1",70);

	imagedestroy($src_img);

}

unlink("$path/img_news/temp/$temp1");

}



$date=time();



$query = "INSERT INTO news ( data, titolo, descrizione, foto, date)

values ('$data','$titolo', '$descrizione', '$temp1', '$date')";

mysql_query($query, $db);



$search = "SELECT * from news order by id DESC";

$query = mysql_query($search);

$numero= mysql_num_rows($query);



$numpag=$numero/8;

settype($numpag, integer);

$div=$numero % 8;

if ($div!=0 && $numero!=0) {

$numpag++;

}



if ($limita=="") {

$limita=0;

}

$search = "SELECT * from news order by id DESC LIMIT $limita,8";

$query = mysql_query($search);

while ($data = mysql_fetch_array($query)) {