function user($login, $password){
$file = file_get_contents(__DIR__ . '/users.txt');
$users = explode("\n", $file);
$all = array();
foreach($users as $str){
$temp = explode(' ', $str);
if( $str[1] ) $all[$temp[0]] = $temp[1];
}
if( $all[$login] == $password ) echo 'ok'; // Check false
if( $all[$login] && $all[$login] == $password )
return true;
return false;
}
admin pass
$all[ $login ]
and $password
, are identical to both (pass and pass), but the test is still false. Why?Find more questions by tags PHP