HEX
Server: Apache
System: Linux host.hizmetvakfi.org 4.18.0-553.16.1.el8_10.x86_64 #1 SMP Thu Aug 8 07:11:46 EDT 2024 x86_64
User: sinanpasha (1007)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/sinanpasha/public_html/risale/yeni/bilpanel/urun-ekle.php
<?php
// Yönetici Kontrol dosyasını çağır
include ("include-panel/yonetici-kontrol.php");

// Formdan bilgileri $_POST ile çek. 
$kategori_id		= $_POST ["kategori_id"]; 
$urun_adi			= $_POST ["urun_adi"]; 
$aciklama			= $_POST ["aciklama"]; 
$description		= $_POST ["description"]; 
$fiyat				= $_POST ["fiyat"]; 
$durum				= $_POST ["durum"]; 

// Resim $_FILES ile çekilir ve bu bilgi bir dizidir. İçinde tmp_name, name_ size, type bilgileri vardır.
$resim_dizisi		= $_FILES ["resim"]; 

?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Bil Soft Eticaret - Yönetim Paneli - Ürün Ekle</title>
<link rel="stylesheet" type="text/css" href="css-panel/stiller.css">
<link rel="stylesheet" type="text/css" href="font-awesome/css/font-awesome.css">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">

</head>

<body>

<!-- ==================== Header Top ====================  -->
<?php
include("include-panel/header-top.php");
?>

<!-- ==================== Wrapper Top ====================  -->
<div id="wrapper" class="sablon_width">
  <?php
  include ("include-panel/header.php");
  ?>
  <div id="page_title">
    	<h1>ÜRÜN EKLE</h1>
    </div>
  <div id="page_content">
    <form action="" method="post" enctype="multipart/form-data" name="form1">
            <table width="800" border="0" align="center" cellpadding="5" cellspacing="5">
              <tr>
                <td width="143" scope="col"><strong>Kategori Adı</strong></td>
                <td width="7" scope="col"><strong>:</strong></td>
                <td width="301" scope="col">
                <select name="kategori_id" id="kategori_id">
                  <option value="Seç">Seç</option>
                  
				  <?php
				  $kategoriler = mysql_query("select * from kategoriler order by kategori_adi asc");
				  while ( $dizi = mysql_fetch_array($kategoriler)  ) {
					   
					  $kategori_adi	= $dizi ["kategori_adi"];
					  $kat_id		= $dizi ["kategori_id"];
					  
					  if ( $kategori_id == $kat_id ) {
						  $onay = " selected='selected' ";
					  } else {
						  $onay="";
					  }
					  
                  	echo "<option value='$kat_id' $onay>$kategori_adi</option>";
				  }
                  ?>
                
                </select></td>
                <td align="right" scope="col">&nbsp;</td>
              </tr>
              <tr>
                <td><strong>Ürün Adı</strong></td>
                <td><strong>:</strong></td>
                <td colspan="2"><input name="urun_adi" type="text" id="urun_adi" value="<?php echo $urun_adi;?>" size="50" maxlength="50"></td>
              </tr>
              <tr>
                <td valign="top"><strong>Açıklama</strong></td>
                <td valign="top"><strong>:</strong></td>
                <td colspan="2">
                  
  <?php

// Include CKEditor class.

include("ckeditor/ckeditor.php");

$ckeditor = new CKEditor();

//ckeditor klasörümüz eğer klasörümüz aynıysa değiştirmeyelim

$ckeditor->basePath = 'ckeditor/';

//Ckfinder ile ilgili değişkenler eğer dosya ve klasör isimlerinde değişiklik yoksa aynen devam edelim

$ckeditor->config['filebrowserBrowseUrl'] = 'ckfinder/ckfinder.html';

$ckeditor->config['filebrowserImageBrowseUrl'] = 'ckfinder/ckfinder.html?type=Images';

$ckeditor->config['filebrowserImageUploadUrl'] = 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images';

//ckeditor temamız daha fazlası için ckeditor/skins klasörüne bakın

