<?php include("header.php");?>
<?php
if(p('kadi') && g('islem')=="")
{
	$adsoyad 	= p('adsoyad');
	$email 		= p('email');
	$kadi 		= p('kadi');
	$sifre 		= p('sifre');
	$t			= date("Y-m-d H:i:s");
	$tarih		= tarih($t);
	
	
	$yonetici_ekle_sorgu	=	Sorgu("INSERT INTO admin SET
										ad_soyad	=	'$adsoyad',
										kullanici	=	'$kadi', 
										sifre		=	'$sifre', 
										email		=	'$email',
										son_giris	=	'$tarih'");	
																								   
	$bilgi = '  <div class="alert alert-success alert-dismissable">
                    	<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    		Yönetici Başarı ile Eklenmiştir !
                  </div>
		' ;
		
}


if(p('kadi') && g('islem')=="duzenle")
{
	$d_id 		= g('id');
	$adsoyad 	= p('adsoyad');
	$email 		= p('email');
	$kadi 		= p('kadi');
	$sifre 		= p('sifre');
	$t			= date("Y-m-d H:i:s");
	$tarih		= tarih($t);
	
	$yonetici_duzenle_sorgu = Sorgu("UPDATE admin SET 
									ad_soyad	=	'$adsoyad',
									kullanici	=	'$kadi', 
									sifre		=	'$sifre', 
									email		=	'$email',
									son_giris	=	'$tarih'
									WHERE id	=	'$d_id'");
				  $bilgi = '   <div class="alert alert-success alert-dismissable">
                    	<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    		Yönetici Başarı ile Güncellenmiştir !
                  </div>
		 ' ;
}

if($_GET['islem']=="duzenle")
{
	$sayfaid = $_GET['id'];	
	$durum = "duzenle" ;
	$Yonetici = Sonuc(Sorgu("SELECT * FROM admin 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">
                            Yönetici 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">Adı Soyadı</label>
                                      <div class="col-sm-10">
                                        <input type="text" class="form-control" name="adsoyad" value="<?php echo $Yonetici->ad_soyad;?>" id="adsoyad" placeholder="Ad Soyad">
                                      </div>
                                  </div>
                             
                         
						    <div class="form-group">
                                      <label class="col-sm-2 col-sm-2 control-label">Email Adresi</label>
                                      <div class="col-sm-10">
                                       <input type="text" class="form-control" name="email" value="<?php echo $Yonetici->email;?>" id="email" placeholder="E-Mail">
                                      </div>
                                  </div>
                             
							 
							 
							 
							 
							    <div class="form-group">
                                      <label class="col-sm-2 col-sm-2 control-label">Kullanıcı Adı</label>
                                      <div class="col-sm-10">
                                        <input type="text" class="form-control" name="kadi" value="<?php echo $Yonetici->kullanici;?>" id="kadi" placeholder="Kullanıcı Adı">
                                      </div>
                                  </div>
                             
							 
							 
							 
							 
						
							 
							    <div class="form-group">
                                      <label class="col-sm-2 col-sm-2 control-label">Şifre</label>
                                      <div class="col-sm-10">
                                         <input type="text" class="form-control" name="sifre" value="<?php echo $Yonetici->sifre;?>" id="sifre" placeholder="Şifre">
                                      </div>
                                  </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");?>