FRIHOST • FORUMS • SEARCH • FAQ • TOS • BLOGS • COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


double-entry issue





gerimter
record is added to the database ,id 1 empty 2 normal
What is the problem?
Code:
<? if(!isset($_GET['islem']))  {  ?>

<form action="?islem=ekle" method="post" enctype="multipart/form-data" name="form1" id="form1">
  <strong>ETKİNLİĞİN ADINI  GİRİNİZ          </strong>         
          <tr><td width="131">&nbsp;</td>
              <td width="190"><label for="yazi"></label>
                  <label for="yazi"></label>
                  <p>
                   <input name="yazi" type="text" id="textarea" value="
    " size="100" />
                </p>
            <p><strong>DETAYI  GİRİNİZ</strong></p></td>
<tr>
             
  <td height="55">&nbsp;</td>
  <script type="text/javascript" src="tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">

</script>
<tr>
  <table width="995" border="1">
      <tr>
        <td width="206" height="236"><textarea id="detay" name="detay" rows="10" cols="30" style="width: 30%"></textarea></td>
        <td width="306"><p>500X350 Resim
          <input type="file" name="dtresim1" id="dtresim1" />
          </p>
          <p>200x150
            Resim
<input type="file" name="resim" id="resim" />
          </p>
          <p>200x150
            Resim
  <input type="file" name="dtresim2" id="dtresim2" />
          </p>
<p>200x150
  Resim
  <input type="file" name="dtresim3" id="dtresim3" />
          </p>
<p>
  <input type="submit" name="button" id="button" value="EKLE" />
</p></td>
        <td width="403"><p><a href="guncel.php" target="_blank"><strong>ilk 5 Haberi manşete bas</strong></a><a href="../admin/guncel.php"></a></p>
        <p class="style3">Ansayfada ilk 5 haberi yayınlamak i&ccedil;in yukarıyı kullanınız.</p>
        <p class="style3">Aksi takdirde manşette g&ouml;z&uuml;kmeyecektir.</p></td>
      </tr>
    </table>
<tr>
<tr>
  <tr>
   
  </tr>
         
         </tr>
 
  <tr> </tr>
</form>
    <?
}else{
   
$kaynak      =$_FILES["resim"]["tmp_name"]; // Yüklenen Dosyanın Adı;
$klasor      ="../banner_images/"; // Hedef Klasor
$adi      =$_FILES["resim"]["name"]; // Dosyanın PCdeki Adı
$tipi      =$_FILES['resim']['type']; // Dosyanın Tipi
$uzanti      =substr($adi,-4); // Dosya Uzantısı
$rnd      =substr(uniqid(md5(rand())), 0,20); // Dosyayı Yeden İsimlendiriyoruz.
$yeniisim   ="$rnd$uzanti";
$yukle      =$klasor.basename($adi);

   if(move_uploaded_file($kaynak,$yukle)){

   $imgg1=resimYukle($klasor,$adi,$tipi,500,350,"500X250-".$yeniisim);
   
   $ben=$imgg1;

     $sen= "banner_images/$ben" ;
      $son=$sen;
   echo "$son" ;
   //$imgg2=resimYukle($klasor,$adi,$tipi,200,150,"200X150-".$yeniisim);

   
   //echo "Birinci Resim : <br> <img src='/banner_images/".$imgg1."' />";
   
   
   unlink("".$klasor."$adi"); // Yüklemiş Olduğumuz Resmi Siliyoruz
}else{
      echo "Resim Yükleme Hatası";
   }

}

$a = date("H:i:s");
$tarih = date("d /m/y")."-".$a;
mysql_query("SET COLLATION_CONNECTION = 'latin5_turkish_ci'");
$query = mysql_query("SELECT MAX(id) FROM `banner`");
$results = mysql_fetch_array($query);
#$cur_auto_id = $results['MAX(id)'] + 1;
 $rst = mysql_query("SHOW TABLE STATUS LIKE 'banner'");
$ad=  mysql_result($rst,0,"auto_increment");
$url="../sayfalama/makaleler.php?id= $ad";
mysql_query("SET COLLATION_CONNECTION = 'latin5_turkish_ci'");
 echo "yeni mysql öncesi" ;


 $yerlestir=mysql_query("INSERT INTO banner( `id` , `yazi` , `detay` , `url` , `resim`, `dtresim1`, `dtresim2`,`dtresim3`,`tarih`) VALUES ( NULL , '".$_POST['yazi']."','".$_POST['detay']."','".$url."' ,'".$son."','".$dtresim1."','".$dtresim2."','".$dtresim3."','".$tarih."');");
 
  ?>
</body>
</html>


<br />
<br />
Fire Boar
For starters, you should fix the SQL injections. Never put $_POST directly into a query string, you need to do validation and escaping first. Also, check that your table has the auto_increment set on the ID field.
Related topics
what do you like to do
[Official]Wii
WinXP to Linux Instead of Windows 7
points deducted?
751 Useful Windows XP Files
Frankfurt Motor Show, 2005
State your Political Philosophy! (1000 FRIH$ to the best!)
When Jesus was born...
A question for all you monotheists.
Intelligent Design - Science or Religion?
Cannot open folder in same window
exchange email distribution list error
Entry And Double Dash Control
FCC requires VoIP to clean up its 911 act
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.