$ckeditor->config['skin'] = 'office2003';

//Editör genişlik değerimiz

$ckeditor->config['width'] = 700;

//aciklama name yine sahip textarea oluşturuyor

$ckeditor->editor('aciklama',$aciklama);

?>                
                  
                </td>
              </tr>
              <tr>
                <td valign="top"><strong>Description</strong></td>
                <td valign="top"><strong>:</strong></td>
                <td><textarea name="description" cols="45" rows="4" id="description" onkeyup="textareaLimiter(this.form.description,this.form.descLen,160);" onkeydown="textareaLimiter(this.form.description,this.form.descLen,160);"><?php echo $description;?></textarea></td>
                <td><input name="descLen" value="160" size="4" maxlength="3" readonly ></td>
              </tr>
              <tr>
                <td><strong>Resim</strong></td>
                <td><strong>:</strong></td>
                <td><input name="resim" type="file" id="resim" size="20"></td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><strong>Fiyat</strong></td>
                <td><strong>:</strong></td>
                <td><input name="fiyat" type="text" id="fiyat" value="<?php echo $fiyat;?>" size="25" maxlength="50"></td>
                <td><strong>1200.99</strong> (Kuruş kısmını Nokta ile ver)</td>
              </tr>
              <tr>
                <td><strong>Durum</strong></td>
                <td><strong>:</strong></td>
                <td><input name="durum" type="checkbox" id="durum" value="1" <?php if ( $durum==1 ) { echo ' checked="CHECKED" '; } ?> ></td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td><input type="submit" name="button" id="button" value="Ürün Ekle"></td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td><?php
                if ( $_POST ["button"] ) {
				// Butona basılmış ise kontrolleri yap
					if ($kategori_id == "Seç") {
						echo "Kategori seç";
					} elseif (!$urun_adi) {
						echo "Ürün adı gir";
					} elseif (!$aciklama) {
						echo "Açıklama gir";
					} elseif (!$description) {
						echo "Description gir";
					} elseif (!$resim_dizisi["name"]) {
						echo "Resim seç";
					} elseif (!$fiyat) {
						echo "Fiyat gir";
					} else {
					// Ürün ekle başladı
						// Ürüne ekleme işleminden önce Resim adı, Ürün adı olarak değiştirilsin.
		$orjinal_resim	= $resim_dizisi ["name"]; 
		$uzanti			= substr ($orjinal_resim,-4); 
		$urun_adi_kucuk	= mb_strtolower($urun_adi,"utf8"); 
		$bul			= array ("ö","ü","ğ","ş","ç","ı","/","+"," ");
		$degistir		= array ("o","u","g","s","c","i","","plus","-");
		$urun_adi_duzelt= str_replace($bul,$degistir,$urun_adi_kucuk);
		$resim			= $urun_adi_duzelt.$uzanti;
					
						$ekle	= mysql_query("insert into urunler set kategori_id='$kategori_id', urun_adi='$urun_adi', aciklama='$aciklama', description='$description', fiyat='$fiyat', resim='$resim', durum='$durum' ");
						
						if ($ekle) {
							echo "Ürün eklendi <br>";
							
							// Ürün Eklendi ise Resmi UPLOAD et.
							$kaynak		= $resim_dizisi ["tmp_name"];
							$hedef		= "../resimler/urun-resimleri/".$resim;
							$yukle		= move_uploaded_file($kaynak,$hedef);
							
							if ($yukle) {
								echo "Resim Yüklendi";
							} else {
								echo "HATA : Resim Yüklenemedi";
							}
							header("refresh:3;url=urunler.php");
						} else {
							echo "HATA : Ürün eklenemedi";
						}
							
					//--------------------------	
					}
				//--------------------------------------					
				}				
				?></td>
                <td>&nbsp;</td>
              </tr>
            </table>
          </form>
  </div>
</div>

<!-- ==================== Footer Bottom ====================  -->
<?php
include("include-panel/footer.php");
?>


</body>
</html>