index : website | |
Archlinux32 website - obsolete | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | keys.php | 18 |
@@ -2,17 +2,21 @@ require_once "init.php"; -if (!array_key_exists('k', $_GET)) +if (!array_key_exists('k', $_GET)) { + print 'There are ' . shell_exec('gpg --list-keys --with-colons | grep "^fpr:" | cut -d: -f10 | wc -l') . ' keys on this server.'; die(); +} if (preg_match('/^[0-9A-Fa-f]{16,40}$/', $_GET['k']) !== 1) die(); $output = shell_exec('gpg -a --export ' . $_GET['k']); print $output; -if (empty($output)) { - $fh = fopen('key-wishlist', 'a'); - if ($fh !== false) { - fwrite($fh, $_GET['k'] . "\n"); - fclose($fh); - } + +if (! empty($output)) + die(); + +$fh = fopen('key-wishlist', 'a'); +if ($fh !== false) { + fwrite($fh, $_GET['k'] . "\n"); + fclose($fh); } |