<?php require 'ust.php'; ?>
<main id="main" class="main">
  <section class="section dashboard">
    <div class="row">
      <div class="col-12">
        <div class="card">
          <div class="card-body">
            <h5 class="card-title">Site Header Düzenleme Paneli</h5>
            <?php $bilgigetir = mysqli_fetch_array(mysqli_query($db, "SELECT * FROM site_header_ayar WHERE id = '1'")); ?>
            <form method="post">
              <div class="row my-3">
                <div class="col">
                  <label> Header 1 ( Anasayfa İlk Kısım ) </label>
                  <textarea name="header_1" class="form-control ckeditor" id="exampleFormControlTextarea1" rows="1" ><?php echo $bilgigetir["header_1"]; ?></textarea>
                </div>
                <div class="col">
                  <label> Header 2 ( Anasayfa  ilk Görsel Alanı ) </label>
                  <textarea name="header_2" class="form-control ckeditor" id="exampleFormControlTextarea1" rows="1" ><?php echo $bilgigetir["header_2"]; ?></textarea>
                </div>
              </div>
              <div class="row my-3">
                <div class="col">
                  <label> Anasayfa Kahve Falı Acıklaması </label>
                  <textarea name="header_3" class="form-control ckeditor" id="exampleFormControlTextarea1" rows="1" ><?php echo $bilgigetir["header_3"]; ?></textarea>
                </div>
                <div class="col">
                  <label> Anasayfa Tarot Falı Acıklaması </label>
                  <textarea name="header_4" class="form-control ckeditor" id="exampleFormControlTextarea1" rows="1" ><?php echo $bilgigetir["header_4"]; ?></textarea>
                </div>
              </div>
              <div class="row my-3">
                <div class="col">
                  <label> Anasayfa Katina Falı Acıklaması </label>
                  <textarea name="header_5" class="form-control ckeditor" id="exampleFormControlTextarea1" rows="1" ><?php echo $bilgigetir["header_5"]; ?></textarea>
                </div>
                <div class="col">
                  <label> Anasayfa Yıldızname Falı Acıklaması </label>
                  <textarea name="header_6" class="form-control ckeditor" id="exampleFormControlTextarea1" rows="1" ><?php echo $bilgigetir["header_6"]; ?></textarea>
                </div>
                <div class="col">
                  <label> Anasayfa Su Falı Acıklaması </label>
                  <textarea name="header_7" class="form-control ckeditor" id="exampleFormControlTextarea1" rows="1" ><?php echo $bilgigetir["header_7"]; ?></textarea>
                </div>
              </div>
              <center><button name="headerayar" type="submit" class="btn btn-primary my-3"> Güncelle </button></center>
            </form>
          </div>
        </div>
      </div>
    </div>
  </section>
</main>
<?php require 'footer.php'; ?>
<?php
if(isset($_POST["headerayar"])){
  $header_1 = $_POST["header_1"];
  $header_2 = $_POST["header_2"];
  $header_3 = $_POST["header_3"];
  $header_4 = $_POST["header_4"];
  $header_5 = $_POST["header_5"];
  $header_6 = $_POST["header_6"];
  $header_7 = $_POST["header_7"];
  $duzenle = mysqli_query($db, "UPDATE site_header_ayar SET header_1 = '$header_1', header_2 = '$header_2', header_3 = '$header_3', header_4 = '$header_4', header_5 = '$header_5', header_6 = '$header_6', header_7 = '$header_7' WHERE id = '1'");
  if ($duzenle) {
    echo '<script>swal("Başarılı", "Bilgiler Başarılı Bir Şekilde Düzenlendi", "success");setTimeout(function(){ window.location.assign("headerayar.php");}, 1500);</script>';
  }else {
    echo '<script>swal("Hata", "Beklenemdik Bir Hata Meydana Geldi Lütfen Tekrar Deneyin.", "error");</script>';
  }
}
 ?>
