azegurb 1 Posting Whiz in Training

hi all I took PHP news script from Turkish site
it is good news script but it has a little disadvantages
for example i fill all regurired fields and submit
it shows first recently added news and picture one in a large format and one in a little format
but when i want to add news without image it adds but instead of image it puts X sign so that image not found lke so
i would like it will return this like news without image no X sign
i translated it from Turkush into English so that you understand it.
Finally i would like you advance it a bit. if possible
here below i will post all code of this script

CREATE TABLE `news` ( 

`no` int( 11 ) NOT NULL AUTO_INCREMENT ,
`baslik` varchar( 250 ) NOT NULL ,
`ozet` varchar( 250 ) NOT NULL ,
`aciklama` text NOT NULL ,
`kucukresim` varchar( 80 ) NOT NULL ,
`resim` varchar( 250 ) NOT NULL ,
`aktif` varchar( 6 ) NOT NULL ,
PRIMARY KEY ( `no` )
) ENGINE = MYISAM DEFAULT CHARSET = latin1;

connect.php

<?php
  $connect=@mysql_connect("localhost","username","pass") OR die ("mysql error");
  @mysql_select_db("news")or die ("database not found");
?>

image_add.php

<?php
  function resample($image,$max_width,$max_height) 
     { 

     # Icerik icin kesi baslat ... 
     ob_start(); 

     # Ilk heightutlar 
     $boyuut = getimagesize($image); 
     $width    = $boyut[0]; 
     $height   = $boyut[1]; 

     # new heightutlar 
     $x_oran = $max_width  / $width; 
     $y_oran = $max_height / $height; 

     if (($width <= $max_width) and ($height <= $max_height)){ 
        $son_width  = $width; 
        $son_height = $height; 
        } 
     else if (($x_oran * $height) < $max_height){ 
        $son_width  = $max_width; 
        $son_height = ceil($x_oran * $height); 
        } 
     else { 
        $son_width  = ceil($y_oran * $width); 
        $son_height = $max_height; 
        } 

     # old ve new imageler 
     $old = imagecreatefromjpeg($image); 
     $new = imagecreatetruecolor($son_width,$son_height); 

     # old resmi newdwidth orneklwidthdir 
     imagecopyresampled( 
        $new,$old,0,0,0,0, 
        $son_width,$son_height,$width,$height); 

     # new resmi bas ve icerigi cek 
     imagejpeg($new,null,-1); 
     $icerik = ob_get_contwidthts(); 

     # imageleri yoket ve icerigi cikart 
     ob_widthd_clean(); 
     imagedestroy($old); 
     imagedestroy($new); 

     return $icerik; 

 }
?>

add_news.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
<title>Dahi Tasarim</title>
<script type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>

<body>
<p>
<? 
include("connect.php"); 
//include ("oturum_kontrol.php");	
//include ("yonetim_menu.php");
include ("image_add.php"); 
?>

</p>
<p style="font-size:24pt; color:#FF0000;">Haber Ekle </p>

<hr />
News :&nbsp;
<? // burada formdan POST metoduyla gelen bilgileri rahat kullanabilmek icin degiskenlere aktariyoruz

$no=$_POST[no];
$title=$_POST[title];
$subject=$_POST[subject];
$description=$_POST[description];
$aktiv=$_POST[aktiv];
$search=$_POST[search];
$show=$_POST[show];

// resim ayarlari burada
	$little_pic="little_pictures"; // open this directory
	$large_pic="large_pictures"; // and give permission chmod 777

	$large_pic_width=640;
	$large_pic_heigth=480;

	$little_pic_width=200;
	$little_pic_heigth=150;
	
	
	
//if ($resim)

