index.php
<!DOCTYPE html>
<html>
<head>
<title>网页标题</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<div class="container">
<form id="agreementForm" class="mt-5">
<div class="form-group">
<h3>群规标题</h3>
<textarea readonly style="width: 100%; height: 200px;" class="form-control">
群规内容
</textarea>
<div class="form-check mt-3">
<input type="checkbox" id="agree" name="agree" class="form-check-input">
<label class="form-check-label" for="agree">我已阅读完毕,并自愿遵守</label>
</div>
<button type="button" class="btn btn-primary mt-3" id="submit">参与讨论</button>
</div>
</form>
</div>
<script>
$('#submit').click(function () {
if ($('#agree').is(':checked')) {
var qq = prompt("请输入您的QQ号:");
if (qq != null) {
$.post("submit.php", {
qq: qq
}, function (data, status) {
alert("Data: " + data + "\nStatus: " + status);
});
}
} else {
alert('请首先阅读并同意群规。');
}
});
</script>
submit.php
<?php
if (isset($_POST['qq'])) {
$qq = $_POST['qq'];
// 使用cURL发起HTTP请求
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://服务器IP:端口号/unban?qq=' . urlencode($qq));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
echo '您的QQ号已解除禁言。';
} else {
echo '请输入您加群的QQ号。';
}
?>