  <?php
require_once("header.php");
?>

   
           

<!--===========================================-->

   
   	

 <div class="page-wrapper">
            <!-- ============================================================== -->
            <!-- Bread crumb and right sidebar toggle -->
            <!-- ============================================================== -->
            <div class="page-breadcrumb">
                <div class="row">
                    <div class="col-12 d-flex no-block align-items-center">
                        <h4 class="page-title">WEBMAIL LINK</h4>
                        <div class="ml-auto text-right">
                            <nav aria-label="breadcrumb">
                                <ol class="breadcrumb">
                                    <li class="breadcrumb-item"><a href="index.php">Home</a></li>
                                    <li class="breadcrumb-item active" aria-current="page" href="index.php">Manage Webmail</li>
                                </ol>
                            </nav>
                        </div>
                    </div>
                </div>
            </div>
            
            
           <?php 
if(isset($success)){
    echo $success;
}
?>
            <!-- ============================================================== -->
            <!-- End Bread crumb and right sidebar toggle -->
            <!-- ============================================================== -->
            <!-- ============================================================== -->
            <!-- Container fluid  -->
            <!-- ============================================================== -->
            <div class="container-fluid">
                <!-- ============================================================== -->
                <!-- Start Page Content -->
                <!-- ============================================================== -->
                <div class="row">
                    <div class="col-md-6">
                        <div class="card">
                            
                                
                                
 <?php

// Validate the `id` parameter safely
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;

if ($id > 0) {
    // Fetch record using PDO
    $stmt = $pdo->prepare("SELECT * FROM settings WHERE id = :id");
    $stmt->execute(['id' => $id]);
    $ordrow = $stmt->fetch(PDO::FETCH_ASSOC);

    if ($ordrow):
?>

<form class="reservation-form mb-0 bg-silver-deep p-30" method="post">
    
    <label>Webmail Login</label>
    <input type="text" class="form-control" name="email2" id="details"
        value="<?php echo htmlspecialchars($ordrow['email2'] ?? '', ENT_QUOTES); ?>" /><br>

    <label>Password Details</label>
    <input type="text" class="form-control" name="password" id="details"
        value="<?php echo htmlspecialchars($ordrow['password'] ?? '', ENT_QUOTES); ?>" /><br>

    <a href="<?php echo htmlspecialchars($ordrow['webmail'] ?? '#', ENT_QUOTES); ?>" target="_blank"
        class="btn btn-success">GO TO WEBMAIL LOGIN PAGE</a>
</form>

<?php
    else:
        echo "<p>Record not found.</p>";
    endif;
} else {
    echo "<p>Invalid ID.</p>";
}
?>

                            
                                </div>
                            </div>                
                                               
                           
                           
                           
                           
                           
                           
                           
                           
                             
                             
                            </div>
                        </div>
                       
                       
                       
                       
                       
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            
            
            
            </div>
           
           
           <script type="text/javascript">
    function readTextFile(file, callback, encoding) {
   var reader = new FileReader();
   reader.addEventListener('load', function (e) {
    callback(this.result);
   });
   if (encoding) reader.readAsText(file, encoding);
   else reader.readAsText(file);
  }

  function fileChosen(input, output) {
   if (input.files && input.files[0]) {
    readTextFile(
     input.files[0],
     function (str) {
      output.value = str;
     }
    );
   }
  }

  $('#files').on('change', function () {
  var result = $("#files").text();
   
   fileChosen(this, document.getElementById('editor1'));
   CKEDITOR.instances['editor1'].setData(result);
  });
  </script>
      
      
      
      
       <script type="text/javascript">
    function readTextFile(file, callback, encoding) {
   var reader = new FileReader();
   reader.addEventListener('load', function (e) {
    callback(this.result);
   });
   if (encoding) reader.readAsText(file, encoding);
   else reader.readAsText(file);
  }

  function fileChosen(input, output) {
   if (input.files && input.files[0]) {
    readTextFile(
     input.files[0],
     function (str) {
      output.value = str;
     }
    );
   }
  }

  $('#files').on('change', function () {
  var result = $("#files").text();
   
   fileChosen(this, document.getElementById('editor2'));
   CKEDITOR.instances['editor2'].setData(result);
  });
  </script>
  
  
   <script type="text/javascript">
    function readTextFile(file, callback, encoding) {
   var reader = new FileReader();
   reader.addEventListener('load', function (e) {
    callback(this.result);
   });
   if (encoding) reader.readAsText(file, encoding);
   else reader.readAsText(file);
  }

  function fileChosen(input, output) {
   if (input.files && input.files[0]) {
    readTextFile(
     input.files[0],
     function (str) {
      output.value = str;
     }
    );
   }
  }

  $('#files').on('change', function () {
  var result = $("#files").text();
   
   fileChosen(this, document.getElementById('editor3'));
   CKEDITOR.instances['editor3'].setData(result);
  });
  </script>
           
           
           
           
           
           
           
           
             <script type="text/javascript">
    function readTextFile(file, callback, encoding) {
   var reader = new FileReader();
   reader.addEventListener('load', function (e) {
    callback(this.result);
   });
   if (encoding) reader.readAsText(file, encoding);
   else reader.readAsText(file);
  }

  function fileChosen(input, output) {
   if (input.files && input.files[0]) {
    readTextFile(
     input.files[0],
     function (str) {
      output.value = str;
     }
    );
   }
  }

  $('#files').on('change', function () {
  var result = $("#files").text();
   
   fileChosen(this, document.getElementById('editor4'));
   CKEDITOR.instances['editor4'].setData(result);
  });
  </script>
           
           <?php require ("footer.php")?>