<!DOCTYPE html>
<html dir="rtl">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="libs/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <link rel="stylesheet" href="style.css">
  <title>مبدل base64</title>
</head>

<body>
  <?php include 'layouts/navbar.php'; ?>
  
  <div class="container form-div">
    <br><br><br>
    <h1>مبدل base64</h1>
    <p style="padding-top:8px; color:#ff0000;">رمز نگاری و رمز گشایی base64</p>
    <form>
      <div class="form-group form-div">
        <label style="padding: 8px;">رمز نگاری</label>
        <textarea class="form-control border border-primary border-1" name="encode" rows="3"></textarea>
      </div>
      <div class="form-div">
        <button type="submit" class="btn btn-primary">رمز نگاری کردن</button>
      </div>
    </form>
    <br>
    <?php
    // get decode details
    $en_code = $_GET['encode'];
    
    $en_show = base64_encode($en_code). "\n";
    echo "<div dir='ltr' class='card text-white bg-dark mb-3' style='width: 100%; text-align: left;'>";
    echo "<div class='card-header'>خروجی</div>";
    echo "<div class='card-body'>";
    echo "<p class='card-text'>$en_show</p>";
    echo "</div>";
    echo "</div>";
    ?>
    <br>
    <hr>
    <br>
    <form>
      <div class="form-group form-div">
        <label style="padding: 8px;">رمز گشایی</label>
        <textarea class="form-control border border-primary border-1" name="decode" rows="3"></textarea>
      </div>
      <div class="form-div">
        <button type="submit" class="btn btn-primary">رمز گشایی کردن</button>
      </div>
    </form>
    <br>
    <?php
    // get decode details
    $de_code = $_GET['decode'];
    
    $de_show = base64_decode($de_code). "\n";
    echo "<div dir='ltr' class='card text-white bg-dark mb-3' style='width: 100%; text-align: left;'>";
    echo "<div class='card-header'>خروجی</div>";
    echo "<div class='card-body'>";
    echo "<p class='card-text'>$de_show</p>";
    echo "</div>";
    echo "</div>";
    ?>
  </div>
  <br>

    <?php include 'layouts/footer.php'; ?>
    <script src="libs/bootstrap/js/bootstrap.bundle.min.js"></script>
</body>

</html>
