登录页面(login.html)。
<!DOCTYPE html> <html> <head> <title>登录页面</title> </head> <body> <h2>登录</h2> <form action="login_process.php" method="post"> <div> <label for="username">用户名:</label> <input type="text" id="username" name="username" required> </div> <div> <label for="password">密码:</label> <input type="password" id="password" name="password" required> </div> <div> <input type="submit" value="登录"> </div> </form> </body> </html>
注册页面(register.html):
<!DOCTYPE html> <html> <head> <title>注册页面</title> </head> <body> <h2>注册新用户</h2> <form action="register_process.php" method="post"> <div> <label for="username">用户名:</label> <input type="text" id="username" name="username" required> </div> <div> <label for="email">电子邮件:</label> <input type="email" id="email" name="email" required> <!-- 用于验证电子邮件格式 --> </div> <div> <label for="password">密码:</label> <input type="password" id="password" name="password" required minlength="8"> <!-- 设置密码最小长度 --> </div> <!-- 可以根据需要添加更多字段,如确认密码、手机号码等 --> <div> <input type="submit" value="注册"> </div> </form> </body> </html>
上述代码只是前端页面的示例,后端处理逻辑(如验证用户输入、存储用户信息等)需要相应的PHP或其他后端语言来实现,为了增强安全性,还需要考虑防止SQL注入、密码加密存储等措施,在实际开发中,建议使用成熟的框架和库来处理这些任务。