?>
<?  if ($_POST[del])
{// if pressed del button
$query=mysql_query("select * from news where no='$no'");
while($row=mysql_fetch_row($query))
	//silecegimiz resimlerin yolunu almak icin sorgu cekiyoruz
	{ @unlink($row[4]); // kucuk resmi hdd den siliyoruz
		@unlink($row[5]); // buyuk resmi hdd den siliyoruz
	}

if (mysql_query("delete from news where no='$no'")) echo "news deleted";
else echo "not deleted";

}
?>
<? 
if ($_POST[edit])
{
// eger duzenle dugmesine basildiysa veritabanindan duzenlenmek istenen veriyi cekiyoruz 
// sonra form da bu bilgileri ekrana basýp degisitirilebilmesine mumkun kilacagiz...
$query=mysql_query("select * from news where no='$no'");
	while($row=mysql_fetch_row($query))
	{ 
	$no2=$row[0];
	$baslik2=$row[1];
	$ozet2=$row[2];
	$aciklama2=$row[3];
	$kucukresim2=$row[4];
	$resim2=$row[5];
	$aktif2=$row[7];
	}
}
?>
<? if($_POST["add"])
{ //echo "kayýta basýldý";
if(strlen($_FILES["image"]["name"])>4)
		{// eger resim varsa bu resmi turkce karakterlerden temizledikten sonra  
		 // resim ve  kucukresim olmak uzere iki tane resme donusturecegiz
		 // echo "resim devrede resim=$resim";
		$find=$_FILES["image"] ;
		$tobesearched = array('ç','Ç','ý','Ý','ð','Ð','ü','ö','Þ','þ','Ö','Ü',',',' ','(',')','[',']'); 
		$change  = array('c','C','i','I','g','G','u','o','S','s','O','U','','_','','','',''); 
	
		$_FILES["image"]=str_replace($tobesearched, $change, $find);

		$image = "$large_pic/".$_FILES["image"]["name"]; 	   
		move_uploaded_file($_FILES["image"]["tmp_name"],$image);
		
		$little_image  = "$little_pic/".$_FILES["image"]["name"];  
		move_uploaded_file($_FILES["image"]["tmp_name"],$little_image);

		
		// kucuk resmi boyutlandiriyoruz
		$prepare = resample($image,$little_pic_width,$little_pic_heigth); 
		$folder  = fopen ($little_image,"w+"); 
				   fwrite($folder,$prepare); 
				   fclose($folder); 
				   
		// buyuk resmi boyutlandiriyoruz
		$prepare = resample($image,$large_pic_width,$large_pic_heigth); 
		$folder  = fopen ($image,"w+"); 
				   fwrite($folder,$prepare); 
				   fclose($folder); 

		// resim boyutlandirma bitti
		
		}


if (!$no)
	{//yeni kayit yapilacaksa "insert into" ile yeni kaydi gerceklestirecegiz...
		
	if (mysql_query("insert into news values ('','$title','$subject','$description','$little_image','$image','$aktiv')"))
	{echo " done"; $image="";$little_image="";}
	else echo " not added";
	
	}
else 
{ // kayit dugmesine duzenleye basildiktan sonra basildiysa duzenleme yapacagiz
	if ($image) $imageadd=",image='$image',littleimage='$little_image'";
	if (mysql_query("update  news set title='$title',subject='$subject',description='$description',aktiv='$aktiv' $imageadd where no='$no'"))
	{echo " done"; $image="";$little_image="";}
	else echo " not added ";
	}
}
?>
<hr />

<form id="form1" name="form1" method="post" action="">
 c urrent news :
  <label>
  <select name="no" id="no">
  <?
  $query=mysql_query("select * from news order by no desc");
while($row=mysql_fetch_row($query))
{
echo "<option value='$row[0]'>$row[1]</option>";
}
  ?>
    
  </select>
  </label>
  <label>
  <input name="edit" type="submit" id="edit" value="edit" />
  </label>
  <label>
  <input name="del" type="submit" id="del"  value="del" />
  </label>
  <label></label>
</form>
<hr />
<form id="form2" name="form2" method="post" action=""   enctype="multipart/form-data">
  <table width="800" border="1" cellspacing="5" cellpadding="0">
    <tr>
      <td width="129">no 
      <input name="no" type="hidden" value="<? echo $no2; ?>" /></td>
      <td width="650"><label></label>	  </td>
    </tr>
    <tr>
      <td>image
 <? if($little_image2)
 // eger duzenleye basýldýysa ekrana veritabanýnda kayýtlý olan resmi basýyoruz...
 // yei sayfaya gonderdigimizde bilgiler kaybolmamasi icin "type=hidden" ile bilgi tasiyoruz
 // boylece ekranda gorunmuyor...
{echo "<img src=$little_image2 align=right><br />";
//echo "<input name='kucukresim' type='hidden' id='kucukresim' value='$kucukresim2' />";
}
?>
</td>
      <td>   <label>
      <input name="image" type="file" id="image" />
      </label></td>
    </tr>
    <tr>
      <td>title </td>
      <td><input name="title" type="text" id="title" value="<? echo $title2;?>" size="100" /></td>
    </tr>
    <tr>
      <td>subject</td>
      <td><input name="subject" type="text" id="subject" value="<? echo $subject2;?>" size="100" /></td>
    </tr>
    <tr>
      <td>description</td>
      <td><label>
        <textarea name="description" cols="80" rows="5" id="is"><? echo $description2;?></textarea>
      </label></td>
    </tr>
    <tr>
      <td>Aktiv</td>
      <td><label>
        <input <?php if ($aktiv2=="aktiv") {echo "checked=\"checked\"";} ?>  name="aktiv" type="radio" value="aktiv" checked="checked" />
     activate
      <input <?php if ($aktiv2=="pasiv") {echo "checked=\"checked\"";} ?>  name="aktiv" type="radio" value="pasiv" />
      passivate</label></td>dffdg
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input name="edit" type="submit" id="edit" value="edit" />
        <label>
        <input name="search" type="submit" id="search" value="search" />
        <input name="show" type="submit" id="show" value="show all news" />
        </label></td>
    </tr>
  </table>
