如果用户名和密码正确,则重定向到不同的指定页面

Redirect to different assigned pages if username and password correct

我需要有关 PHP 错误的帮助,我想在此处使用表单登录输入重定向到不同的页面,因为我不知道如何让管理员后端通过以下方式将用户重定向到不同的页面数据库,这是我的 PHP

剧本

// 重定向到不同的页面

<?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
  • 您可以简单地使用 equal operatorPHP

    中比较字符串
    $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');
    }