CCSWebsite/auth/index.php
2025-06-17 01:43:15 +00:00

364 lines
15 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
session_start();
require 'config.php';
if (!isset($conn)) {
die("连接失败:\$conn 未定义");
}
// 检测是否存在有效的 Token
$token = isset($_COOKIE['auth_token']) ? $_COOKIE['auth_token'] : null;
if ($token) {
$stmt = $conn->prepare("SELECT id, username FROM users WHERE token = ?");
$stmt->bind_param("s", $token);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($id, $username);
$stmt->fetch();
if ($stmt->num_rows > 0) {
// 存储用户信息到会话
$_SESSION['user_id'] = $id;
$_SESSION['username'] = $username;
// 跳转到控制台页面
header("Location: ../console/index.php");
exit();
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>圆周云境</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
color: #333;
line-height: 1.6;
}
.top-bar {
background-color: white;
color: black;
padding: 10px 0;
text-align: left;
position: relative;
}
.top-bar-content {
width: 80%;
margin: 0 auto;
}
.top-bar h2 {
margin: 0;
font-size: 20px;
}
.blue-bar {
height: 5px;
background-color: #007bff;
width: 100%;
position: absolute;
bottom: 0;
}
.auth-container {
background-color: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
margin: 20px auto;
width: 80%;
max-width: 400px;
}
.auth-header {
text-align: center;
margin-bottom: 20px;
}
.auth-header h1 {
margin: 0;
font-size: 24px;
}
.switch-buttons {
display: flex;
justify-content: space-between;
margin-top: 10px;
}
.switch-button {
flex: 1;
padding: 10px;
font-size: 14px;
cursor: pointer;
transition: border-color 0.3s, color 0.3s;
background-color: transparent;
border: 1px solid #ccc;
border-radius: 5px;
margin: 0 5px;
text-decoration: none;
color: #333;
}
.switch-button:hover {
border-color: #007bff;
color: #007bff;
}
.form-container {
display: none;
}
.form-container form {
display: flex;
flex-direction: column;
}
.form-container label {
margin-bottom: 5px;
font-size: 14px;
}
.form-container input {
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 14px;
}
.form-container button {
padding: 10px;
font-size: 14px;
cursor: pointer;
transition: border-color 0.3s, color 0.3s;
background-color: transparent;
border: 1px solid #ccc;
border-radius: 5px;
color: #333;
}
.form-container button:hover {
border-color: #007bff;
color: #007bff;
}
.terms-container {
margin-top: 10px;
}
.terms-link {
color: #007bff;
text-decoration: none;
}
.terms-link:hover {
text-decoration: underline;
}
/* 模态框样式 */
.modal {
display: none; /* 默认隐藏 */
position: fixed;
z-index: 1000; /* 确保模态框在最上层 */
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.4); /* 半透明背景 */
}
.modal-content {
background-color: #fefefe;
margin: 15% auto; /* 垂直居中 */
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 500px; /* 最大宽度 */
border-radius: 8px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
position: relative;
}
.close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
</style>
</head>
<body>
<!-- 标题栏 -->
<div class="top-bar">
<div class="top-bar-content">
<h2>圆周云境</h2>
</div>
<div class="blue-bar"></div>
</div>
<div class="auth-container">
<div class="auth-header">
<h1 id="auth-title">登录至CCS</h1>
<div class="switch-buttons">
<button id="switch-to-login" class="switch-button" onclick="switchToLogin()">登录</button>
<button id="switch-to-register" class="switch-button" onclick="switchToRegister()">注册</button>
</div>
</div>
<!-- 登录表单 -->
<div id="login-form" class="form-container" style="display: block;">
<form action="./login.php" method="post">
<label for="login-username">账号</label>
<input type="text" id="login-username" name="username" placeholder="注册时填写的圆周云境用户账号" required>
<label for="login-password">密码</label>
<input type="password" id="login-password" name="password" placeholder="密码" required>
<button type="submit">登录</button>
</form>
</div>
<div id="register-form" class="form-container">
<form action="register.php" method="post">
<label for="username">用户名:</label>
<input type="text" id="username" name="username" required>
<label for="email">邮箱:</label>
<input type="email" id="email" name="email" required>
<label for="password">密码:</label>
<input type="password" id="password" name="password" required>
<label for="confirm-password">确认密码:</label>
<input type="password" id="confirm-password" name="confirm-password" required>
<!--<label for="organization">组织:</label>
<input type="text" id="organization" name="organization">
<label for="development_field">开发领域:</label>
<input type="text" id="development_field" name="development_field">
<label for="skill_tags">技能标签:</label>
<input type="text" id="skill_tags" name="skill_tags">-->
<input type="submit" value="注册">-->
</form>
</div>
</div>
<div id="terms-modal" class="modal">
<div class="modal-content">
<span class="close" onclick="closeModal('terms-modal')">&times;</span>
<h2>用户协议</h2>
<p id="terms-text">一、协议的范围<br>
本用户协议适用于您(以下简称 “用户”)注册、使用 圆周云境(以下简称 “本网站”)所提供的 mc 玩家身份验证服务(以下简称 “本服务”)。<br>
二、用户注册<br>
用户在注册过程中应提供真实、准确、完整的信息,包括但不限于用户名、电子邮箱地址等。
用户不得使用他人的个人信息进行注册,也不得冒用他人身份进行注册。
用户注册成功后,应妥善保管自己的账户信息,包括用户名和密码,不得将账户信息透露给他人使用。<br>
三、用户权利和义务<br>
(一)权利<br>
用户有权在本网站上进行 mc 玩家身份验证,获取相关的验证结果和信息。
用户有权对本网站提供的服务提出意见和建议,并获得相应的反馈。<br>
(二)义务<br>
用户应遵守本网站的用户协议和相关规定,不得从事任何违反法律法规或本网站规定的行为,包括但不限于发布违法信息、侵犯他人权益、破坏网站正常运行等。
用户应保证所提供的 mc 玩家信息的真实性、合法性和完整性,不得提供虚假或误导性的信息。
用户不得将本服务用于任何商业用途或非法活动,未经本网站书面同意,不得以任何形式转让、出租、出借本服务的使用权。
四、本网站的权利和义务<br>
(一)权利<br>
本网站有权对用户提供的信息进行审核、验证和管理,如发现用户违反本协议或存在任何异常行为,有权采取相应的措施,包括但不限于警告、限制使用、终止服务等。
本网站有权在必要时修改本协议的内容,并提前在本网站上公布。如用户继续使用本网站的服务,则视为用户已接受修改后的协议。<br>
(二)义务<br>
本网站应采取合理的技术和管理措施,保障本网站的安全性和稳定性,确保用户能够正常使用本服务。
本网站应对用户提供的信息进行严格保密,不得向任何第三方泄露或提供,但法律法规另有规定的除外。
本网站应为用户提供信息查询、验证等必要的技术支持和服务。<br>
五、服务的中断和终止<br>
因系统维护、升级或不可抗力等因素导致本网站服务中断或终止的,本网站应及时通知用户,并尽可能减少对用户的影响。
如用户违反本协议或法律法规的规定,本网站有权随时中断或终止向该用户提供个性服务,并保留追究其法律责任的权利。
本协议终止后,本网站有权删除用户在本网站上的所有信息和数据,但法律法规另有规定的除外。<br>
六、免责声明<br>
本网站尽力提供准确、完整的信息和验证服务,但本网站不对验证结果的准确性、完整性、及时性或可靠性做出任何保证或承诺。因验证结果产生的任何纠纷或损失,本网站不承担任何责任。
使用本网站的服务可能存在一定的风险,用户应自行承担因使用本网站服务而产生的一切风险和后果。本网站不对用户因使用本网站服务所遭受的任何直接、间接、偶然、特殊及后续的损害负责。<br>
七、法律适用与争议解决<br>
本协议的订立、执行和解释均适用中华人民共和国法律。<br>
</div>
</div>
<!-- 隐私政策模态框 -->
<div id="privacy-modal" class="modal">
<div class="modal-content">
<span class="close" onclick="closeModal('privacy-modal')">&times;</span>
<h2>隐私政策</h2>
<p id="privacy-text">一、我们收集的信息<br>
为了向您提供 mc 玩家身份验证服务,我们会收集以下您的个人信息:<br>
基本注册信息 :包括您设置的用户名、电子邮箱地址和登录密码。
mc 玩家身份信息 :包括您提供的 mc 玩家用户名、uuid。<br>
二、我们如何使用您的信息<br>
用于身份验证:我们将您的 mc 玩家信息用于验证您在 mc 游戏中的身份,以便您能够正常使用本网站提供的相关服务。
提供个性化服务:根据您的身份信息,为您推荐和展示与您相关的 mc 游戏内容、活动等。
服务运营与改进:我们会对收集到的信息进行统计和分析,以优化网站功能、提高服务质量和用户体验。<br>
三、我们如何保护您的信息<br>
本网站采取加密技术采用HTTPS技术传输数据对您的个人信息进行加密处理确保数据在传输和存储过程中的安全性。
我们建立了完善的信息安全管理体系,采取物理、技术和管理等多重安全措施,防止您的信息被泄露、篡改或损坏。
本网站限制了内部员工对用户个人信息的访问权限,只有经过授权的人员在必要情况下才能接触到您的信息,并且他们需要遵守严格的保密义务。<br>
四、我们如何共享您的信息<br>
未经您的明确同意,我们不会向任何第三方共享您的个人信息,但以下情况除外:
法律法规要求或政府机关依职权要求披露时;
为维护本网站的合法权益,如防止欺诈、追究法律责任等;
与我们的合作伙伴共享,但前提是我们的合作伙伴必须遵守本隐私政策的规定,并且仅在为实现服务目的所必需的范围内使用您的信息。
本网站可能会与第三方服务提供商合作,他们可能会收集您的某些信息用于提供相关服务,如数据分析、技术支持等。但我们会对这些第三方进行严格的管理和监督,确保他们遵守我们的隐私政策和安全要求。<br>
五、您对个人信息的控制<br>
您有权随时登录本网站查看、修改或更新您的个人信息。如发现信息有误或不完整,您可以在个人账户设置中进行更正或补充。
您也可以选择删除您的账户和相关信息,但在删除账户后,您将无法继续使用本网站的服务,并且我们可能会保留部分必要的信息以满足法律、安全或统计等要求。<br>
六、未成年人信息保护<br>
如果您是未成年人,请在监护人的授权下使用本网站的一切功能<br>
七、隐私政策的更新<br>
我们可能会根据业务的发展或法律法规的变化适时更新本隐私政策。我们会通过在本网站上发布更新后的隐私政策等方式通知您。如果您继续使用本网站的服务,则表示您接受更新后的隐私政策。
</div>
</div>
<script>
function switchToLogin() {
document.getElementById('auth-title').innerText = '登录至CCS';
document.getElementById('login-form').style.display = 'block';
document.getElementById('register-form').style.display = 'none';
}
function switchToRegister() {
document.getElementById('auth-title').innerText = '注册至CCS';
document.getElementById('login-form').style.display = 'none';
document.getElementById('register-form').style.display = 'block';
}
function validateRegistration() {
const agreement = document.getElementById('agreement').checked;
if (!agreement) {
alert('请先同意用户协议和隐私政策');
return false;
}
return true;
}
function showModal(modalId) {
document.getElementById(modalId).style.display = 'block';
}
function closeModal(modalId) {
document.getElementById(modalId).style.display = 'none';
}
// 默认显示登录表单
window.onload = switchToLogin;
</script>
</body>
</html>