Javascript 根据密码将用户定向到多个页面的登录表单
有人能告诉我如何设置我下面的表单以登录到与密码同名的不同页面吗。例如用户名:David密码:Customer1 这将引导用户访问customer1.html 用户名:Steve Password:customer8,将用户指向customer8.html。我记得几年前看过一篇关于使用Javascript的教程,但现在我找不到任何关于如何做到这一点的内容 提前谢谢Javascript 根据密码将用户定向到多个页面的登录表单,javascript,php,jquery,login,Javascript,Php,Jquery,Login,有人能告诉我如何设置我下面的表单以登录到与密码同名的不同页面吗。例如用户名:David密码:Customer1 这将引导用户访问customer1.html 用户名:Steve Password:customer8,将用户指向customer8.html。我记得几年前看过一篇关于使用Javascript的教程,但现在我找不到任何关于如何做到这一点的内容 提前谢谢 <form name="password1"> <blockquote> <blockquote>
<form name="password1">
<blockquote>
<blockquote>
<p align="center">Client Login</p>
<p><strong>Username: </strong>
<input type="text" name="username2" size="15">
<br>
<strong>Password: </strong>
<input type="password" name="password2" size="15">
</p>
<div align="center">
<input type="button" value="Submit" onclick="submitentry()" />
</div>
</blockquote>
</blockquote>
客户端登录
用户名:
密码:
如评论中所述&由于您在问题中标记了PHP,因此我为您提供了一个基于服务器的解决方案 index.html
<form name="password1" action="check.php" method="POST">
<blockquote>
<p align="center">Client Login</p>
<p><strong>Username: </strong>
<input type="text" name="username2" size="15">
<br>
<strong>Password: </strong>
<input type="password" name="password2" size="15">
</p>
<div align="center">
<input type="submit" value="Submit" />
</div>
</blockquote>
</form>
客户端登录
用户名:
密码:
check.php
<?php
if(isset($_POST['password2'])){
$password = stripslashes($_POST['password2']);
$password = mysqli_real_escape_string($password);
// You may verify whether the username & password entered matches with database or not
$address = "$password".".html";
header("location: $address");
}
?>
在您的check.php中
选择要检查的用户名和密码
使用IF-ELSE使其工作
if($password = 'customer1')
{
header("location: customer1.html");
exit;
}
.
.
.
else if($password = 'customer8')
{
header("location: customer8.html");
exit;
}
如果您想要任何安全的外观,需要在服务器上完成Submitery()中的操作