我遇到了一个以前没有遇到过的问题,我在网上没有找到任何解决方案。
我创建了一个网站,人们可以在其中创建自己的帐户。前端工作完美,看起来很酷很现代。对于
register
和 login
部分,我想使用相同的页面,只是一个简单的过渡。
我已经开始在我的网站上添加一些
php
和 register
部分丢失了。
代码:
<?php
@include 'config.php';
if (isset($_POST['submit'])){
$name = mysqli_real_escape_string($conn, $_POST['nev_regist']);
$email = mysqli_real_escape_string($conn, $_POST['email_regist']);
$password = md5($_POST['pass_regist']);
$password2 = md5($_POST['pass2_regist']);
$select = " SELECT * FROM user_form WHERE email = '$email' && password = '$password' ";
$result = mysqli_query($conn, $select);
if (mysqli_num_rows($result) > 0) {
$error[] = 'This user already exists!';
} else {
if ($password != $password2) {
$error[] = 'Passwords don't match!';
} else {
$insert = "INSERT INTO user_form(name, email, password) VALUES('$name', '$email', '$password')";
mysqli_query($conn, $insert);
header('location:login.php');
};
};
};
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Chinchilla Store</title>
<link rel="stylesheet" href="./CSS/main.css">
<link rel="stylesheet" href="./CSS/text.css">
<link rel="stylesheet" href="./CSS/anim.css">
<link rel="stylesheet" href="./CSS/iconbar.css">
<link rel="stylesheet" href="./CSS/login.css">
<link href="./assets/css/fontawesome.css" rel="stylesheet">
<link href="./assets/css/solid.css" rel="stylesheet">
<link rel="icon" href="./assets/kepek/chinbutt.ico">
</head>
<body>
<div class="icon-bar">
<a class="inactive" href="avaliable.html"><i class="fa fa-paw"></i></a>
<a class="inactive" href="accessories.html"><i class="fa-solid fa-baseball"></i></a>
<a class="inactive" href="keeping.html"><i class="fa-solid fa-house"></i></a>
<a class="inactive" href="characteristics.html"><i class="fa-solid fa-venus-mars"></i></a>
<a class="inactive" href="attain.html"><i class="fa-solid fa-phone"></i></a>
<a class="active" href="login.php"><i class="fa-solid fa-user"></i></a>
</div>
<div class="wrapper">
<form method="post" id="login-method">
<div class="login-form">
<h2>Log in</h2>
<div class="input">
<span class="icon"><i class="fa-solid fa-at"></i></span>
<input type="email" required>
<label>E-mail</label>
</div>
<div class="input">
<span class="icon"><i class="fa-solid fa-key"></i></span>
<input type="password" required>
<label>Password</label>
</div>
<div class="remember-forgot">
<label><input type="checkbox">Remember me | </label><a href="#">Forgot password?</a>
</div>
<button type="submit" class="btn">Logins</button>
<div class="login-regist">
<p>Don't have an account yet? <a href="#" class="regist-link">Register!</a></p>
</div>
</div>
</form>
<form method="post" id="register-method">
<div class="regist-form">
<h2>Register</h2>
<?php
if (isset($error)) {
foreach ($error as $error){
echo '<span class="error-msg">'.$error.'</span>';
};
};
?>
<div class="input">
<span class="icon"><i class="fa-solid fa-signature"></i></span>
<input type="text" name="name_regist" required>
<label>Name</label>
</div>
<div class="input">
<span class="icon"><i class="fa-solid fa-at"></i></span>
<input type="email" name="email_regist" required>
<label>E-mail</label>
</div>
<div class="input">
<span class="icon"><i class="fa-solid fa-key"></i></span>
<input type="password" name="pass_regist" required>
<label>Password</label>
</div>
<div class="input">
<span class="icon"><i class="fa-solid fa-key"></i></span>
<input type="password" name="pass2_regist" required>
<label>Password again</label>
</div>
<div class="tac">
<label><input type="checkbox" name="aszf_regist">Accept Terms and Conditions</label>
</div>
<button type="submit" class="btn" form="register-method">Register</button>
<div class="login-regist">
<p>Have an account already? <a href="#" class="login-link">Log in!</a></p>
</div>
</div>
</form>
</div>
<script src="./assets/JS/login.js"></script>
</body>
</html>
CSS:
.wrapper {
position: fixed;
top: 33%;
left: 42.5%;
margin-top: -100px;
margin-left: -100px;
width: 450px;
height: 400px;
background: transparent;
border: 2px solid #3A3B3C;
border-radius: 20px;
backdrop-filter: blur(20px);
box-shadow: 0 0 30px black;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
animation: fadeIn 1s;
transition: height .2s ease;
}
.wrapper.active {
height: 520px;
}
.wrapper .login-form {
padding: 40px;
transition: transform .18s ease;
transform: translateX(0);
}
.wrapper.active .login-form {
transition: none;
transform: translateX(-400px);
}
.wrapper .regist-form {
position: absolute;
transition: none;
transform: translateX(400px);
}
.wrapper.active .regist-form {
padding: 40px;
transition: transform .18s ease;
transform: translateX(0);
}
.login-form h2 {
font-size: 2em;
color: #3A3B3C;
text-align: center;
}
.regist-form h2 {
font-size: 2em;
color: #3A3B3C;
text-align: center;
}
.input {
position: relative;
width: 100%;
height: 28px;
border-bottom: 2px solid #3A3B3C;
margin: 30px 0;
margin-left: 5px;
font-size: medium;
}
.input label {
position: absolute;
margin-top: 15px;
left: 5px;
transform: translateY(-50%);
font-size: 1em;
color: #3A3B3C;
font-weight: 500;
pointer-events: none;
transition: .5s;
}
.input input:focus~label,
.input input:valid~label {
top: -23px;
}
.input input {
width: 100%;
height: 100%;
background: transparent;
border: none;
outline: none;
font-size: 1em;
color: #3A3B3C;
font-weight: 600;
padding: 0 35px 0 5px;
}
.input .icon {
position: absolute;
margin-top: -15px;
right: 8px;
font-size: 1.2em;
color: #3A3B3C;
line-height: 57px;
}
.remember-forgot {
font-size: .9em;
color: #3A3B3C;
font-weight: 500;
margin: -15px 0 15px;
text-align: center;
}
.aszf {
font-size: .9em;
color: #3A3B3C;
font-weight: 500;
margin: -15px 0 15px;
text-align: center;
}
.remember-forgot label input {
accent-color: #3A3B3C;
}
.aszf label input {
accent-color: #3A3B3C;
}
.remember-forgot a {
color: #3A3B3C;
text-decoration: none;
font-weight: 600;
}
.aszf a {
color: #3A3B3C;
text-decoration: none;
font-weight: 600;
}
.remember-forgot a:hover {
text-decoration: underline;
}
.btn {
width: 100%;
height: 45px;
background: #3A3B3C;
border: none;
outline: none;
border-radius: 6px;
cursor: pointer;
font-size: 1em;
color: white;
font-weight: 500;
margin-top: 7px;
}
.login-regist {
font-size: .9em;
color: #3A3B3C;
text-align: center;
font-weight: 500;
margin: 25px 0 10px;
}
.login-regist p a {
color: #3A3B3C;
text-decoration: none;
font-weight: 600;
}
.login-regist p a:hover {
text-decoration: underline;
}
.regist-form form .error-msg {
margin: 10px 0;
display: block;
background: crimson;
color: white;
border-radius: 20px;
font-size: 20px;
}
我已经尝试完全删除
php
代码以查看是否可以解决问题,但显然没有。
活动视频: https://youtu.be/D5Bgb1IbB9I
提前致谢,
布莱斯
• 无法通过 PHP 绑定和准备语句将表单数据添加到数据库中
• Laravel 8 cors 不适用于 post (api) 请求
• webpack.mix.js 在我的新 Laravel 项目中丢失了
• 创建后对象键消失
• 使用 javascript 将 TBODY 列表添加到表时,TBODY 属性丢失
• 为什么在 swiftUI 中添加框架修改器后 RadialGradient 会丢失其内容
• Laravel Backpack 使用模型 A 创建 CRUD,但在添加时用模型 B 填充它
• 在酒店预订系统 PHP/MySQL 中防止竞争条件和锁表
• 使用 reportlab 和 PyPDF2 合并 PDF 会丢失图像和嵌入字体
• 在 Spotfire 中,当对表执行 Unpivot 时,数据丢失
• php mysql probem..未捕获的mysqli_sql_exception:无法添加或更新子行:外键约束失败