<?

	ob_start();
	session_start();
	include_once("../sistem/database.php");
	include_once("../sistem/upload.php");

	include_once("sistem/admin.php");
	 $db     	= new database();
	 $admin		= new user(); 
	  $db->baglanti();
	  $login = $admin->giris();
	 if($login=="fail"){
        header("location: login.php");
    }else{
         function sef_link($bas){
        $bas = str_replace(array("&quot;","&#39;"), NULL, $bas);
        $bul = array('Ç', 'Ş', 'Ğ', 'Ü', 'İ', 'Ö', 'ç', 'ş', 'ğ', 'ü', 'ö', 'ı', '-');
        $yap = array('c', 's', 'g', 'u', 'i', 'o', 'c', 's', 'g', 'u', 'o', 'i', ' ');
        $perma = strtolower(str_replace($bul, $yap, $bas));
        $perma = preg_replace("@[^A-Za-z0-9\-_]@i", ' ', $perma);
        $perma = trim(preg_replace('/\s+/',' ', $perma));
        $perma = str_replace(' ', '-', $perma);


        return $perma;
    }
?>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<!-- BEGIN HEAD -->
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	
	<title>TICARETIUMbasic Admin Paneli</title>
	<meta content="width=device-width, initial-scale=1.0" name="viewport" />
	<meta content="" name="description" />
	<meta content="" name="author" />
	<link href="assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
	<link href="assets/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" />
	<link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
	<link href="css/style.css" rel="stylesheet" />
	<link href="css/style_responsive.css" rel="stylesheet" />
	<link href="css/style_default.css" rel="stylesheet" id="style_color" />
       <link href="assets/bootstrap/css/bootstrap-fileupload.css" rel="stylesheet" />

	<link href="assets/fancybox/source/jquery.fancybox.css" rel="stylesheet" />
	<link rel="stylesheet" type="text/css" href="assets/uniform/css/uniform.default.css" />
	<link href="assets/fullcalendar/fullcalendar/bootstrap-fullcalendar.css" rel="stylesheet" />
	<link href="assets/jqvmap/jqvmap/jqvmap.css" media="screen" rel="stylesheet" type="text/css" />
    <link href="../css/font.css" rel="stylesheet" type="text/css">
       <link rel="stylesheet" type="text/css" href="assets/bootstrap-wysihtml5/bootstrap-wysihtml5.css" />


</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body class="fixed-top">
	<!-- BEGIN HEADER -->
	<div id="header" class="navbar navbar-inverse navbar-fixed-top">
		<!-- BEGIN TOP NAVIGATION BAR -->
		<div class="navbar-inner">
			<div class="container-fluid">
				<!-- BEGIN LOGO -->
				<a class="brand" href="index.php">
				    <img src="img/logo.png" alt="Admin Lab" />
				</a>
				<!-- END LOGO -->
				<!-- BEGIN RESPONSIVE MENU TOGGLER -->
				<a class="btn btn-navbar collapsed" id="main_menu_trigger" data-toggle="collapse" data-target=".nav-collapse">
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
				<span class="arrow"></span>
				</a>
				<!-- END RESPONSIVE MENU TOGGLER --><!-- END  NOTIFICATION -->
                <div class="top-nav ">
                    <ul class="nav pull-right top-menu" >
                        <!-- BEGIN SUPPORT --><!-- END SUPPORT -->
						<!-- BEGIN USER LOGIN DROPDOWN -->
						<li class="dropdown">
							<a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            	<img src="img/yvzshn.jpg" alt="">
                                <span class="username"><?=$admin->admininfo($_SESSION['a_adminus']);?></span>
							<b class="caret"></b>
							</a>
							<ul class="dropdown-menu">
								
								<li><a href="logout.php"><i class="icon-key"></i> Çıkış Yap</a></li>
							</ul>
						</li>
						<!-- END USER LOGIN DROPDOWN -->
					</ul>
					<!-- END TOP NAVIGATION MENU -->
				</div>
			</div>
		</div>
		<!-- END TOP NAVIGATION BAR -->
	</div>
	<!-- END HEADER -->
	<!-- BEGIN CONTAINER -->
	<div id="container" class="row-fluid">
		<!-- BEGIN SIDEBAR -->
		<div id="sidebar" class="nav-collapse collapse">
			<!-- BEGIN SIDEBAR TOGGLER BUTTON -->
			<div class="sidebar-toggler hidden-phone"></div>
			<!-- BEGIN SIDEBAR MENU -->
			<ul class="sidebar-menu">
             	<li><a class="" href="index.php"><span class="icon-box"><i class="icon-dashboard"></i></span> Anasayfa</a></li>
                 <li><a class="" href="ayarlar.php"><span class="icon-box"><i class="icon-wrench"></i></span> Ayarlar</a></li>
                 <li><a class="" href="teklif.php"><span class="icon-box"><i class="icon-money"></i></span> Teklif Talepleri</a></li>
				<li class="has-sub">
					<a href="javascript:;" class="">
					    <span class="icon-box"> <i class="icon-bookmark"></i></span> Sayfalar
                        <span class="arrow"></span>
                    </a>
                    <ul class="sub">
                        <li><a class="" href="sayfa.php?p=ekle">Sayfa Ekle</a></li>
                        <li><a class="" href="sayfa.php?p=tum">Tüm Sayfalar</a></li>

                    </ul>
				</li>
				<li class="has-sub">
					<a href="javascript:;" class="">
					    <span class="icon-box"> <i class="icon-sitemap"></i></span> Kategoriler
                        <span class="arrow"></span>
                    </a>
                    <ul class="sub">
                        <li><a class="" href="kategoriler.php?p=ekle">Yeni Ekle</a></li>
                        <li><a class="" href="kategoriler.php?p=tum">Tüm Kategoriler</a></li>

                    </ul>
				</li>
				<li class="has-sub active open">
					<a href="javascript:;" class="">
					    <span class="icon-box"> <i class="icon-barcode"></i></span> Ürünler
                        <span class="arrow"></span>
                    </a>
                    <ul class="sub">
                        <li><a class="" href="urunler.php?p=ekle">Yeni Ekle</a></li>
                        <li><a class="" href="urunler.php?p=tum">Tüm Ürünler</a></li>

                    </ul>
				</li>
                <li><a class="" href="iletisim.php"><span class="icon-box"><i class="icon-phone-sign"></i></span> İletişim</a></li>
			</ul>
			<!-- END SIDEBAR MENU -->
		</div>
		<!-- END SIDEBAR -->
		<!-- BEGIN PAGE -->
		<div id="main-content">
			<!-- BEGIN PAGE CONTAINER-->
			<div class="container-fluid">
				<!-- BEGIN PAGE HEADER-->
			  <div class="row-fluid">
					<div class="span12">
						<!-- BEGIN PAGE TITLE & BREADCRUMB-->
						<ul class="breadcrumb">
							<li>
                                <a href="#"><i class="icon-home"></i></a><span class="divider">&nbsp;</span>
							</li>
                            <li>
                                <a href="index.php">Promina Teknoloji</a> <span class="divider">&nbsp;</span>
                            </li>
							<li><a href="#">Ürünler</a><span class="divider-last">&nbsp;</span></li>
						</ul>
						<!-- END PAGE TITLE & BREADCRUMB-->
					</div>
				</div>
			  <div class="row-fluid">
			    <div class="span12">
			      <!-- BEGIN EXAMPLE TABLE widget-->
			      <div class="widget">
			        <div class="widget-title">
			          <h4><i class="icon-sitemap"></i>Ürünler</h4>
			          <span class="tools"> <a href="javascript:;" class="icon-chevron-down"></a> </span> </div>
			        <div class="widget-body">
                    <?
                    	if(isset($_GET['p'])){
							$p = $_GET['p'];
						}else{
							$p = "";
						}
						switch($p){
							default:
					?>
			          <div class="portlet-body">
			            <div class="space15"></div>
			            <table class="table table-striped table-hover table-bordered" id="sample_1">
			              <thead>
			                <tr>
			                  <th width="90%">Ürün Adı</th>
			                  <th width="10%">İşlem</th>
		                    </tr>
		                  </thead>
			              <tbody>
                        <?php
                           $n = mysql_query("SELECT * FROM `urunler`");
							while($y = mysql_fetch_object($n)){
						?>
                        <tr class="center text-center">
			                  <td><strong><?=$y->isim;?></strong></td>
			                  <td>
                                  <a class="duzenle" href="urunler.php?p=duzenle&pID=<?=$y->firsatID;?>"><i class="icon-pencil"></i></a>
                                  <a class="sil" href="urunler.php?p=duzenle&pID=<?=$y->firsatID;?>"><i class="icon-trash"></i></a>
		                    </tr>
                        <?
							}
						?>
		                  </tbody>
		                </table>
		              </div>
                      <?
					  break;
                      case 'ekle':
					  ?>
                      <form action="?p=kaydet" class="form-horizontal" method="post" enctype="multipart/form-data">
                           <div class="control-group">
                              <label class="control-label">Ürün Stok Kodu</label>
                              <div class="controls">
                                 <input type="text" class="input-large m-wrap " name="stok" />
                              </div>
                           </div>
                           <div class="control-group">
                              <label class="control-label">Ürün Başlığı</label>
                              <div class="controls">
                                 <input type="text" class="input-large m-wrap " name="baslik" />
                              </div>
                           </div>
                           <div class="control-group">
                              <label class="control-label">Kategori</label>
                              <div class="controls">
                                        <select class="input-large m-wrap" name="ust" tabindex="1">
                                            <option value="0">Kategori Seçiniz</option>
                                            <?php
                                            $n = mysql_query("SELECT * FROM `kategoriler`");
							                     while($y = mysql_fetch_object($n)){
						                  ?>
                                            <option value="<?=$y->kID;?>"><?=$y->kategori;?></option>
                                            <?
							}
						?>
                                        </select>
                                    </div>
                           </div>
                          <div class="control-group">
                                    <label class="control-label">Ürün Resmi</label>
                                    <div class="controls controls-row">
                                        <div class="span4 fileupload fileupload-new" data-provides="fileupload">
                                                    <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;"></div>
                                                            <div>
                                                        <span class="btn btn-file"><span class="fileupload-new">Resim Seç</span>
                                                        <span class="fileupload-exists">Değiştir</span>
                                                            <input type="file" name="resim" />
                                                                </span>
                                                        <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Sil</a>
                                            </div>
										</div>
                                        <div class="span4 fileupload fileupload-new" data-provides="fileupload">
                                                    <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;"></div>
                                                            <div>
                                                        <span class="btn btn-file"><span class="fileupload-new">Resim Seç</span>
                                                        <span class="fileupload-exists">Değiştir</span>
                                                            <input type="file" name="resim3" />
                                                                </span>
                                                        <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Sil</a>
                                            </div>
										</div>
                                        <div class="span4 fileupload fileupload-new" data-provides="fileupload">
                                                    <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;"></div>
                                                            <div>
                                                        <span class="btn btn-file"><span class="fileupload-new">Resim Seç</span>
                                                        <span class="fileupload-exists">Değiştir</span>
                                                            <input type="file" name="resim4" />
                                                                </span>
                                                        <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Sil</a>
                                            </div>
										</div>
                                        <div class="span4 fileupload fileupload-new" data-provides="fileupload">
                                                    <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;"></div>
                                                            <div>
                                                        <span class="btn btn-file"><span class="fileupload-new">Resim Seç</span>
                                                        <span class="fileupload-exists">Değiştir</span>
                                                            <input type="file" name="resim5" />
                                                                </span>
                                                        <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Sil</a>
                                            </div>
										</div>
                                        <div class="span4 fileupload fileupload-new" data-provides="fileupload">
                                                    <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;"></div>
                                                            <div>
                                                        <span class="btn btn-file"><span class="fileupload-new">Resim Seç</span>
                                                        <span class="fileupload-exists">Değiştir</span>
                                                            <input type="file" name="resim6" />
                                                                </span>
                                                        <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Sil</a>
                                            </div>
										</div>
                                        <div class="span4 fileupload fileupload-new" data-provides="fileupload">
                                                    <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;"></div>
                                                            <div>
                                                        <span class="btn btn-file"><span class="fileupload-new">Resim Seç</span>
                                                        <span class="fileupload-exists">Değiştir</span>
                                                        <input type="file" name="resim7" />
                                                                </span>
                                                        <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Sil</a>
                                            </div>
										</div>
                                        <div class="span4 fileupload fileupload-new" data-provides="fileupload">
                                                    <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;"></div>
                                                            <div>
                                                        <span class="btn btn-file"><span class="fileupload-new">Resim Seç</span>
                                                        <span class="fileupload-exists">Değiştir</span>
                                                        <input type="file" name="resim8" />
                                                                </span>
                                                        <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Sil</a>
                                            </div>
										</div>
                                        <div class="span4 fileupload fileupload-new" data-provides="fileupload">
                                                    <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;"></div>
                                                            <div>
                                                        <span class="btn btn-file"><span class="fileupload-new">Resim Seç</span>
                                                        <span class="fileupload-exists">Değiştir</span>
                                                            <input type="file" name="resim9" />
                                                                </span>
                                                        <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Sil</a>
                                            </div>
										</div>
                                    </div>
                                </div>
                          <div class="control-group">
                              <label class="control-label">Ürün İçeriği</label>
                              <div class="controls">
                                 <textarea class="span12 wysihtml5" rows="14" name="icerik"></textarea>
                              </div>
                           </div>
                           <div class="form-actions">
                              <button type="submit" class="btn btn-success">Ekle</button>
                           </div>
                      </form>
                      <?
					  break;
					  case 'duzenle':
					  $pID = $_GET['pID'];
					  	$n = mysql_query("SELECT * FROM `urunler` WHERE `firsatID`='$pID'");
							$m = mysql_fetch_object($n);
					  ?>
                      <form action="?p=guncelle" class="form-horizontal" method="post" enctype="multipart/form-data">
                      		<input type="hidden" name="pID" value="<?=$pID;?>">
                      		<input type="hidden" name="oldImage" value="<?=$m->resim;?>">
                      		<input type="hidden" name="oldImage3" value="<?=$m->resim3;?>">
                      		<input type="hidden" name="oldImage4" value="<?=$m->resim4;?>">
                      		<input type="hidden" name="oldImage5" value="<?=$m->resim5;?>">
                      		<input type="hidden" name="oldImage6" value="<?=$m->resim6;?>">
                      		<input type="hidden" name="oldImage7" value="<?=$m->resim7;?>">
                      		<input type="hidden" name="oldImage8" value="<?=$m->resim8;?>">
                      		<input type="hidden" name="oldImage9" value="<?=$m->resim9;?>">
                      		<div class="control-group">
                              <label class="control-label">Ürün Stok Kodu</label>
                              <div class="controls">
                                 <input type="text" class="input-large m-wrap " name="stok" value="<?=$m->stokKodu;?>" />
                              </div>
                           </div>
                           <div class="control-group">
                              <label class="control-label">Ürün Başlığı</label>
                              <div class="controls">
                                 <input type="text" class="input-large m-wrap " name="baslik" value="<?=$m->isim;?>" />
                              </div>
                           </div>
                           <div class="control-group">
                              <label class="control-label">Kategori</label>
                              <div class="controls">
                                        <select class="input-large m-wrap" name="ust" tabindex="1">
                                            <option value="0">Kategori Seçiniz</option>
                                            <?php
                                            $n = mysql_query("SELECT * FROM `kategoriler`");
							                     while($y = mysql_fetch_object($n)){
						                  ?>
                                            <option value="<?=$y->kID;?>" <?php if($m->kategori==$y->kID){?> selected<?php } ?>><?=$y->kategori;?></option>
                                            <?php
							}
						?>
                                        </select>
                                    </div>
                           </div>
                          <div class="control-group">
                                    <label class="control-label">Ürün Resmi</label>
                                    <div class="controls controls-row">
                                        <div class="span4 fileupload fileupload-new" data-provides="fileupload">
                                                    <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;">
                                                        <img src="../upload/product/<?=$m->resim;?>" class="img-polaroid" alt="">
                                                    </div>
                                                            <div>
                                                        <span class="btn btn-file"><span class="fileupload-new">Resim Seç</span>
                                                        <span class="fileupload-exists">Değiştir</span>
                                                            <input type="file" name="resim" />
                                                                </span>
                                                        <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Sil</a>
                                            </div>
										</div>
										
                                        <div class="span4 fileupload fileupload-new" data-provides="fileupload">
                                                    <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;">
                                                        <img src="../upload/product/<?=$m->resim3;?>" class="img-polaroid" alt="">
                                                    </div>
                                                            <div>
                                                        <span class="btn btn-file"><span class="fileupload-new">Resim Seç</span>
                                                        <span class="fileupload-exists">Değiştir</span>
                                                            <input type="file" name="resim3" />
                                                                </span>
                                                        <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Sil</a>
                                            </div>
										</div>
                                        <div class="span4 fileupload fileupload-new" data-provides="fileupload">
                                                    <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;">
                                                        <img src="../upload/product/<?=$m->resim4;?>" class="img-polaroid" alt="">
                                                    </div>
                                                            <div>
                                                        <span class="btn btn-file"><span class="fileupload-new">Resim Seç</span>
                                                        <span class="fileupload-exists">Değiştir</span>
                                                            <input type="file" name="resim4" />
                                                                </span>
                                                        <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Sil</a>
                                            </div>
										</div>
                                        <div class="span4 fileupload fileupload-new" data-provides="fileupload">
                                                    <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;">
                                                        <img src="../upload/product/<?=$m->resim5;?>" class="img-polaroid" alt="">
                                                    </div>
                                                            <div>
                                                        <span class="btn btn-file"><span class="fileupload-new">Resim Seç</span>
                                                        <span class="fileupload-exists">Değiştir</span>
                                                            <input type="file" name="resim5" />
                                                                </span>
                                                        <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Sil</a>
                                            </div>
										</div>
                                        <div class="span4 fileupload fileupload-new" data-provides="fileupload">
                                                    <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;">
                                                        <img src="../upload/product/<?=$m->resim6;?>" class="img-polaroid" alt="">
                                                    </div>
                                                            <div>
                                                        <span class="btn btn-file"><span class="fileupload-new">Resim Seç</span>
                                                        <span class="fileupload-exists">Değiştir</span>
                                                            <input type="file" name="resim6" />
                                                                </span>
                                                        <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Sil</a>
                                            </div>
                                            <div class="span4 fileupload fileupload-new" data-provides="fileupload">
                                                    <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;">
                                                        <img src="../upload/product/<?=$m->resim7;?>" class="img-polaroid" alt="">
                                                    </div>
                                                            <div>
                                                        <span class="btn btn-file"><span class="fileupload-new">Resim Seç</span>
                                                        <span class="fileupload-exists">Değiştir</span>
                                                            <input type="file" name="resim7" />
                                                                </span>
                                                        <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Sil</a>
                                            </div>
                                            <div class="span4 fileupload fileupload-new" data-provides="fileupload">
                                                    <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;">
                                                        <img src="../upload/product/<?=$m->resim8;?>" class="img-polaroid" alt="">
                                                    </div>
                                                            <div>
                                                        <span class="btn btn-file"><span class="fileupload-new">Resim Seç</span>
                                                        <span class="fileupload-exists">Değiştir</span>
                                                            <input type="file" name="resim8" />
                                                                </span>
                                                        <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Sil</a>
                                            </div>
                                            <div class="span4 fileupload fileupload-new" data-provides="fileupload">
                                                    <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;">
                                                        <img src="../upload/product/<?=$m->resim9;?>" class="img-polaroid" alt="">
                                                    </div>
                                                            <div>
                                                        <span class="btn btn-file"><span class="fileupload-new">Resim Seç</span>
                                                        <span class="fileupload-exists">Değiştir</span>
                                                            <input type="file" name="resim9" />
                                                                </span>
                                                        <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Sil</a>
                                            </div>
										</div>
                                    </div>
                                </div>
                          <div class="control-group">
                              <label class="control-label">Ürün İçeriği</label>
                              <div class="controls">
                                 <textarea class="span12 wysihtml5" rows="14" name="icerik"><?=$m->icerik;?></textarea>
                              </div>
                           </div>
                           <div class="form-actions">
                              <button type="submit" class="btn btn-success">Güncelle</button>
                           </div>
                      </form>
                      <?
					  break;
                      case'kaydet':
					  	$baslik = $_POST['baslik'];
					  	$stok = $_POST['stok'];
						$kat	= $_POST['ust'];
						$icerik	= $_POST['icerik'];
                        $res1 = new upload($_FILES['resim']);
						$res2 = new upload($_FILES['resim']);  //profil resmi  
						$res3 = new upload($_FILES['resim3']);    
						$res4 = new upload($_FILES['resim4']);    
						$res5 = new upload($_FILES['resim5']);    
						$res6 = new upload($_FILES['resim6']);    
						$res7 = new upload($_FILES['resim7']);
						$res8 = new upload($_FILES['resim8']);
						$res9 = new upload($_FILES['resim9']); 
						$time = time();
					   if ($res1->uploaded){		
						$uzantisiz1 = explode(".", $res1->file_src_name);
						$res1->image_resize        				= true;
						$res1->file_new_name_body   			= sef_link($time."_".$uzantisiz1[0]);
						$res1->image_x             				= 430;
   						$res1->image_ratio_y       				= true;
						$res1->image_convert 					= 'jpg';	 
						$res1->process('../upload/product');
						
						//profil resmi
						$res2->image_resize        				= true;
						$res2->file_new_name_body   			= sef_link("thumb_".$time."_".$uzantisiz1[0]);
						$res2->image_x             				= 206;
   						$res2->image_ratio_y       				= true;
						$res2->image_convert 					= 'jpg';	 
						$res2->process('../upload/product');
						
						
					   if ($res3->uploaded){		
						$uzantisiz3 = explode(".", $res3->file_src_name);
						$res3->image_resize        				= true;
						$res3->file_new_name_body   			= sef_link($time."_".$uzantisiz3[0]);
						$res3->image_x             				= 430;
   						$res3->image_ratio_y       				= true;
						$res3->image_convert 					= 'jpg';	 
						$res3->process('../upload/product');
					   }
						
					   if ($res4->uploaded){		
						$uzantisiz4 = explode(".", $res4->file_src_name);
						$res4->image_resize        				= true;
						$res4->file_new_name_body   			= sef_link($time."_".$uzantisiz4[0]);
						$res4->image_x             				= 430;
   						$res4->image_ratio_y       				= true;
						$res4->image_convert 					= 'jpg';	 
						$res4->process('../upload/product');
					   }
						
					   if ($res5->uploaded){		
						$uzantisiz5 = explode(".", $res5->file_src_name);
						$res5->image_resize        				= true;
						$res5->file_new_name_body   			= sef_link($time."_".$uzantisiz5[0]);
						$res5->image_x             				= 430;
   						$res5->image_ratio_y       				= true;
						$res5->image_convert 					= 'jpg';	 
						$res5->process('../upload/product');
					   }
						
					   if ($res6->uploaded){		
						$uzantisiz6 = explode(".", $res6->file_src_name);
						$res6->image_resize        				= true;
						$res6->file_new_name_body   			= sef_link($time."_".$uzantisiz6[0]);
						$res6->image_x             				= 430;
   						$res6->image_ratio_y       				= true;
						$res6->image_convert 					= 'jpg';	 
						$res6->process('../upload/product');
					   }
						
					   if ($res7->uploaded){		
						$uzantisiz7 = explode(".", $res7->file_src_name);
						$res7->image_resize        				= true;
						$res7->file_new_name_body   			= sef_link($time."_".$uzantisiz7[0]);
						$res7->image_x             				= 430;
   						$res7->image_ratio_y       				= true;
						$res7->image_convert 					= 'jpg';	 
						$res7->process('../upload/product');
					   }
					   	
					   if ($res8->uploaded){		
						$uzantisiz8 = explode(".", $res8->file_src_name);
						$res8->image_resize        				= true;
						$res8->file_new_name_body   			= sef_link($time."_".$uzantisiz7[0]);
						$res8->image_x             				= 430;
   						$res8->image_ratio_y       				= true;
						$res8->image_convert 					= 'jpg';	 
						$res8->process('../upload/product');
					   }
					    	
					   if ($res9->uploaded){		
						$uzantisiz9 = explode(".", $res9->file_src_name);
						$res9->image_resize        				= true;
						$res9->file_new_name_body   			= sef_link($time."_".$uzantisiz7[0]);
						$res9->image_x             				= 430;
   						$res9->image_ratio_y       				= true;
						$res9->image_convert 					= 'jpg';	 
						$res9->process('../upload/product');
					   }
					   
					$resim3 = '';$resim4 = '';$resim5 = '';$resim6 = '';$resim7 = '';$resim8 = '';$resim9 = 
				
						$resim3			=  sef_link($time."_".$uzantisiz3[0]).".jpg";
					if ($res3->processed)
						$resim3			=  sef_link($time."_".$uzantisiz3[0]).".jpg";
					if ($res4->processed)
						$resim4			=  sef_link($time."_".$uzantisiz4[0]).".jpg";
					if ($res5->processed)
						$resim5			=  sef_link($time."_".$uzantisiz5[0]).".jpg";
					if ($res6->processed)
						$resim6			=  sef_link($time."_".$uzantisiz6[0]).".jpg";
					if ($res7->processed)
						$resim7			=  sef_link($time."_".$uzantisiz7[0]).".jpg";
						if ($res8->processed)
						$resim8			=  sef_link($time."_".$uzantisiz8[0]).".jpg";
						if ($res9->processed)
						$resim9			=  sef_link($time."_".$uzantisiz9[0]).".jpg";
						
					if($resim){
						$n = mysql_query("INSERT INTO `urunler` (`firsatID`, `stokKodu`, `isim`, `icerik`, `resim`, `resim3`, `resim4`, `resim5`, `resim6`, `resim7`,`resim8`,`resim9`,	`kategori`) VALUES (NULL,'$stok',  '$baslik', '$icerik', '$resim', '$resim3', '$resim4', '$resim5', '$resim6', '$resim7', '$kat')");
								if($n){
					 ?>
                     <script>
							$(function(){
								$('body,html').animate({scrollTop:0},800);
							});
							</script>
                        	<div class="alert alert-success">
                            	<button class="close" data-dismiss="alert">×</button>
                            	<strong>İşlem Başarılı!</strong> Ürün Başarıyla Eklendi.
                        	</div>
                     <?		header("refresh:2; url=urunler.php");
								}else{
					?>
                    <script>
							$(function(){
								$('body,html').animate({scrollTop:0},800);
							});
							</script>
                            <div class="alert alert-error">
                            	<button class="close" data-dismiss="alert">×</button>
                            	<strong>Bir Hata Oluştu!</strong> Ürün Şuanda Eklenemedi.
                        	</div>
                    <?		header("refresh:2; url=urunler.php");
								}
								}else{
								echo "Resim Yüklenemedi";
							}
					}
					$res1->clean();
					
				 }else{
                           echo "aaaaaaaa";
						   echo $res1->log;
                       }
					  break;
					  case'guncelle':
					  	$pID	= $_POST['pID'];
					  	$baslik = $_POST['baslik'];
					  	$stok = $_POST['stok'];
						$kat	= $_POST['ust'];
						$icerik	= $_POST['icerik'];
                         if(isset($_FILES['resim'])){
                            $res1 = new upload($_FILES['resim']);
							$res2 = new upload($_FILES['resim']); 
                         if(isset($_FILES['resim3'])) 
							$res3 = new upload($_FILES['resim3']);
                         if(isset($_FILES['resim4']))    
							$res4 = new upload($_FILES['resim4']);
                         if(isset($_FILES['resim5']))    
							$res5 = new upload($_FILES['resim5']);
                         if(isset($_FILES['resim6']))    
							$res6 = new upload($_FILES['resim6']); 
                         if(isset($_FILES['resim7']))   
							$res7 = new upload($_FILES['resim7']);
						if(isset($_FILES['resim8']))   
							$res8 = new upload($_FILES['resim8']);
						if(isset($_FILES['resim9']))   
							$res9 = new upload($_FILES['resim9']); 
						$time = time();
						
					   if ($res1->uploaded){
						$uzantisiz1 = explode(".", $res1->file_src_name);
						$res1->image_resize        				= true;
						$res1->file_new_name_body   			= sef_link($time."_".$uzantisiz1[0]);
						$res1->image_x             				= 430;
   						$res1->image_ratio_y       				= true;
						$res1->image_convert 					= 'jpg';	 
						$res1->process('../upload/product');
						
						//profil resmi
						$res2->image_resize        				= true;
						$res2->file_new_name_body   			= sef_link("thumb_".$time."_".$uzantisiz1[0]);
						$res2->image_x             				= 206;
   						$res2->image_ratio_y       				= true;
						$res2->image_convert 					= 'jpg';	 
						$res2->process('../upload/product');
						
						
						
						
						
					   if ($res1->processed || $res2->processed){
						  $resim 			=  sef_link($time."_".$uzantisiz1[0]).".jpg";
								
                        }else{
                           $resim = $_POST['oldImage'];
                        }
                         }else{
                             $resim = $_POST['oldImage'];
                         }
                             }else{
                             $resim = $_POST['oldImage'];
                         }
						 
						 
						$resim3 = $_POST['oldImage3'];$resim4 = $_POST['oldImage4'];$resim5 = $_POST['oldImage5'];$resim6 = $_POST['oldImage6'];$resim7 = $_POST['oldImage7'];$resim8 = $_POST['oldImage8'];$resim9 = $_POST['oldImage9'];
					
					   if ($res3->uploaded){		
							$uzantisiz3 = explode(".", $res3->file_src_name);
							$res3->image_resize        				= true;
							$res3->file_new_name_body   			= sef_link($time."_".$uzantisiz3[0]);
							$res3->image_x             				= 430;
							$res3->image_ratio_y       				= true;
							$res3->image_convert 					= 'jpg';	 
							$res3->process('../upload/product');
							if ($res3->processed)
								$resim3			=  sef_link($time."_".$uzantisiz3[0]).".jpg";
					   }
						
					   if ($res4->uploaded){		
							$uzantisiz4 = explode(".", $res4->file_src_name);
							$res4->image_resize        				= true;
							$res4->file_new_name_body   			= sef_link($time."_".$uzantisiz4[0]);
							$res4->image_x             				= 430;
							$res4->image_ratio_y       				= true;
							$res4->image_convert 					= 'jpg';	 
							$res4->process('../upload/product');
							if ($res4->processed)
								$resim4			=  sef_link($time."_".$uzantisiz4[0]).".jpg";
					   }
						
					   if ($res5->uploaded){		
							$uzantisiz5 = explode(".", $res5->file_src_name);
							$res5->image_resize        				= true;
							$res5->file_new_name_body   			= sef_link($time."_".$uzantisiz5[0]);
							$res5->image_x             				= 430;
							$res5->image_ratio_y       				= true;
							$res5->image_convert 					= 'jpg';	 
							$res5->process('../upload/product');
							if ($res5->processed)
								$resim5			=  sef_link($time."_".$uzantisiz5[0]).".jpg";
					   }
						
					   if ($res6->uploaded){		
							$uzantisiz6 = explode(".", $res6->file_src_name);
							$res6->image_resize        				= true;
							$res6->file_new_name_body   			= sef_link($time."_".$uzantisiz6[0]);
							$res6->image_x             				= 430;
							$res6->image_ratio_y       				= true;
							$res6->image_convert 					= 'jpg';	 
							$res6->process('../upload/product');
							if ($res6->processed)
								$resim6			=  sef_link($time."_".$uzantisiz6[0]).".jpg";
					   }
						
					   if ($res7->uploaded){		
							$uzantisiz7 = explode(".", $res7->file_src_name);
							$res7->image_resize        				= true;
							$res7->file_new_name_body   			= sef_link($time."_".$uzantisiz7[0]);
							$res7->image_x             				= 430;
							$res7->image_ratio_y       				= true;
							$res7->image_convert 					= 'jpg';	 
							$res7->process('../upload/product');
							if ($res7->processed)
								$resim7			=  sef_link($time."_".$uzantisiz7[0]).".jpg";
					   }
					   
					   if ($res8->uploaded){		
							$uzantisiz8 = explode(".", $res8->file_src_name);
							$res8->image_resize        				= true;
							$res8->file_new_name_body   			= sef_link($time."_".$uzantisiz8[0]);
							$res8->image_x             				= 430;
							$res8->image_ratio_y       				= true;
							$res8->image_convert 					= 'jpg';	 
							$res8->process('../upload/product');
							if ($res8->processed)
								$resim8			=  sef_link($time."_".$uzantisiz8[0]).".jpg";
					   }
					   if ($res9->uploaded){		
							$uzantisiz9 = explode(".", $res9->file_src_name);
							$res9->image_resize        				= true;
							$res9->file_new_name_body   			= sef_link($time."_".$uzantisiz9[0]);
							$res9->image_x             				= 430;
							$res9->image_ratio_y       				= true;
							$res9->image_convert 					= 'jpg';	 
							$res9->process('../upload/product');
							if ($res9->processed)
								$resim9			=  sef_link($time."_".$uzantisiz9[0]).".jpg";
					   }
						$n = mysql_query("UPDATE `urunler` SET stokKodu='$stok', isim='$baslik', kategori='$kat', icerik='$icerik', resim='$resim', resim3='$resim3', resim4='$resim4', resim5='$resim5', resim6='$resim6', resim7='$resim7', resim8='$resim8', resim9='$resim9'
								if($n){
					 ?>
                     <script>
							$(function(){
								$('body,html').animate({scrollTop:0},800);
							});
							</script>
                        	<div class="alert alert-success">
                            	<button class="close" data-dismiss="alert">×</button>
                            	<strong>İşlem Başarılı!</strong> Ürün Başarıyla Güncellendi.
                        	</div>
                     <?		header("refresh:2; url=kategoriler.php");
								}else{
					?>
                    <script>
							$(function(){
								$('body,html').animate({scrollTop:0},800);
							});
							</script>
                            <div class="alert alert-error">
                            	<button class="close" data-dismiss="alert">×</button>
                            	<strong>Bir Hata Oluştu!</strong> Ürün Güncellenemedi.
                        	</div>
                    <?		header("refresh:2; url=kategoriler.php");
								}
					  break;
						}
					  ?>
		            </div>
		          </div>
			      <!-- END EXAMPLE TABLE widget-->
		        </div>
		      </div>
			  <!-- END PAGE HEADER-->
				<!-- BEGIN PAGE CONTENT-->
				<div id="page" class="dashboard">
                    <!-- BEGIN OVERVIEW STATISTIC BLOCKS--><!-- END OVERVIEW STATISTIC BLOCKS--><!-- BEGIN SQUARE STATISTIC BLOCKS-->
                    <div class="square-state"></div>
              <!-- END SQUARE STATISTIC BLOCKS--></div>
				<!-- END PAGE CONTENT-->
			</div>
			<!-- END PAGE CONTAINER-->
		</div>
		<!-- END PAGE -->
	</div>
	<!-- END CONTAINER -->
	<!-- BEGIN FOOTER -->
	<div id="footer">
		2013 &copy; TICARETIUMbasic Admin Paneli
		<div class="span pull-right">
			<span class="go-top"><i class="icon-arrow-up"></i></span>
		</div>
	</div>
	<!-- END FOOTER -->
	<!-- BEGIN JAVASCRIPTS -->
	<!-- Load javascripts at bottom, this will reduce page load time -->
	<script src="js/jquery-1.8.3.min.js"></script>
   <script src="assets/bootstrap/js/bootstrap.min.js"></script>   
   <script src="js/jquery.blockui.js"></script>
   <!-- ie8 fixes -->
   <!--[if lt IE 9]>
   <script src="js/excanvas.js"></script>
   <script src="js/respond.js"></script>
   <![endif]-->
    <script type="text/javascript" src="assets/bootstrap/js/bootstrap-fileupload.js"></script>
   <script type="text/javascript" src="assets/uniform/jquery.uniform.min.js"></script>
   <script type="text/javascript" src="assets/data-tables/jquery.dataTables.js"></script>
   <script type="text/javascript" src="assets/data-tables/DT_bootstrap.js"></script>
   <script src="js/scripts.js"></script>
	<script src="js/jquery.form.js"></script>
  <script type="text/javascript" src="assets/bootstrap-wysihtml5/wysihtml5-0.3.0.js"></script> 
   <script type="text/javascript" src="assets/bootstrap-wysihtml5/bootstrap-wysihtml5.js"></script>
      <script src="js/table-editable.js"></script>
    
	<script>
		jQuery(document).ready(function() {
			// initiate layout and plugins
			App.init();
			TableEditable.init();
		});
	</script>
	<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>
<?
	}
?>