tools/md5-decryption.php

122 lines
4.8 KiB
PHP

<style>
.button-style-md5{
padding: 20px 20px;
background-color: #7d7d7d;
color: #fff;
border: none;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
cursor: pointer;
width: 100%;
}
.button-style-md5:hover {
background-color: #9d9d9d;
}
.custom-container {
max-width: 500px;
margin: 50px auto;
background-color: #3d3d3d;
padding: 20px;
border-radius: 8px;
box-shadow: 0px 0px 10px 0px rgba(255,255,255,0.1);
}
.custom-heading {
text-align: center;
font-size: 25px;
}
.custom-label {
display: block;
margin-bottom: 5px;
}
.custom-input {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
.custom-submit {
width: 100%;
padding: 10px;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.3s;
}
.custom-submit:hover {
background-color: #9d9d9d;
}
</style>
<?php require_once ('.hta_config/siliconpin_sp.php'); ?>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
try {
$db = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $db->prepare("SELECT * FROM md5_data WHERE md5 = :md5");
$stmt->bindParam(':md5', $_POST["md5-hash"]);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
if ($result) {
echo '<div style="display: flex; justify-content: center;">
<div style="display: flex; flex-direction: column; justify-content: center;">
<p style="text-align: center; font-size: 25px; ">Given MD5 Vlue: </p>
<p style="display: none; text-align: center;" id="copied-notice"></p>
<div style="display: flex; flex-direction: row;">
<input id="output" type="text" readonly value="'.$result['value'].'" style="color: #fff; padding: 10px 10px 10px 10px; font-size: 25px; outline: none;" />
<button class="button-style-md5" id="copyButton" onclick="copyOutputText()">Copy</button>
</div>
</div>
</div>';
echo '
<script>
function copyOutputText() {
const outputText = document.getElementById(\'output\').value;
const textarea = document.createElement(\'textarea\');
textarea.value = outputText;
document.body.appendChild(textarea);
textarea.select();
document.execCommand(\'copy\');
document.body.removeChild(textarea);
document.getElementById(\'copied-notice\').style.display = \'block\';
document.getElementById(\'copied-notice\').innerHTML = \'MD5 value copied to clipboard!\';
}
</script>
';
} else {
echo '<div style="display: flex; justify-content: center;">
<div style="display: flex; flex-direction: column; justify-content: center;">
<p style="text-align: center; font-size: 25px; ">No data found for the given MD5 hash </p>
<div style="display: flex; flex-direction: row;">
<button class="button-style-md5" id="" onclick="tryAgain()">Try Again</button>
</div>
</div>
</div>';
echo ' <script>
function tryAgain() {
window.location.href="/tools/md5-decryption";
}
</script>' ;
// echo json_encode(array('success' => false, 'message' => 'No data found for the given MD5 hash'));
}
exit();
} catch (PDOException $e) {
echo json_encode(array('success' => false, 'message' => 'Database error: ' . $e->getMessage()));
exit();
}
}
?>
<div class="custom-container">
<h2 class="custom-heading">MD5 Decryption</h2>
<form method="post" action="">
<label for="md5-hash" class="custom-label">Enter Text:</label><br>
<input type="text" id="md5-hash" name="md5-hash" class="custom-input"><br><br>
<input type="submit" value="Generate MD5 Hash" class="custom-submit" style="background-color: #7d7d7d;">
</form>
</div>