20 lines
835 B
PHP
20 lines
835 B
PHP
<?php
|
|
// WEVAL Password Store — DEFINITIVE
|
|
// DO NOT EDIT with sed/regex/preg_replace — use PHP only
|
|
// Generated: 2025-03-25
|
|
// To update: php -r '$p=json_decode(file_get_contents("/var/www/html/api/weval-passwords.json"),true); $p["user"]="newpass"; file_put_contents("/var/www/html/api/weval-passwords.json",json_encode($p,JSON_PRETTY_PRINT));'
|
|
|
|
function weval_verify_password($user, $pass) {
|
|
$file = __DIR__ . '/weval-passwords.json';
|
|
if (!file_exists($file)) return false;
|
|
$users = json_decode(file_get_contents($file), true);
|
|
if (!$users || !isset($users[$user])) return false;
|
|
return $pass === $users[$user]['password'];
|
|
}
|
|
|
|
function weval_get_users() {
|
|
$file = __DIR__ . '/weval-passwords.json';
|
|
if (!file_exists($file)) return [];
|
|
return json_decode(file_get_contents($file), true) ?: [];
|
|
}
|