init
This commit is contained in:
118
md5-encryption.php
Normal file
118
md5-encryption.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<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;
|
||||
/* color: #333; */
|
||||
}
|
||||
.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');
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
|
||||
$md5_hash = md5($_POST["md5-text"]);
|
||||
try {
|
||||
$db = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $db->prepare("INSERT INTO md5_data (md5, value) VALUES (:md5, :value)");
|
||||
$stmt->bindParam(':md5', $md5_hash);
|
||||
$stmt->bindParam(':value', $_POST["md5-text"]);
|
||||
$stmt->execute();
|
||||
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; ">Converted MD5: </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="'.$md5_hash.'" 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 copied to clipboard!\';
|
||||
}
|
||||
</script>
|
||||
';
|
||||
// echo json_encode(array('success' => true, 'message' => 'Data inserted successfully'));
|
||||
// echo '<script>window.location.href="/admin/add-content";</script>';
|
||||
exit();
|
||||
} catch (PDOException $e) {
|
||||
echo json_encode(array('success' => false, 'message' => 'Database error: ' . $e->getMessage()));
|
||||
exit();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="custom-container">
|
||||
<h2 class="custom-heading">Generate MD5 Hash</h2>
|
||||
<form method="post">
|
||||
<label for="md5-text" class="custom-label">Enter Text:</label><br>
|
||||
<input type="text" id="md5-text" name="md5-text" class="custom-input"><br><br>
|
||||
<input type="submit" value="Generate MD5 Hash" class="custom-submit" style="background-color: #7d7d7d;">
|
||||
</form>
|
||||
</div>
|
||||
<!-- <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 = 'Output text copied to clipboard!';
|
||||
}
|
||||
</script> -->
|
||||
Reference in New Issue
Block a user