summaryrefslogtreecommitdiff
path: root/keys.php
blob: 5b398fc458cd4aecec4f04a3761356102210a7f9 (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]{40}$/', $_GET['k']) === false)
  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);
  }
}