| Server IP : 172.67.187.206 / Your IP : 172.71.28.155 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : E:/Inetpub/www/pr/ |
Upload File : |
<?php
include 'functions.php';
// ตรวจสอบสิทธิ์: เฉพาะ Admin เท่านั้นถึงจะเข้าหน้านี้ได้
check_login('admin');
$result = "";
$input_val = "";
$action = "";
$alert_color = "secondary";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$input_val = trim($_POST['text_input']);
if(!empty($input_val)){
if (isset($_POST['btn_encode'])) {
// สั่งเข้ารหัส
$result = encrypt_pass($input_val);
$action = "ผลลัพธ์การเข้ารหัส (Encode):";
$alert_color = "success";
} elseif (isset($_POST['btn_decode'])) {
// สั่งถอดรหัส
$result = decrypt_pass($input_val);
$action = "ผลลัพธ์การถอดรหัส (Decode):";
$alert_color = "warning";
}
}
}
echo get_header("เครื่องมือแปลงรหัสผ่าน");
?>
<div class="row justify-content-center mt-4">
<div class="col-md-8 col-lg-6">
<div class="card shadow-sm border-0">
<div class="card-header bg-dark text-white">
<h5 class="mb-0"><i class="bi bi-shield-lock"></i> เครื่องมือแปลงรหัสผ่าน (Admin Tool)</h5>
</div>
<div class="card-body p-4">
<form method="post">
<div class="mb-3">
<label class="form-label fw-bold">กรอกข้อความ / รหัสผ่าน:</label>
<textarea name="text_input" class="form-control" rows="3" placeholder="ใส่ข้อความที่ต้องการแปลงที่นี่..." required><?php echo htmlspecialchars($input_val); ?></textarea>
</div>
<div class="d-flex gap-2 justify-content-center mb-4">
<button type="submit" name="btn_encode" class="btn btn-success px-4">
<i class="bi bi-lock-fill"></i> เข้ารหัส (Encode)
</button>
<button type="submit" name="btn_decode" class="btn btn-warning px-4 text-dark">
<i class="bi bi-unlock-fill"></i> ถอดรหัส (Decode)
</button>
<a href="tool_encode.php" class="btn btn-secondary px-4">
<i class="bi bi-arrow-counterclockwise"></i> ล้างค่า
</a>
</div>
</form>
<?php if ($result != "") { ?>
<div class="alert alert-<?php echo $alert_color; ?> shadow-sm">
<label class="fw-bold mb-1"><?php echo $action; ?></label>
<div class="input-group">
<input type="text" class="form-control font-monospace" value="<?php echo $result; ?>" id="resultBox" readonly>
<button class="btn btn-outline-secondary" type="button" onclick="copyToClipboard()">
<i class="bi bi-clipboard"></i> คัดลอก
</button>
</div>
</div>
<?php } ?>
<hr>
<div class="alert alert-info small mb-0">
<i class="bi bi-info-circle-fill"></i> <strong>คำแนะนำ:</strong><br>
- ใช้ <strong>Encode</strong> เมื่อต้องการสร้างรหัสผ่านใหม่เพื่อนำไปใส่ในฐานข้อมูลโดยตรง<br>
- ใช้ <strong>Decode</strong> เมื่อต้องการดูรหัสผ่านจริงจากฐานข้อมูล (ที่เป็นภาษาต่างดาว)
</div>
</div>
</div>
</div>
</div>
<script>
function copyToClipboard() {
var copyText = document.getElementById("resultBox");
copyText.select();
copyText.setSelectionRange(0, 99999); /* For mobile devices */
navigator.clipboard.writeText(copyText.value);
alert("คัดลอกเรียบร้อย: " + copyText.value);
}
</script>
<?php echo get_footer(); ?>