summaryrefslogtreecommitdiff
path: root/keys.php
blob: 08263aec60972468b201cc4e4c410dd10c63b93f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php

require_once "init.php";

if (!array_key_exists('k', $_GET))
  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);
  }
}