Answer the question
In order to leave comments, you need to log in
How to make an assignment to?
Hello. There is the following code
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$logins = $_SERVER['DOCUMENT_ROOT'] . '/data/login.php';
$passwords = $_SERVER['DOCUMENT_ROOT'] . '/data/password.php';
$login = $_POST['login'] ?? '';
$pass = $_POST['pass'] ?? '';
if (($k = array_search($login, $logins)) !== false)
($k = array_search($login, $logins)) !== false
Answer the question
In order to leave comments, you need to log in
The function array_search($login, $logins)
should look in the array of logins $logins
, but in fact it is not an array at all, but a string that looks something like this: "/var/nginx/html/data/login.php"
.
I suspect that the array of logins is in the login.php file like this:
<?php
return [
'admin',
'user1',
'Ivan'
];
?>
$logins = require $_SERVER['DOCUMENT_ROOT'] . '/data/login.php';
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question