<?php
// 检查是否提交了表单
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// 设置 API URL
$apiUrl = 'https://MD5.li/api.php';
// 准备请求参数
$params = [
'jiemi' => 'true',
'key' => 'd5ad53f8a373dc41f7bd6774a8a3783d', // 替换为您的 API 密钥
'hash' => $_POST['hash'] // 从表单获取用户输入的哈希值
];
// 初始化 cURL
$ch = curl_init();
// 设置 cURL 选项
curl_setopt($ch, CURLOPT_URL, $apiUrl . '?' . http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// 执行 cURL 请求
$response = curl_exec($ch);
// 检查 cURL 错误
if (curl_errno($ch)) {
$errorMessage = 'cURL 错误: ' . curl_error($ch);
} else {
// 解析 JSON 响应
$responseData = json_decode($response, true);
// 输出响应
if (isset($responseData['status']) && $responseData['status'] === 'success') {
$resultMessage = "解密成功!<br>哈希值: " . htmlspecialchars($params['hash']) . "<br>原始值: " . htmlspecialchars($responseData['original']);
} else {
$resultMessage = "错误: " . (isset($responseData['message']) ? htmlspecialchars($responseData['message']) : '未知错误');
}
}
// 关闭 cURL
curl_close($ch);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>MD5 解密</title>
<link rel="stylesheet" href="//cdn.staticfile.net/twitter-bootstrap/4.6.1/css/bootstrap.min.css">
</head>
<body>
<!-- 导航栏 -->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a href="#">MD5 解密工具</a>
<button type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul>
<li class="nav-item active">
<a href="#">首页 <span>(当前)</span></a>
</li>
</ul>
</div>
</nav>
<div class="container mt-5">
<h2>MD5 解密工具</h2>
<form method="POST" action="">
<div>
<label for="hash">输入要解密的 MD5 哈希值:</label>
<input type="text" id="hash" name="hash" required>
</div>
<button type="submit" class="btn btn-primary btn-block">解密</button>
</form>
<?php if (isset($resultMessage)): ?>
<div>
<h4>结果:</h4>
<p><?php echo $resultMessage; ?></p>
</div>
<?php endif; ?>
<?php if (isset($errorMessage)): ?>
<div>
<h4>错误:</h4>
<p><?php echo $errorMessage; ?></p>
</div>
<?php endif; ?>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="//cdn.staticfile.net/twitter-bootstrap/4.6.1/js/bootstrap.bundle.min.js"></script>
</body>
</html>php教程
在线MD5解密源代码分享
php教程
我的站长站
2025-03-07
共38人阅读
上一篇:PHP删除空白换行教程
下一篇:返回列表
最新更新
-
01在线MD5解密源代码分享 8个月前
-
02PHP删除空白换行教程 8个月前
-
03PHP去除字符串两边空格、空字符串、换行符方法 8个月前
-
04php判断字符是否为数字或字母教程 8个月前
-
05PHP读取TXT文本内容方法大全 8个月前
热门推荐
-
01分享几个随机美女图api接口 4874热度
-
02优学院自动刷课PHP代码 839热度
-
03php文件限速下载示例代码 715热度
-
04最新蓝奏云直连解析API接口php代码 712热度
-
052022蓝奏云PHP解析API接口源代码 706热度
