Arkadaslar php kod yazmaya calistim ama pek olmasi gerektigi gibi calismiyor. php ile dosya sildirmek istedigimde istedigim dosyayi degilde sayfanin basindaki ilk dosyayi siliyor. bu hatayi nasil düzeltebilirim. lütfen yardimlariniza ihtiyacim var.

echo '<div style="margin:0 auto;width:850px;text-align:center;"><br />';
$i = 0;
	$uploaddir = 'dosyalar/';
	$handle = opendir($uploaddir);
while(false!==($file = readdir($handle))) {
	if ($file != "." && $file != ".." && $file) {
		if(isset($_GET['del'])){@unlink("$uploaddir$file");
			echo '<p>(<strong>'.$file.'</strong>) dosyas&yacute; ba&thorn;ar&yacute;yla silinmi&thorn;tir. Lütfen sayfay&yacute; güncelleyiniz.</p><br />';exit;}

		echo '<p style="margin:2px;float:left;border:1px solid #000;"><img src="'.$uploaddir.$file.'" width="100" height="100" border="0" alt="'.$file.'"><br />
			<a href="'.$_SERVER['SCRIPT_NAME'].'?del='.$file.'" target="_self">Sil</a></p>';$i++;}
}
	closedir($handle);
echo '</div>';