2023-10-25 17:27:33 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
2023-10-27 19:58:27 +08:00
|
|
|
<title>用户注册</title>
|
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
height: 100vh;
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
background-color: #f5f5f5;
|
|
|
|
}
|
|
|
|
|
|
|
|
form {
|
|
|
|
background-color: #ffffff;
|
|
|
|
padding: 20px;
|
|
|
|
border-radius: 5px;
|
|
|
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
|
|
|
}
|
|
|
|
|
|
|
|
.row {
|
|
|
|
margin-bottom: 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.center {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
input {
|
|
|
|
padding: 10px;
|
|
|
|
border: 1px solid #ccc;
|
|
|
|
border-radius: 4px;
|
|
|
|
width: 200px;
|
|
|
|
}
|
|
|
|
|
|
|
|
button {
|
|
|
|
padding: 10px 20px;
|
|
|
|
background-color: #4caf50;
|
|
|
|
color: #ffffff;
|
|
|
|
border: none;
|
|
|
|
border-radius: 4px;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
button:hover {
|
|
|
|
background-color: #45a049;
|
|
|
|
}
|
|
|
|
</style>
|
2023-10-25 17:27:33 +08:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<form onsubmit="return login(this);">
|
|
|
|
<div class="row">
|
|
|
|
<input name="name" placeholder="请输入账号">
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
2023-10-26 17:00:37 +08:00
|
|
|
<input name="password" placeholder="请输入密码">
|
2023-10-25 17:27:33 +08:00
|
|
|
</div>
|
|
|
|
<div class="row center">
|
|
|
|
<button>确认</button>
|
|
|
|
</div>
|
|
|
|
</form>
|
2023-10-26 17:00:37 +08:00
|
|
|
|
2023-10-27 19:58:27 +08:00
|
|
|
<script>
|
|
|
|
function login(form) {
|
|
|
|
let name = form.name.value.trim();
|
|
|
|
let password = form.password.value.trim();
|
2023-10-26 17:00:37 +08:00
|
|
|
|
2023-10-27 19:58:27 +08:00
|
|
|
if (name == "" || password == "") {
|
|
|
|
alert("账号或密码不能为空");
|
|
|
|
return false;
|
|
|
|
}
|
2023-10-26 17:00:37 +08:00
|
|
|
|
2023-10-27 19:58:27 +08:00
|
|
|
let login_data = {
|
|
|
|
name: name,
|
|
|
|
password: password
|
|
|
|
};
|
|
|
|
fetch("../cgi-bin/sqlite_cgi_insert_base.cgi", {
|
|
|
|
method: "POST",
|
|
|
|
body: JSON.stringify(login_data),
|
|
|
|
headers: {
|
|
|
|
"Content-Type": "application/json;charset=utf-8"
|
|
|
|
}
|
|
|
|
});
|
|
|
|
open("./login.html", "_self");
|
2023-10-26 17:00:37 +08:00
|
|
|
return false;
|
|
|
|
}
|
2023-10-27 19:58:27 +08:00
|
|
|
</script>
|
|
|
|
</body>
|
2023-10-26 17:00:37 +08:00
|
|
|
|
2023-10-27 19:58:27 +08:00
|
|
|
</html>
|