<?php include 'header.php'; ?>

<div class="content-wrapper">

  <section class="content-header">
    <h1>
      Atur Situs
      <small>Atur Situs</small>
    </h1>
    <ol class="breadcrumb">
      <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
      <li class="active">Dashboard</li>
    </ol>
  </section>

  <section class="content">
    <div class="row">
      <section class="col-lg-5">

        <?php
        if (isset($_GET['alert'])) {
          if ($_GET['alert'] == "berhasil") {
            echo "<div class='alert alert-success'>Data Situs Berhasil Diupdate!</div>";
          }
        }
        ?>
        <?php
        $qry_hadiah = mysqli_query($koneksi, "SELECT * FROM atur_web WHERE id='1'");
        $dt_bank = mysqli_fetch_array($qry_hadiah);
        $id = $dt_bank['id'];
        $nama_pasaran = $dt_bank['nama_pasaran'];
        $title = $dt_bank['title'];
        $meta_desc = $dt_bank['meta_desc'];
        $logo = $dt_bank['logo'];
        $favicon = $dt_bank['favicon'];
        $custom_script = $dt_bank['custom_script'];
        ?>

        <div class="box box-info">
          <div class="box-header">
            <h3 class="box-title">Data Situs</h3>
          </div>
          <div class="box-body">
            <form action="web_update.php" method="post" enctype="multipart/form-data">
              <div class="form-group">
                <label>Nama Pasaran</label>
                <input type="text" class="form-control" value="<?php echo $nama_pasaran; ?>" name="nama_pasaran"
                  required>
                <input type="hidden" name="id" value="1">
              </div>
              <div class="form-group">
                <label>Title</label>
                <input type="text" class="form-control" value="<?php echo $title; ?>" name="title" required>
              </div>
              <div class="form-group">
                <label>Meta Deskripsi</label>
                <textarea id="meta_desc" name="meta_desc" cols="40" rows="5"
                  class="form-control"><?php echo $meta_desc; ?></textarea>
              </div>
              <div class="form-group">
                <label>Logo (Upload File Baru jika ingin mengganti)</label><br>
                <?php if ($logo != "") {
                  echo "<img src='../$logo' height='40'><br><br>";
                } ?>
                <input type="file" name="logo">
              </div>
              <div class="form-group">
                <label>Favicon (Upload File Baru jika ingin mengganti)</label><br>
                <?php if ($favicon != "") {
                  echo "<img src='../$favicon' height='40'><br><br>";
                } ?>
                <input type="file" name="favicon">
              </div>
              <div class="form-group">
                <label>Custom Script</label>
                <textarea id="custom_script" name="custom_script" cols="40" rows="5"
                  class="form-control"><?php echo $custom_script; ?></textarea>
              </div>
              <div class="form-group">
                <input type="submit" class="btn btn-sm btn-primary" value="Simpan">
              </div>
            </form>
          </div>
        </div>

      </section>
    </div>
  </section>

</div>

<?php include 'footer.php'; ?>