重定向到不同的分配页,如果用户名和密码是否正确
问题描述:
请我需要关于PHP
错误的帮助,我想在这里重定向到与登录表单输入不同的页面,因为我也不怎么知道如何使管理员后台将用户重定向通过数据库不同的页面,这是我PHP
重定向到不同的分配页,如果用户名和密码是否正确
SCRIPT
//重定向到不同的页面
<?php $userid = $_POST['userid'];
$userpass = $_POST['password'];
if (strcmp($userid, "3495062250") && strcmp($password, "12smith00")) {
header('location: account-dashboard/client_349506_2243/index.html');
} else{ header('location: error.html'); } ?>
答
请检查下面的代码。
你做了错误。
- 在if条件你已经使用
$password
代替$userpass
-
可以在
PHP
$userid = $_POST['userid']; $userpass = $_POST['password']; if ($userid = "3495062250" && $userpass == "12smith00") { header('location: account-dashboard/client_349506_2243/index.html'); } else { header('location: error.html'); }
equal operator字符串用户名']; $为userpass = $ _POST [ '密码'];如果(strcmp($ userid,“3495062250”)&& strcmp($ password,“12smith00”)) { header('location:account-dashboard/client_349506_2243/index.html'); } \t否则{头( '位置:的error.html'); \t} ?> – Kingx
请将您的问题中的代码添加到评论中 –
[PHP登录页面重定向]的可能重复(https://stackoverflow.com/questions/19782194/php-login-page-redirect) –