<?php
  $askData=$db->prepare("SELECT * FROM contact_log where log_id=:log_id");
  $askData->execute(array(
    'log_id' => $_GET["log_id"]
    ));
  $checkData=$askData->fetch(PDO::FETCH_ASSOC);

  // $_GET null or nothing
  if ($_GET['log_id'] == null) {
    Header("Location:mailBoxs");
  }elseif($_GET['log_id'] != $checkData['log_id']){
    Header("Location:mailBoxs");
  }

  // $editData=$db->prepare("UPDATE contact_log SET
  //   status=:status
  //   WHERE log_id={$_GET['log_id']}");
  // $update=$editData->execute(array(
  //   'status'   => 1
  // ));
?>

<div class="card">
  <div class="card-body">
    <div class="email-wrapper">
      <div class="email-sidebar">
        <div class="email-sidebar-content">
          <?php require_once 'mailBoxMenu.php'; ?>
        </div>
      </div>
      <div class="email-content">
        <div class="">
          <div class="email-read-box p-15">
            <h4><?php echo $checkData['subject']; ?></h4>
            <hr>
            <div class="media align-items-center">
              <img src="assets/images/favicon-32x32.png" width="42" height="42" class="rounded-circle" />
              <div class="media-body ml-2">
                <?php echo $checkData['namesurname']; ?> <br>
                <?php echo $checkData['phone']; ?>
                <p class="mb-0 font-weight-bold"><?php echo $checkData['email']; ?></p>
              </div>
              <p class="mb-0 chat-time pl-5 ml-auto">
                <?php echo $checkData['dates']; ?><br>
                IP:<?php echo $checkData['ip']; ?>
              </p>
            </div>
            <div class="email-read-content py-5">
              <?php echo $checkData['message']; ?>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
