<input type="text" name="username"/>
        <input type="password" name="pass"/>
        <input type="submit" value="Login"/>
      </form>');
} else {
    setcookie('chimpunlock', "{$username}|{$password}");
    #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);