File: /home/sinanpasha/public_html/risale/yeni/bilpanel/slider-ekle.php
<?php
// Yönetici Kontrol dosyasını çağır
include ("include-panel/yonetici-kontrol.php");
//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 - Kategori 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 MANŞET EKLE</h1>
</div>
<div id="page_content">
<form action="" method="post" enctype="multipart/form-data" name="form1">
<table width="450" border="0" align="center" cellpadding="5" cellspacing="5">
<tr>
<td scope="col">Sira</td>
<td scope="col">:</td>
<td width="172" scope="col"><input name="sira" type="text" id="sira" value="<?php echo $sira;?>" size="25" maxlength="50"></td>
<td scope="col"> </td>
</tr>
<tr>
<td width="110" scope="col">Tite</td>
<td width="10" scope="col">:</td>
<td width="172" scope="col"><input name="title" type="text" id="title" value="<?php echo $title;?>" size="25" maxlength="50"></td>
<td width="93" scope="col"> </td>
</tr>
<tr>
<td>Description</td>
<td>:</td>
<td><textarea name="description" cols="25" 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>Resim Ekle</td>
<td>:</td>
<td><input type="file" name="resim" id="resim"></td>
<td> </td>
</tr>
<tr>
<td>Url</td>
<td>:</td>
<td width="172" scope="col"><input name="url" type="text" id="url" value="<?php echo $url;?>" size="25" maxlength="50"></td>
<td width="93" scope="col"> </td>
</tr>
<tr>
<td>Durum</td>
<td>:</td>
<td><input name="durum" type="checkbox" id="durum" value="1" <?php if ( $durum==1 ) { echo ' checked="CHECKED" '; } ?> ></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="button" id="button" value="Slider Ekle"></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>
<?php
if ( $_POST ["button"] ) {
// Butona basılmış ise kontrolleri yap
if (!$title) {
echo "title giriniz";
} elseif (!$description) {
echo "Description giriniz";
} else {
// Slider ekleme işleminden önce Resim adı, Title olarak değiştirilsin.
$orjinal_resim = $resim_dizisi ["name"];
$uzanti = substr ($orjinal_resim,-4);
$title_kucuk = mb_strtolower($title,"utf8");
$bul = array ("ö","ü","ğ","ş","ç","ı","/","+"," ");
$degistir = array ("o","u","g","s","c","i","","plus","-");
$title_duzelt = str_replace($bul,$degistir,$title_kucuk);
$resim = $title_duzelt.$uzanti;
// slider eklemeye başladı
$ekle = mysql_query("insert into slider set sira='$sira',title='$title', description='$description',resim='$resim',url='$url',durum='$durum' ");
if ($ekle) {
echo "slider eklendi";
// Ürün Eklendi ise Resmi UPLOAD et.
$kaynak = $resim_dizisi ["tmp_name"];
$hedef = "../resimler/slider-resimleri/".$resim;
$yukle = move_uploaded_file($kaynak,$hedef);
if ($yukle) {
echo "Resim Yüklendi <br>";
} else {
echo "HATA : Resim Yüklenemedi";
}
header("refresh:3;url=sliderler.php");
} else {
echo "HATA : slider eklenemedi";
}
//--------------------------
}
//--------------------------------------
}
?>
</td>
<td> </td>
</tr>
</table>
</form>
</div>
</div>
<!-- ==================== Footer Bottom ==================== -->
<?php
include("include-panel/footer.php");
?>
</body>
</html>