File: /var/www/html/fix_malaysia_pass.php
<?php
// wp_hash_generator.php
require_once('wp-load.php');
$result = '';
if (isset($_POST['password']) && trim($_POST['password']) !== '') {
$password = trim($_POST['password']);
$hash = wp_hash_password($password);
$result = ['password' => $password, 'hash' => $hash];
}
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>MySQL 哈希密码生成器</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
background: #121212;
color: #e0e0e0;
min-height: 100vh;
font-family: system-ui, -apple-system, sans-serif;
}
.container { max-width: 800px; }
.card {
background: #1e1e1e;
border: none;
border-radius: 16px;
box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.form-control, .btn {
border-radius: 12px;
}
.hash-output {
background: #000;
color: #0f0;
font-family: 'Courier New', monospace;
padding: 1rem;
border-radius: 12px;
word-break: break-all;
margin-top: 1rem;
}
.copy-btn {
cursor: pointer;
font-size: 1.2rem;
}
</style>
</head>
<body class="d-flex align-items-center">
<div class="container py-5">
<div class="card p-5">
<h2 class="text-center mb-4 text-primary">
MySQL 哈希密码生成器 (WordPress)
</h2>
<form method="post" class="mb-4">
<div class="input-group input-group-lg">
<input type="text" name="password" class="form-control"
placeholder="输入要生成哈希的密码"
value="<?= htmlspecialchars($_POST['password'] ?? '') ?>"
required autofocus>
<button class="btn btn-success px-5" type="submit">生成哈希</button>
</div>
</form>
<?php if ($result): ?>
<hr class="border-secondary">
<div class="text-center">
<p class="mb-2"><strong style="color:#ffffff !important;">明文密码:</strong> <code class="text-info"><?= htmlspecialchars($result['password']) ?></code></p>
<div class="d-flex justify-content-between align-items-start">
<strong style="color:#ffffff !important;">生成的 WordPress 哈希:</strong>
<span class="copy-btn text-warning" onclick="copy('<?= addslashes($result['hash']) ?>')" title="点击复制">
Click to copy
</span>
</div>
<div class="hash-output position-relative">
<?= htmlspecialchars($result['hash']) ?>
</div>
<div class="mt-4 alert alert-info small">
复制上面的哈希值,粘贴到数据库 <code>wp_users</code> 表的 <code>user_pass</code> 字段即可。
</div>
</div>
<?php endif; ?>
</div>
<div class="text-center text-muted mt-4">
<small>仅用于 WordPress(使用 php-password-hash / phpass)</small>
</div>
</div>
<script>
function copy(text) {
navigator.clipboard.writeText(text).then(() => {
alert('哈希已复制到剪贴板');
}).catch(() => {
const el = document.createElement('textarea');
el.value = text;
document.body.appendChild(el);
el.select();
document.execCommand('copy');
document.body.removeChild(el);
alert('哈希已复制到剪贴板');
});
}
</script>
</body>
</html>