镜像自地址
https://github.com/JGZYES/ParlzPackageManger.git
已同步 2026-09-11 05:42:44 +08:00
- src/pmu.c -> src/ppdm.c; web/pmu -> web/ppdm (server default https://pmm.parlz.com/ppdm, config ~/.ppdm). - ppdm commands: register (local arithmetic captcha), login/logout/whoami, 'ppdm pack <dir> [out]' (build a .pdm via pdm_pack), 'ppdm update' (download latest ppdm binary from GitHub release to ~/.ppdm/bin/ppdm), './x.pdm' publish, help. - links pdm.c (+ the pmm stack) so pack works; release.yml builds 'ppdm' per-platform. - i18n init so messages resolve.
19 行
756 B
PHP
19 行
756 B
PHP
<?php
|
|
/* web/pmu/register.php — create an account. Human verification is done client-side:
|
|
* the pmu client asks a local arithmetic question before calling here. */
|
|
define('PMM_SITE', 1);
|
|
require __DIR__ . '/lib.php';
|
|
|
|
$d = pmu_read_json();
|
|
$email = trim((string)($d['email'] ?? ''));
|
|
$pass = (string)($d['password'] ?? '');
|
|
if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) pmu_fail('invalid email');
|
|
if (strlen($pass) < 6) pmu_fail('password too short (>= 6 chars)');
|
|
|
|
$users = pmu_load('users.json');
|
|
if (isset($users[$email])) pmu_fail('email already registered', 409);
|
|
|
|
$users[$email] = ['email' => $email, 'hash' => password_hash($pass, PASSWORD_DEFAULT), 'created' => time()];
|
|
pmu_save('users.json', $users);
|
|
pmu_ok(['email' => $email]);
|