Ejemplo n.º 1
0
    setcookie('chimpunlock', null);
    die((isset($_POST['username']) ? 'Couldn\'t log in: ' . $mc->errorMessage : '') . '
      <form action="#" method="POST">
        <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>
<?php

/**
This Example shows how to expire an API key using the MCAPI.php class and do 
some basic error checking.
**/
require_once '../mcapi.php';
require_once 'config/config.inc.php';
//contains apikey
$api = new MCAPI($apikey);
$retval = $api->apikeyExpire($username, $password);
if ($api->errorCode) {
    echo "Unable to Expire API Key()!";
    echo "\n\tCode=" . $api->errorCode;
    echo "\n\tMsg=" . $api->errorMessage . "\n";
} else {
    echo "API Key Expired:" . $api->api_key . "\n";
}