文件
ParlzPackageManger/web/ppdm/register.php
T
JGZYES 97c262a5b2 feat: rename pmu -> ppdm (ParlzPackageDevManager) + pack/update commands
- 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.
2026-09-06 11:12:30 +08:00

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]);