コード例 #1
0
    #header('Location: '.$_SERVER['PHP_SELF']) and die();
}
$mc->closeOneOhSecurityHole($username, $password) or $mc->errorCode == 101 or die('Security hole still open.' . $mc->errorCode . ': ' . $mc->errorMessage);
if (isset($_REQUEST['action'])) {
    switch ($_REQUEST['action']) {
        case 'expire':
            $mc->apikeyExpire($username, $password);
            break;
        case 'add':
            $mc->apikeyAdd($username, $password, $_REQUEST['key']);
            break;
    }
    header('Location: ' . $_SERVER['PHP_SELF']) and die;
}
echo '
    <table>
      <thead>
        <tr>
          <th>key</th>
          <th></th>
        </tr>
      </thead>
      <tbody>';
foreach ($mc->apikeys($username, $password, true) as $key) {
    extract($key);
    echo "\n    <tr>\n      <td>{$apikey}</td>\n      <td>{$created_at}</td>\n      <td>{$expired_at}</td>\n      <td><a href='?action=expire&key={$apikey}' class='cmd expire'>expire</a></td>\n    </tr>";
}
echo "\n      </tbody>\n    </table>";
?>
  <a href="?action=add" class='cmd add'>add new</a>