我已经在 php 中创建了一个管理员登录页面。我有 2 个管理员,每个管理员都有单独的管理面板。登录时我给出了以下代码来检查用户名和密码:
<?php
session_start();
error_reporting(0);
include 'includes/dbconnection.php';
if (isset($_POST['login'])) {
$adminuser = $_POST['username'];
$password = md5($_POST['password']);
$query = mysqli_query($con, "select ID from tbladmin where UserName='$adminuser' && Password='$password' ");
$ret = mysqli_fetch_array($query);
if ($ret > 0) {
$_SESSION['cvmsaid'] = $ret['ID'];
header('location:dashboard.php');} else {
$msg = "Invalid Details.";
}
}
?>
对于第一位管理员,我为仪表板提供了以下内容:
<?php
date_default_timezone_set('Asia/Kolkata');
session_start();
error_reporting(0);
include('includes/dbconnection.php');
error_reporting(0);
if (strlen($_SESSION['cvmsaid']==0)) {
header('location:logout.php');
}
else if (strlen($_SESSION['cvmsaid']==2)) {
header('location:dashboard2.php');
}
else{ ?>
这对于第一个管理员来说工作得很好。
对于第二位管理员,我给出了以下内容:
<?php
date_default_timezone_set('Asia/Kolkata');
session_start();
error_reporting(0);
include('includes/dbconnection.php');
error_reporting(0);
if (strlen($_SESSION['cvmsaid']==0)) {
header('location:logout.php');
}
else if (strlen($_SESSION['cvmsaid']==1)) {
header('location:dashboard.php');
}
else{ ?>
现在,当第二个管理员登录时,我收到以下错误:
每当我登录时,我都会收到此警报框,我也尝试过更改密码。谁能告诉我我的代码有什么问题吗?提前致谢。
最佳答案
确认这是来自 Chrome 的真实消息。当您在网站中输入凭据时,如果您的用户名和密码因某些网站或应用程序的数据泄露而受到泄露,Chrome 现在会向您发出警告。它会建议您在使用它们的地方进行更改。
您可以在 Chrome 设置中的“同步和 Google 服务”下控制此功能。目前,它正在逐步向所有登录 Chrome 的用户推出,作为 Google 安全浏览保护的一部分。
关于php 登录仪表板在 Chrome 中显示数据泄露警报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59527925/