<?php
$data = $_POST;
$name = $data['name'];
$pwd = $data['pwd'];
$m = new MongoDB\Driver\Manager("mongodb://localhost:27017");
// 第一
$filter = ['name'=>$name,'pwd'=>$pwd];
// 第二
$options = [
];
$query = new MongoDB\Driver\Query($filter, $options);
$cursor = $m->executeQuery('php.user',$query);
$data=[];
foreach ($cursor as $document) {
$data[] = $document;
}
if($data){
echo "<script>alert('登录成功');location.href='list.php'</script>";
}
else
{
echo "<script>alert('登录失败');location.href='login.php'</script>";
}
$data = $_POST;
$name = $data['name'];
$pwd = $data['pwd'];
$m = new MongoDB\Driver\Manager("mongodb://localhost:27017");
// 第一
$filter = ['name'=>$name,'pwd'=>$pwd];
// 第二
$options = [
];
$query = new MongoDB\Driver\Query($filter, $options);
$cursor = $m->executeQuery('php.user',$query);
$data=[];
foreach ($cursor as $document) {
$data[] = $document;
}
if($data){
echo "<script>alert('登录成功');location.href='list.php'</script>";
}
else
{
echo "<script>alert('登录失败');location.href='login.php'</script>";
}