<?php include("header.php");?>

<?php
if(p('etiket_adi') && g('islem')=="")
{
	$etiket_adi 	= p('etiket_adi');
	$etiket_url 	= p('etiket_url');
	$durum 		= p('durum');

	$etiket_sorgu	=	Sorgu("INSERT INTO etiketler SET
										adi		=	'$etiket_adi', 
										url		=	'$etiket_url',
										durum	=	'$durum'");	
										
																								   
		$bilgi = '  		  
							  <div class="alert alert-success alert-block fade in">
                                  <button data-dismiss="alert" class="close close-sm" type="button">
                                      <i class="fa fa-times"></i>
                                  </button>
                                  <h4>
                                      <i class="fa fa-ok-sign"></i>
                                      Başarılı!
                                  </h4>
                                  <p>Başarıyla eklenmiştir...</p>
                              </div>
							  
		 ' ;
		
}


if(p('etiket_adi') && g('islem')=="duzenle")
{
	$d_id 		= g('id');
	$etiket_adi 	= p('etiket_adi');
	$etiket_url 	= p('etiket_url');
	$durum 		= p('durum');
	
	
	$etiket_duzenle_sorgu = Sorgu("UPDATE etiketler SET 
											adi		=	'$etiket_adi', 
											url		=	'$etiket_url', 
											durum	=	'$durum' 
											where id=	'$d_id'");
	
												
				  $bilgi = '  	  
							  <div class="alert alert-success alert-block fade in">
                                  <button data-dismiss="alert" class="close close-sm" type="button">
                                      <i class="fa fa-times"></i>
                                  </button>
                                  <h4>
                                      <i class="fa fa-ok-sign"></i>
                                      Başarılı!
                                  </h4>
                                  <p>Başarıyla güncellenmiştir...</p>
                              </div>
							  
		 ' ;
}


if($_GET['islem']=="duzenle")
{
	$sayfaid = $_GET['id'];	
	$durum = "duzenle" ;
	
	$etiketSonuc = Sonuc(Sorgu("SELECT * FROM etiketler WHERE id='$sayfaid'"));
	
}

?>



 <!--main content start-->
      <section id="main-content">
          <section class="wrapper">
              <!-- page start-->
        
            

              <div class="row">
                  <div class="col-lg-12">
				    <?php echo $bilgi;?>
                      <section class="panel">
                          <header class="panel-heading">
                            Etiket Ekle
                          </header>
                          <div class="panel-body">
                              <form class="form-horizontal tasi-form" method="post" action="" enctype="multipart/form-data">
							  
							  

                                  <div class="form-group">
                                      <label class="col-sm-2 col-sm-2 control-label">Etiket Adı</label>
                                      <div class="col-sm-10">
                                         <input type="text" class="form-control" name="etiket_adi" value="<?php echo $etiketSonuc->adi;?>" id="etiket_adi" placeholder="">
                                      </div>
                                  </div>
                             
                             
                         
						   <div class="form-group">
                                      <label class="col-sm-2 col-sm-2 control-label">Site Meta</label>
                                      <div class="col-sm-10">
                               <div class="panel-body">
                                      <input name="etiket_url" value="<?php echo $etiketSonuc->url;?>" class="tagsinput"  style="display: none;">
                                  </div>
                                      </div>
                                  </div>
						 
						 
						 
						          <div class="row m-bot15">
                                  <?php if($_GET['islem']=="duzenle"){?>
								 <label class="col-sm-2 col-sm-2 control-label">Durumu</label>
                                           <div class="col-sm-10">
                                           <input type="checkbox" name="durum" <?php if($etiketSonuc->durum == '1') {?> checked <?php } ?> value="1" data-toggle="switch"/>
                                          </div>
                                        	<?php }else{?>
											 <label class="col-sm-2 col-sm-2 control-label">Durumu</label>
                                          <div class="col-sm-10">
                                           	<input type="checkbox" name="durum" value="1" checked data-toggle="switch"/>
                                          </div>
										  <?php } ?>
                                      </div>
						 
						 
						 
						 
						 
						 
						 
						 
						         <div class="form-group">
                                        <div class="col-sm-10">
									    <?php if($_GET['islem']=="duzenle"){?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                          <button class="btn btn-shadow btn-danger" type="submit">Güncelle</button>
										  <?php }else{?>
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
										  <button class="btn btn-shadow btn-success" type="submit">Kaydet</button>
										   <?php } ?>
                                      </div>
                                  </div>
						 
						 
						 
						 
						 
						 
                              </form>
                          </div>
                      </section>
                  
                      

           

               

                  </div>
              </div>
              <!-- page end-->
          </section>
      </section>
      <!--main content end-->





















<?php include("footer.php");?>