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/slider-guncelle.php
<?php
// Yönetici Kontrol dosyasını çağır
include ("include-panel/yonetici-kontrol.php");


// link ile gönderilen guncelle_id değişkenini $_GET ile çek. 
$guncelle_id  = $_GET["guncelle_id"];
$bilgiler     = mysql_fetch_array(mysql_query("select * from slider where slider_id='$guncelle_id' "));
$sira				= $bilgiler ["sira"];
$title				= $bilgiler ["title"];
$description		= $bilgiler ["description"];
$url				= $bilgiler ["url"];
$durum				= $bilgiler ["durum"];
$resim				= $bilgiler ["resim"]; 


if ($_POST ["button"]){
// botona basılmışsa Formdan bilgileri $_POST ile çek. 
$sira				= $_POST ["sira"];
$title				= $_POST ["title"];
$description		= $_POST ["description"];
$url				= $_POST ["url"];
$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">
<SCRIPT language=javascript>
	function textareaLimiter(field, countfield, maxlimit) {
		if (field.value.length > maxlimit) field.value = field.value.substring(0, maxlimit);
		else countfield.value = maxlimit - field.value.length;
	}
</SCRIPT>

</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>SLİDER GÜNCELLE</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>Sira No</strong></td>
                <td width="7" scope="col"><strong>:</strong></td>
                <td width="301" scope="col"><input name="sira" type="text" id="sira" value="<?php echo $sira;?>" size="20" maxlength="50">
                </td>
                <td align="right" scope="col">&nbsp;</td>
              </tr>
              <tr>
                <td><strong>Title </strong></td>
                <td><strong>:</strong></td>
                <td colspan="2"><input name="title" type="text" id="title" value="<?php echo $title;?>" size="43" maxlength="50"></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><img src="../resimler/slider-resimleri/<?php echo $resim; ?>" width="100" height="85"></td>
              </tr>
              <tr>
                <td><strong>Url</strong></td>
                <td><strong>:</strong></td>
                <td><input name="url" type="text" id="url" value="<?php echo $url;?>" size="25" maxlength="50"></td>
                <td>&nbsp;</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="Slider 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 (!$sira) {
						echo "sira no girin";
					} elseif (!$title) {
						echo "title girin";
					} elseif (!$description) {
						echo "Description gir";							
					} else {
						// Ürün güncelle başladı. Eger resim seçilmiş ise resimli güncelleme yapsın resim seçilmemiş ise resimsiz güncelleme yapsın
					if($resim_dizisi["name"]==""){
						//resimsiz güncelleme başladı
						
					$resimsiz_guncelle	= mysql_query("update slider set sira='$sira', title='$title', description='$description', resim='$resim', url='$url', durum='$durum' where slider_id='$guncelle_id' ");
						
						if($resimsiz_guncelle) {
							echo "ürün güncellendi <br>";
						}else {
							echo "Hata: Ürün güncellenmedi";
						}
						// resimsiz güncelleme bitti
					}else {
					// resimli güncelleme başladı
					// Ürüne güncelleme işleminden önce Resim adı, Ürün adı olarak değiştirilsin.
						$orjinal_resim	=  $resim_dizisi["name"]; //orjinal resim	
						
						$uzanti = substr($orjinal_resim,-4);//orjinal resim uxantısı
						$urun_adi_kucuk = mb_strtolower($orjinal_resim,"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;	
						
						$resimli_guncelleme	= mysql_query("update slider set sira='$sira', title='$title', description='$description', resim='$resim', url='$url', durum='$durum' where slider_id='$guncelle_id' ");
						
						if ($resimli_guncelleme) {
							echo "Ürün güncellendi";
							//ürün eklendi ise resmi upluad et.
							$kaynak = $resim_dizisi["tmp_name"];
							$hedef  = "../resimler/slider-resimleri/".$resim;
							$yukle  = move_uploaded_file($kaynak,$hedef);
							
							if ($yukle)   {
								echo "Resim yüklendi";
							} else {
								echo "HATA : Resim yüklenemedi";
							}

						} else {
							echo "HATA : Ürün güncellenemdi";
						}
			// Resimli güncelleme bitti
					}
					header("refresh:3;url=sliderler.php");						
							
					//--------------------------	
					}
				//--------------------------------------					
				}				
				?></td>
                <td>&nbsp;</td>
              </tr>
            </table>
          </form>
  </div>
</div>

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


</body>
</html>