</form>

<p>&nbsp;</p>
<? 
if (($search) || ($show))
{
if ($search)
{
if ($title) $query=mysql_query("select * from news where title like '%$title%'");
if ($subject) $query=mysql_query("select * from news where subject like '%$subject%'");
if ($description) $query=mysql_query("select * from news where description like '%$description%'");
}
 if ($show)
{
$query=mysql_query("select * from news order by no desc");
}
echo "<table border=1>
<tr>
<td>edit</td>
<td>del</td>
<td>No</td>
<td>baslik</td>
<td>subject</td>
<td>description</td>
<td>littleimage</td>
<td>aktiv</td>
</tr>";
while($row=mysql_fetch_row($query))
{echo "
<tr><form action=\"\" method=\"post\"><input name=\"no\" type=\"hidden\" value=\"$row[0]\">

<td><input name=\"edit\" type=\"submit\" value=\"edit\">	</td>
<td><input name=\"del\" type=\"submit\" value=\"del\"></td>

<td>$row[0]&nbsp;</td>
<td>$row[1]&nbsp;</td>
<td>$row[2]&nbsp;</td>
<td>$row[3]&nbsp;</td>
<td><img src=$row[4]>&nbsp;</td>
<td>$row[6]</td>
</form>	</tr>";
}
echo "</table>";
}
?>
</body>
</html>

index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
<title>Dahi Tasarim . CoM</title>
<style type="text/css">
<!--
a:link {
	color: #0066FF;
	text-decoration: underline;
}
a:visited {
	text-decoration: underline;
	color: #0033CC;
}
a:hover {
	text-decoration: none;
	color: #FFFFFF;
}
a:active {
	text-decoration: underline;
}
-->
</style></head>

<body>

<? // baglan php yi yukluyoruz
include("connect.php"); 
// bu satýrda adres satýrýndan (GET metodu) no bilgisi gelmiþmi diye kontrol ediyoruz...
$no=$_GET["no"];
//eger $no yoksa demekki talep edilen bir newsin devami yok
//biz en son kaydi veritabanýndan cekiyoruz 
if (!$no)
{$query=mysql_query("select * from news where aktiv='aktiv' order by no desc limit 1");
}
else // eger $no varsa istenilen nolu newsi veritabanýndan cekiyoruz
{$query=mysql_query("select * from news where no='$no'");
}
while($satir=mysql_fetch_row($query))
{
$baslik=$satir[1];
$ozet=$satir[2];
$metin=$satir[3];
$kucukresim=$satir[4];
$buyukresim=$satir[5];
$metin=str_replace ("\n","<br />",$metin);
// \n br ile admin sayfasýnda aciklama kismina girdigimiz enterlari
// br ye cevirip alt satir yapiyoruz
}
?>






<table border="1" cellpadding="10" cellspacing="10" bordercolor="#666666" bgcolor="#CCCCCC">
  <tr>
    <td width="640" valign="top" bgcolor="#FFCC00"><img alt="" src="<?=$buyukresim; ?>" />
                              <div class="indent1">
                              	<h1><?=$baslik; ?> <span></span></h1>
    <p><?=$metin; ?></p></td>
    <td width="200" valign="top" bgcolor="#FF9900">

<? 

$query=mysql_query("select * from news where aktiv='aktiv' order by no desc limit 4");
// en son 4 newsi veritabanindan cekiyoruz
// baslik, kucuk resimleri ve ozetlerini ekrana basacagiz
while($satir=mysql_fetch_row($query))
{
$no=$satir[0];
$baslik=$satir[1];
$ozet=$satir[2];
$metin=$satir[3];
$kucukresim=$satir[4];
$buyukresim=$satir[5];
echo "
<p><a href='index.php?no=$no'>
<img alt='' src='$kucukresim' /><br><span>$baslik</span></a><br />$ozet
</p>";
// index.php?no=$no ile istenilen newse link olusturuyoruz
}
?></td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="#669933"><ul>
     
        <?
$query=mysql_query("select * from news where aktiv='aktiv' order by no desc limit 0,20");
// newslerin sadece basliklarini ekranda gosterip link verecegiz
while($satir=mysql_fetch_row($query))
{
$no=$satir[0];
$baslik=$satir[1];
echo "<li> <a href=index.php?no=$no>$baslik</a></li>";
}
?>
       
    </ul></td>
  </tr>
</table>
<? 
if ($query) mysql_free_result($query);
if ($connect) mysql_close($connect); 
?>
</body>
</html>

as a demo you can enter here aziko.6te.net/yukle/haber_ekle.php here you will add news and in order to see news you added go aziko.6te.net/yukle

i will wait your responses
thanks for attention