<?php require 'ust.php'; ?>
<?php
$adi = $_GET["a"];
if(empty($adi)){
  echo '<script>window.location.href = "index.php";</script>';
}else{
  $yorumcusor = mysqli_query($db, "SELECT * FROM yorumcular WHERE ad_url = '$adi'");
  $yorumcusay = mysqli_num_rows($yorumcusor);
  $yorumcudetay = mysqli_fetch_array($yorumcusor);
  if ($yorumcusay < 1){
    echo '<script>window.location.href = "index.php";</script>';
}}
?>
<main id="main">
  <section class="breadcrumbs">
    <div class="container">
      <div class="d-flex justify-content-between align-items-center">
        <h2>Yorumcu Sayfası</h2>
        <ol>
          <li><a href="index.php">Ana Sayfa</a></li>
          <li>Yorumcu Sayfası</li>
        </ol>
      </div>
    </div>
  </section>
  <section class="inner-page">
    <div class="container">
      <div class="col-lg-12">
        <div class="row">
          <div class="col-lg-3 card mx-2 my-3" style='margin:auto !important ; margin-bottom: 20px !important; width: 18rem;border-style: solid: color: red; background-image: url("assets/img/ydivrsim.jpg");'><center><br>
              <?php if ($yorumcudetay["durum"] == 1) {?>
            <div class="text-success" role="status" style="position: absolute; top: 5px;  left: 5px;"><div style="background:mediumseagreen; border-radius: 5px;">&nbsp; <font color="white"><b> Online </b></font> &nbsp;</div></div>
          <?php } if ($yorumcudetay["durum"] == 0) {?>
            <div class="text-danger" role="status" style="position: absolute; top: 5px;  left: 5px;"><div style="background:orangered; border-radius: 5px;">&nbsp; <font color="white"><b> Çevrim Dışı </b></font> &nbsp;</div></div>
          <?php } if ($yorumcudetay["durum"] == 2) {?>
            <div class="text-warning" role="status" style="position: absolute; top: 5px;  left: 5px;"><div style="background:orange; border-radius: 5px;">&nbsp; <font color="white"><b> Meşgul </b></font> &nbsp;</div></div>
          <?php } ?>
          <?php if ($yorumcudetay["yildiz"] == 1){echo '<i style="color: white; position: absolute; top: 5px;  right: 5px;" class="bi bi-star-fill"></i>';} ?>
          <?php if ($yorumcudetay["yildiz"] == 2){echo '<i style="color: white; position: absolute; top: 5px;  right: 5px;" class="bi bi-star-fill"></i><i style="color: white; position: absolute; top: 5px;  right: 21px;" class="bi bi-star-fill"></i>';} ?>
          <?php if ($yorumcudetay["yildiz"] == 3){echo '<i style="color: white; position: absolute; top: 5px;  right: 5px;" class="bi bi-star-fill"></i><i style="color: white; position: absolute; top: 5px;  right: 21px;" class="bi bi-star-fill"></i><i style="color: white; position: absolute; top: 5px;  right: 37px;" class="bi bi-star-fill"></i>';} ?>
          <?php if ($yorumcudetay["yildiz"] == 4){echo '<i style="color: white; position: absolute; top: 5px;  right: 5px;" class="bi bi-star-fill"></i><i style="color: white; position: absolute; top: 5px;  right: 21px;" class="bi bi-star-fill"></i><i style="color: white; position: absolute; top: 5px;  right: 37px;" class="bi bi-star-fill"></i><i style="color: white; position: absolute; top: 5px;  right: 53px;" class="bi bi-star-fill"></i>';} ?>
          <?php if ($yorumcudetay["yildiz"] == 5){echo '<i style="color: white; position: absolute; top: 5px;  right: 5px;" class="bi bi-star-fill"></i><i style="color: white; position: absolute; top: 5px;  right: 21px;" class="bi bi-star-fill"></i><i style="color: white; position: absolute; top: 5px;  right: 37px;" class="bi bi-star-fill"></i><i style="color: white; position: absolute; top: 5px;  right: 53px;" class="bi bi-star-fill"></i><i style="color: white; position: absolute; top: 5px;  right: 69px;" class="bi bi-star-fill"></i>';} ?>
            <a href="yorumcu.php?a=<?php echo $yorumcudetay['ad_url']; ?>"><img style="border-radius: 50%; height: 100px; width: 100px; object-fit: cover;" class="card-img-top" src="<?php echo $yorumcudetay['presim']; ?>" alt="profil-resmi"></a>
            <div class="card-body">
              <h5 class="card-title" style="color: white;"><?php echo $yorumcudetay["kadi"]; ?></h5><hr style="color:white;">
              <p class="card-text" style="color: white;"><?php echo $yorumcudetay["kisa_aciklama"]; ?><br><br><br>
                <?php if($yorumcudetay["ysses"] == 1) {?><button type="button" class="btn btn-outline-danger" data-toggle="popover" title="Falınız Sesli Kayıt Biçiminde Gönderilir"><i style="font-size: 20px;" class="bi bi-mic-fill"></i></button><?php }else{ ?>
                  <button type="button" class="btn btn-outline-danger" data-toggle="popover" title="Falınız Sesli Kayıt Biçiminde Gönderilir" disabled><i style="font-size: 20px;" class="bi bi-mic-fill"></i></button><?php } ?>
                <?php if($yorumcudetay["ysyazi"] == 1) {?><button type="button" class="btn btn-outline-warning" data-toggle="tooltip" title="Falınız Yazılı Metin Biçiminde Gönderilir"><i style="font-size: 20px;" class="bi bi-envelope-fill"></i></button><?php }else{ ?>
                  <button type="button" class="btn btn-outline-warning" data-toggle="tooltip" title="Falınız Yazılı Metin Biçiminde Gönderilir" disabled><i style="font-size: 20px;" class="bi bi-envelope-fill"></i></button><?php } ?>
                <?php if($yorumcudetay["ystel"] == 1) {?><button type="button" class="btn btn-outline-success" data-toggle="tooltip" title="Falınız Telefon Üzerinden Yorumlanır"><i style="font-size: 20px;" class="bi bi-telephone-fill"></i></button><?php }else{ ?>
                  <button type="button" class="btn btn-outline-success" data-toggle="tooltip" title="Falınız Telefon Üzerinden Yorumlanır" disabled><i style="font-size: 20px;" class="bi bi-telephone-fill"></i></button><?php } ?>
              </p>
              <?php if ($yorumcudetay["durum"] == 1) {?>
              <a href="yorumcu.php?a=<?php echo $yorumcudetay["ad_url"];?>">  <button type="button" class="btn btn-outline-light" > Hemen Fal Baktır </button></a>
            <?php }else {?>
              <a href="yorumcu.php?a=<?php echo $yorumcudetay["ad_url"];?>">  <button type="button" class="btn btn-outline-light" disabled> Çevrim Dışı </button></a>
            <?php } ?>
            </div>
          </center>
         </div>
            <div class="col-lg-9">
              <div class="row">
                <?php if($yorumcudetay["kahvefali"] == "1"){ ?>
                <div class="card" style='border: 0 !important; width: 12rem;'>
                  <center><div style="background:#d2691e; border-radius: 50%; height: 100px; width: 100px;">
                  <img style="height: 70px; width: 70px; padding-top: 15px;" src="https://falsepeti.com/_nuxt/img/4cec49c.svg" class="card-img-top" alt="...">
                </div></center>
                  <div class="card-body">
                    <center><h5 class="card-title"> <span class="sr-only"><?php echo $yorumcudetay["fiyatkf"]; ?> Kredi</span> </h5></center>
                    <center><a href="kahvefali.php?y=<?php echo $adi;?>" class="btn btn-success">Kahve Falı <br> Baktır</a></center>
                  </div>
                </div>
              <?php } ?>
              <?php if($yorumcudetay["tarotfali"] == "1"){ ?>
                <div class="card" style='border: 0 !important; width: 12rem;'>
                  <center><div style="background:#d2691e; border-radius: 50%; height: 100px; width: 100px;">
                  <img style="height: 70px; width: 70px; padding-top: 18px;" src="https://falsepeti.com/_nuxt/img/b89d9e6.svg" class="card-img-top" alt="...">
                </div></center>
                  <div class="card-body">
                    <center><h5 class="card-title"> <span class="sr-only"><?php echo $yorumcudetay["fiyattf"]; ?> Kredi</span> </h5></center>
                    <center><a href="tarotfali.php?y=<?php echo $adi;?>" class="btn btn-success">Tarot Falı <br> Baktır</a></center>
                  </div>
                </div>
                <?php } ?>
                <?php if($yorumcudetay["yildizfali"] == "1"){ ?>
                <div class="card" style='border: 0 !important; width: 12rem;'>
                  <center><div style="background:#d2691e; border-radius: 50%; height: 100px; width: 100px;">
                  <img style="height: 70px; width: 70px; padding-top: 18px;" src="https://falsepeti.com/_nuxt/img/0139458.svg" class="card-img-top" alt="...">
                </div></center>
                  <div class="card-body">
                    <center><h5 class="card-title"> <span class="sr-only"><?php echo $yorumcudetay["fiyatyf"]; ?> Kredi</span> </h5></center>
                    <center><a href="yildiznamefali.php?y=<?php echo $adi;?>" class="btn btn-success">Yıldız Falı <br> Baktır</a></center>
                  </div>
                </div>
              <?php } ?>
              <?php if($yorumcudetay["katinafali"] == "1"){ ?>
                <div class="card" style='border: 0 !important; width: 12rem;'>
                  <center><div style="background:#d2691e; border-radius: 50%; height: 100px; width: 100px;">
                  <img style="height: 70px; width: 70px; padding-top: 18px;" src="https://falsepeti.com/_nuxt/img/4b27479.svg" class="card-img-top" alt="...">
                </div></center>
                  <div class="card-body">
                    <center><h5 class="card-title"> <span class="sr-only"><?php echo $yorumcudetay["fiyatkatinafali"]; ?> Kredi</span> </h5></center>
                    <center><a href="katinafali.php?y=<?php echo $adi;?>" class="btn btn-success">Katina Falı <br> Baktır</a></center>
                  </div>
                </div>
              <?php } ?>
              <?php if($yorumcudetay["sufali"] == "1"){ ?>
                <div class="card" style='border: 0 !important; width: 12rem;'>
                  <center><div style="background:#d2691e; border-radius: 50%; height: 100px; width: 100px;">
                  <img style="height: 70px; width: 70px; padding-top: 18px;" src="https://falsepeti.com/_nuxt/img/feafe2a.svg" class="card-img-top" alt="...">
                </div></center>
                  <div class="card-body">
                    <center><h5 class="card-title"> <span class="sr-only"><?php echo $yorumcudetay["fiyatsf"]; ?> Kredi</span> </h5></center>
                    <center><a href="sufali.php?y=<?php echo $adi;?>" class="btn btn-success">Su Falı <br> Baktır</a></center>
                  </div>
                </div>
                <?php } ?>
              </div>
              <h3 class="text-center mt-5">Hakkında</h3><br>
              <p class="text-center"><?php echo $yorumcudetay["hakkinda"]; ?></p>
            </div>
        </div>
      </div>
    </div>
  </section>
  <section>
    <div class="container">
      <div class="section-title" data-aos="fade-up" data-aos-delay="100">
        <p> Yorumlar </p>
        <h5>Yorumcunun diğer ziyaretçilerinin değerlendirmelerini görün.</h5>
      </div>
      <?php
      $yorumcuidsi = $yorumcudetay["id"];
      $bkahvefalisayisi = mysqli_num_rows(mysqli_query($db, "SELECT * FROM kahvefali WHERE uyeid = '$uyeidsession' AND yorumcu_id = '$yorumcuidsi' AND fal_durum = 'Bakıldı'"));
      $btarotfalisayisi = mysqli_num_rows(mysqli_query($db, "SELECT * FROM tarotfali WHERE uyeid = '$uyeidsession' AND yid = '$yorumcuidsi' AND durum = 'Bakıldı'"));
      $byildiznamefalisayisi = mysqli_num_rows(mysqli_query($db, "SELECT * FROM yildiznamefali WHERE uyeid = '$uyeidsession' AND yid = '$yorumcuidsi' AND fal_durum = 'Bakıldı'"));
      $bkatinafalisayisi = mysqli_num_rows(mysqli_query($db, "SELECT * FROM katinafali WHERE uyeid = '$uyeidsession' AND yid = '$yorumcuidsi' AND durum = 'Bakıldı'"));
      $bsufalisayisi = mysqli_num_rows(mysqli_query($db, "SELECT * FROM sufali WHERE uyeid = '$uyeidsession' AND yid = '$yorumcuidsi' AND fal_durum = 'Bakıldı'"));
      $falbaktirasayisi = $bkahvefalisayisi + $btarotfalisayisi + $byildiznamefalisayisi + $bkatinafalisayisi + $bsufalisayisi;
      if ($falbaktirasayisi > 0) { ?>
      <form method="post">
        <div class="row">
          <div class="col-9">
            <input name="yorum" minlength="15" maxlength="100" type="text" class="form-control" placeholder="Yorumunuz">
            <input name="yorumcuid" type="hidden" value="<?php echo $yorumcuidsi; ?>">
            <small>Minimum 15 Maksimum 100 Karakterlik Yorum Yapabilirsiniz</small>
          </div>
          <div class="col-3">
            <button name="ygonder" type="submit" class="btn btn-primary">Yorum Gönder</button>
          </div>
        </div>
      </form>
      <?php
      if (isset($_POST["ygonder"])) {
        $yorum = $_POST["yorum"];
        $yorumcuid = $_POST["yorumcuid"];
        $ekle = mysqli_query($db, "INSERT INTO yorumcu_yorumlari(yorumcu_id, yorum)VALUES('$yorumcuid','$yorum')");
        if (isset($ekle)) {
          echo '<script>swal("Başarılı", "Yorumunuz Başarılı Bir Şekilde Gönderildi", "success");setTimeout(function(){location = location.href;}, 1500);</script>';
        }else {
          echo '<script>swal("Hata", " Sistemsel Bir sorun Meydana Geldi Lütfen Tekrar Deneyin ", "error");</script>';
        }
      }
       ?>
    <?php } ?>
      <?php
      $yid = $yorumcudetay["id"];
      $yyorumgetir = mysqli_query($db, "SELECT * FROM yorumcu_yorumlari WHERE yorumcu_id = '$yid'");
      while ($yyorumlistele = mysqli_fetch_array($yyorumgetir)) { ?>
      <div class="col-lg-12 my-3" data-aos="fade-right" data-aos-delay="100">
        <div class="card">
            <div class="card-body">
              <?php echo $yyorumlistele["yorum"]; ?>
            </div>
        </div>
      </div>
    <?php } ?>
      </div>
    </div>
  </section>
</main>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js" integrity="sha384-7+zCNj/IqJ95wo16oMtfsKbZ9ccEh31eOz1HGyDuCQ6wgnyJNSYdrPa03rtR1zdB" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.min.js" integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script>
<?php require 'footer.php'; ?>
