本文整理汇总了PHP中api::valid方法的典型用法代码示例。如果您正苦于以下问题:PHP api::valid方法的具体用法?PHP api::valid怎么用?PHP api::valid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api
的用法示例。
在下文中一共展示了api::valid方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setImageLinks
private function setImageLinks()
{
// Load the API for the user.
$api = new api($this->ID);
// Set/Get the image.
if ($api->valid()) {
$this->smallPicUrl = "<img src=\"https://image.eveonline.com/Character/" . $api->getCharacterID() . "_64.jpg\">";
$this->largePicUrl = "<img src=\"https://image.eveonline.com/Character/" . $api->getCharacterID() . "_256.jpg\">";
}
}
示例2: authVerify
function authVerify($username, $password, $trust = false)
{
global $DB;
global $TIMEMARK;
// lower case it.
$username = strtolower($username);
if (!isset($_SESSION['testauth'])) {
$url = "https://auth.pleaseignore.com/api/1.0/login?user={$username}&pass={$password}";
$contents = file_get_contents($url);
$obj = json_decode($contents, TRUE);
} else {
$obj = $_SESSION['testauth'];
}
// and query it.
if (!$password && $trust) {
// Passwordless login (WAHHHHH!!!!)
$userDS = $DB->query("select * from users where username='{$username}' AND deleted='0' limit 1");
$passwordless = true;
} else {
if ($obj['auth'] == "ok" && !isset($_SESSION['testauth'])) {
// TEST Authentication
$_SESSION['testauth'] = $obj;
makeLoginPage($SUPPLIED_USERNAME);
} else {
if ($obj['auth'] == "ok" && isset($_SESSION['testauth'])) {
$userDS = $DB->query("select * from users where username='{$username}' AND deleted='0' limit 1");
$passwordless = false;
} else {
if (!$password) {
return false;
}
}
}
}
if ($passwordless) {
$user = $userDS->fetchRow();
} else {
if ($obj['auth'] != "ok") {
// No one found
$_SESSION['failedLogins']++;
// Log failed attempts.
$user_valid = $DB->getCol("SELECT COUNT(username) FROM users WHERE username = '{$username}' LIMIT 1");
$user_valid = $user_valid[0];
$DB->query("INSERT INTO failed_logins (time, ip, username, username_valid, agent) VALUES (?,?,?,?,?)", array($TIMEMARK, "{$_SERVER['REMOTE_ADDR']}", stripslashes(sanitize($username)), $user_valid, sanitize($_SERVER['HTTP_USER_AGENT'])));
return false;
} else {
if ($userDS->numRows() == 0 && $obj['auth'] == "ok") {
// User is a TEST user but does not have an account
$DB->query("insert into users (username, password, email, " . "addedby, confirmed, emailvalid,canLogin,authID) " . "values (?, ?, ?, ?, ?,?, ?, ?)", array(stripcslashes($username), "", $obj['email'], 1, 1, 1, 1, $obj[id]));
// Were we successful?
if ($DB->affectedRows() == 0) {
// No!
makeNotice("Could not create user!", "error");
} else {
// Yes
$userDS = $DB->query("select * from users where username='{$username}' AND deleted='0' limit 1");
$user = $userDS->fetchRow();
}
} else {
if ($userDS->numRows() > 0 && $obj['auth'] == "ok") {
// Try TEST Auth
$user = $userDS->fetchRow();
if ($user['authID'] == null) {
$DB->query("update users set authID='{$obj['id']}' where id='{$user['id']}'");
}
if ($user['authID'] == null) {
$DB->query("update users set authID='{$obj['id']}' where id='{$user['id']}'");
}
if ($user == null) {
return false;
makeNotice("Your account is not a member of the B0rthole user group." . "<br>Please join the group on TEST Auth.", "error", "Unable to login");
}
}
}
}
}
// Is the account activated yet?
if ("{$user['canLogin']}" != "1" || "{$user['confirmed']}" != "1") {
// Nyet!
makeNotice("Your account has not yet been activated or been blocked." . "<br>Please ask your CEO for assistance.", "error", "Unable to login");
} else {
/* HOLD IT RIGHT THERE!
* We have a login from IGB with valid trust setting. BUT HEY!
* Does the API key match?
*/
if ($passwordless) {
// Just return the account as we're using TEST 'leetsauce' auth.
$MyAccount = new user($user, $TIMEMARK);
return $MyAccount;
// Load the api!
$api = new api($user['id']);
if (!$api->valid()) {
// NO valid api key!!!!11
session_destroy();
makenotice("For fast login you need to supply your API key. Log in to MiningBuddy out of game and set your API key under preferences. Only then can you do fast logins. <a href=\"http://myeve.eve-online.com/api/default.asp?\">Visit the EVE api page here (right click, copy URL)</a>", "warning", "ACCESS DENIED");
die;
// return (false);
} else {
$MyAccount = new user($user, $TIMEMARK);
return $MyAccount;
//.........这里部分代码省略.........
示例3: profile
function profile()
{
// The usual suspects.
global $MySelf;
global $DB;
// Set the ID.
$ID = sanitize($_GET[id]);
numericCheck($_GET[id], 0);
// Load the profile.
$profile = new profile($ID);
$username = ucfirst(idToUsername($ID));
// Cache our permissions.
$canSeeUsers = $MySelf->canSeeUsers();
// Need the api.
$api = new api($ID);
// Create table header.
$table = new table(2, true);
$table->addHeader(">> About " . $username);
$table->addRow();
$table->addCol("Current rank:");
$table->addCol(getRank($ID));
$table->addRow();
$table->addCol("Last login:");
$lastLog = $DB->getCol("SELECT lastlogin FROM users WHERE id='" . $ID . "' AND deleted='0' LIMIT 1");
$table->addCol(date("d.m.y. H:i:s", $lastLog[0]));
$table->addRow();
$table->addCol("Total logins:");
$lastLog = $DB->getCol("SELECT COUNT(authkey) FROM auth WHERE user='" . $ID . "' LIMIT 1");
$table->addCol(number_format($lastLog[0], 0));
$table->addRow();
$table->addCol("Valid api-key on file:");
$table->addCol(yesno($api->valid(), true));
$table->addRow();
$table->addCol("Is available for mining:");
if ($profile->isOwn()) {
if ($profile->MinerFlag()) {
$temp = " [<a href=\"index.php?action=modprofile&id=" . $ID . "&mining=false\">set not available</a>]";
} else {
$temp = " [<a href=\"index.php?action=modprofile&id=" . $ID . "&mining=true\">set available</a>]";
}
}
$table->addCol(yesno($profile->MinerFlag(), true) . $temp);
$table->addRow();
$table->addCol("Is available for hauling:");
if ($profile->isOwn()) {
if ($profile->HaulerFlag()) {
$temp = " [<a href=\"index.php?action=modprofile&id=" . $ID . "&hauling=false\">set not available</a>]";
} else {
$temp = " [<a href=\"index.php?action=modprofile&id=" . $ID . "&hauling=true\">set available</a>]";
}
}
$table->addCol(yesno($profile->HaulerFlag(), true) . $temp);
$table->addRow();
$table->addCol("Is available for fighting:");
if ($profile->isOwn()) {
if ($profile->FighterFlag()) {
$temp = " [<a href=\"index.php?action=modprofile&id=" . $ID . "&fighting=false\">set not available</a>]";
} else {
$temp = " [<a href=\"index.php?action=modprofile&id=" . $ID . "&fighting=true\">set available</a>]";
}
}
$table->addCol(yesno($profile->FighterFlag(), true) . $temp);
if ($profile->emailVisible() || $profile->isOwn()) {
if ($profile->isOwn()) {
if ($profile->emailVisible()) {
$temp = " (public) [<a href=\"index.php?action=modprofile&id=" . $ID . "&email=hide\">hide from public</a>]";
} else {
$temp = " (hidden) [<a href=\"index.php?action=modprofile&id=" . $ID . "&email=show\">make public</a>]";
}
}
$table->addRow();
$table->addCol("Email address:");
$email = $DB->getCol("SELECT email FROM users WHERE id='" . $ID . "' LIMIT 1");
$table->addCol($email[0] . $temp);
}
// Statistics.
$stats = new table(2, true);
$stats->addHeader(">> Statistical breakdown");
$miningRunsJoined = $DB->getCol("SELECT COUNT(id) FROM joinups WHERE userid='" . $ID . "'");
$miningRunsJoined = $miningRunsJoined[0];
$OpjoinUps = $DB->getCol("SELECT COUNT(id) FROM joinups WHERE userid='" . $ID . "'");
$OpjoinUps = $OpjoinUps[0];
$joinUps = $DB->getCol("SELECT COUNT(id) FROM (SELECT * from joinups WHERE userid='" . $ID . "' GROUP BY run) as uJoinups");
$joinUps = $joinUps[0];
$haulingRuns = $DB->getCol("SELECT COUNT(id) FROM hauled WHERE hauler='" . $ID . "'");
$haulingRuns = $haulingRuns[0];
$timeMining = $DB->getCol("SELECT SUM(parted - joined) FROM joinups WHERE userid='" . $ID . "' AND parted >1");
$timeMining = $timeMining[0];
$timesKicked = $DB->getCol("SELECT COUNT(id) FROM joinups WHERE userid='" . $ID . "' AND status='1'");
$timesKicked = $timesKicked[0];
$timesRemoved = $DB->getCol("SELECT COUNT(id) FROM joinups WHERE userid='" . $ID . "' AND status='2'");
$timesRemoved = $timesRemoved[0];
$timesBanned = $DB->getCol("SELECT COUNT(id) FROM joinups WHERE userid='" . $ID . "' AND status='3'");
$timesBanned = $timesBanned[0];
$timesCharity = $DB->getCol("SELECT COUNT(id) FROM (SELECT * from joinups WHERE userid='" . $ID . "' GROUP BY run) as uJoinups WHERE userid='" . $ID . "' AND charity='1'");
$timesCharity = $timesCharity[0];
$tmec = $DB->getCol("SELECT AVG(tmec) FROM runs WHERE isOfficial = 1");
$tmecJoined = $DB->getCol("SELECT AVG(runs.tmec) FROM joinups, runs WHERE joinups.userid='" . $ID . "' AND joinups.run = runs.id AND runs.endtime > 0 AND runs.isOfficial = 1");
$tmecNotJoined = $DB->getCol("SELECT AVG(runs.tmec) FROM joinups, runs WHERE joinups.userid='" . $ID . "' AND joinups.run <> runs.id AND runs.endtime > 0 AND runs.isOfficial = 1");
$tmecDiff = $tmecJoined[0] - $tmecNotJoined[0];
//.........这里部分代码省略.........
示例4: listUser
function listUser()
{
global $DB;
global $MySelf;
global $IGB;
global $TIMEMARK;
global $IGB_VISUAL;
// Are we allowed to peek into peoples files?
if (!$MySelf->canSeeUsers()) {
makeNotice("You are not allowed to do this!", "error", "forbidden");
}
// Is the supplied ID truly numeric?
if (!is_numeric($_GET[id])) {
makeNotice("Why would you do such a thing? Are you evil at heart? Lets assume its a \"mistake\" for now..", "warning", "*cough*", "index.php?action=editusers", "I'm sorry...");
} else {
$id = (int) $_GET[id];
}
// Query the database.
$users = $DB->query("select * from users where id='{$id}' AND deleted='0' limit 1");
// Build the tables.
while ($row = $users->fetchRow()) {
$table = new table(2, true);
$table->addHeader(">> Managing user " . ucfirst($row[username]));
$username = ucfirst($row[username]);
$table->addRow();
$table->addCol("ID:");
$table->addCol(str_pad("{$row['id']}", 5, "0", STR_RIGHT_PAD));
$table->addRow();
$table->addCol("Username:");
// Allow ubah-admins to change usernames. WAH, can of worms!
if ($MySelf->isAdmin() && $MySelf->canManageUser()) {
$uname_temp = strtolower($row[username]);
$field_temp = "<input type=\"text\" name=\"username\" value=\"" . $uname_temp . "\">";
$confi_temp = "<input type=\"checkbox\" name=\"username_check\" value=\"true\">";
$table->addCol($field_temp . " (changing username tick here also: " . $confi_temp . ")");
} else {
$table->addCol(ucfirst($row[username]));
}
$table->addRow();
$table->addCol("eMail:");
$table->addCol("<input type=\"text\" size=\"40\" name=\"email\" value=\"" . ($row[email] == "" ? 'no email supplied' : $row[email]) . "\">");
$table->addRow();
$table->addCol("Password:");
$table->addCol("<input type=\"password\" size=\"40\" name=\"password\">");
// Ranks System
$RanksDS = $DB->query("SELECT * FROM ranks ORDER BY rankOrder ASC");
$rankCount = $RanksDS->numRows();
if ($rankCount >= 1) {
// We have at least 1 rank.
while ($rank = $RanksDS->fetchRow()) {
if ($rank[rankid] == $row[rank]) {
// The current rank is selected.
$rank_pdm .= "<option SELECTED value=\"{$rank['rankid']}\">{$rank['name']}</option>";
} else {
// The others of course, are not.
$rank_pdm .= "<option value=\"{$rank['rankid']}\">{$rank['name']}</option>";
}
}
$rankColumn = "<select name=\"rank\">" . $rank_pdm . "</select>";
} else {
// No rank has been set yet.
$rankColumn = "There are no ranks. Go create some!";
}
$table->addRow();
$table->addCol("Rank:");
$table->addCol($rankColumn);
$table->addRow();
$table->addCol("Last login:");
// Handle folks that never logged in.
if ("{$row['lastlogin']}" < 10) {
$table->addCol("never");
} else {
$table->addCol(date("d.m.y H:i:s", $row[lastlogin]));
}
$table->addRow();
$table->addCol("Credits:");
$table->addCol(number_format(getCredits($row[id]), 2) . " ISK");
// Is the account confirmed?
if ("{$row['confirmed']}" == "0") {
$table->addRow();
$table->addCol("Account confirmed:");
$table->addCol("This account has <b>not</b> been confirmed yet.");
$table->addRow();
$table->addCol("Confirm account:");
$table->addCol("<input type=\"checkbox\" name=\"confirm\" value=\"true\"> Tick box to confirm account. <br><br>This is a one-way action only. Once an account" . " has been confirmed you can not unconfirm it. Tho you can block or delete it." . " Be careful not to confirm an account by accident - you could allow a non-authorized third party to access your MiningBuddy!");
$table->addRow();
$table->addCol("Account confirmed:");
// Give a red light if user has not even verified himself.
if ("{$row['emailvalid']}" == "0") {
$table->addCol("<b>WARNING!</b><br> The User has not yet verified this email yet! If you choose to enable" . " this account at this time, be very sure that you know the person requesting the account!", array("bgcolor" => "#662222"));
} else {
$table->addCol("<br><br><b>The user validated the email address.</b><br>");
}
} else {
$table->addRow();
$table->addCol("This account has been confirmed.");
if ("{$row['emailvalid']}" == "0") {
$table->addCol("<font color=\"#ff0000\">WARNING!</b></font><br> The User has not verified this email but the account has been confirmed!");
// Add a "confirm email" checkbox.
$table->addRow();
//.........这里部分代码省略.........
示例5: payout
function payout()
{
// Some globals needed.
global $DB;
global $TIMEMARK;
global $MySelf;
global $IGB;
global $IGB_VISUAL;
// Are we allowed to do this?
if (!$MySelf->isAccountant()) {
makeNotice("You are not an accountant to your corporation. Access denied.", "error", "Access denied");
}
/*
* Amount of ISK owned.
*/
$iskOwned = new table(2, true);
$iskOwned->addHeader(">> Outstanding ISK");
// Load all unique members from the database.
$uniqeMembers = $DB->query("SELECT DISTINCT id FROM users WHERE deleted='0' ORDER BY username ASC");
// Create a row for each member.
while ($id = $uniqeMembers->fetchRow()) {
$playerCreds = getCredits($id['id']);
// We need this later on...
$allPeeps[$id['id']] = ucfirst(idToUsername($id['id']));
// if the member has more or less than zero isk, list him.
if ($playerCreds != 0) {
$iskOwned->addRow();
$iskOwned->addCol("<a href=\"index.php?action=showTransactions&id=" . $id['id'] . "\">" . $allPeeps[$id['id']] . "</a>");
$iskOwned->addCol(number_format($playerCreds, 2) . " ISK");
}
}
// Show the total isk owned.
$outstanding = totalIskOwned();
$iskOwned->addRow("#060622");
$iskOwned->addCol(">> Total Outstanding ISK:");
$iskOwned->addCol(totalIskOwned() . " ISK");
/*
* Show a drop down menu to create a menu to see everyones transaction log.
*/
$freeSelect = new table(2, true);
$freeSelect->addHeader(">> Lookup specific transaction log");
// Create a PDM for all the peoples.
foreach ($allPeeps as $peep) {
$pdm .= "<option value=\"" . array_search($peep, $allPeeps) . "\">{$peep}</option>";
}
$freeSelect->addRow();
$freeSelect->addCol("Show log of ", array("align" => "right"));
$freeSelect->addCol("<select name=\"id\">{$pdm}</select>");
$freeSelect->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Lookup log in Database\">");
unset($pdm);
/*
* Show current requests
*/
$requests = $DB->query("SELECT * FROM payoutRequests WHERE payoutTime IS NULL ORDER BY time DESC");
if ($IGB && $IGB_VISUAL) {
$table = new table(6, true);
} else {
$table = new table(5, true);
}
$table->addHeader(">> Pending payout requests");
$table->addRow("#060622");
$table->addCol("request");
$table->addCol("applicant");
if ($IGB && $IGB_VISUAL) {
$table->addCol("right click menu");
}
$table->addCol("time");
$table->addCol("amount");
$table->addCol("Payout");
while ($request = $requests->fetchRow()) {
if ($IGB && $IGB_VISUAL) {
$api = new api($request['applicant']);
// $profile = new profile($request['applicant']);
if ($api->valid() && ($IGB && $IGB_VISUAL)) {
$rcm = " [<a href=\"showinfo:1378//" . $api->getCharacterID() . "\">RCM</a>]";
}
}
$table->addRow();
$table->addCol("#" . str_pad($request['request'], "5", "0", STR_PAD_LEFT));
$table->addCol("<a href=\"index.php?action=showTransactions&id={$request['applicant']}\">" . ucfirst(idToUsername($request['applicant'])) . "</a>");
if ($IGB && $IGB_VISUAL) {
$table->addCol($rcm);
}
$table->addCol(date("d.m.y H:i:s", $request['time']));
if (getCredits($request['applicant']) < $request['amount']) {
$class .= "red";
}
if ($IGB && $IGB_VISUAL) {
$table->addCol("<input type=\"text\" class=\"{$class}\" name=\"dumb\" readonly value=\"" . number_format($request['amount'], 2) . "\"> ISK");
} else {
$table->addCol(number_format($request['amount'], 2) . " ISK", array("class" => $class));
}
// Can the user still cover his request with cash?
$table->addCol("<input type=\"checkbox\" name=\"" . $request['request'] . "\" value=\"true\">");
$haveRequest = true;
//} else {
// $table->addCol("<i>not enough ISK</i>");
//}
}
$table->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Mark as paid\">");
//.........这里部分代码省略.........
示例6: listUsers
function listUsers()
{
// Some major vars importing...
global $DB;
global $MySelf;
// Are we allowed to be here?
if (!$MySelf->canSeeUsers()) {
makeNotice("You are not allowed to list users!", "error", "forbidden");
}
// Easy-for-the-coder table generator.
$fields = array("ID", "Username", "Last Login", "can Login", "Confirmed", "Email OK", "API verified");
// Show only new users.
if ($_GET["newusers"] == "true") {
$users = $DB->Query("SELECT * FROM users WHERE confirmed='0' AND emailvalid='1' AND deleted ='0' ORDER BY username ASC;");
$showOnlyNew = true;
$newOnlyUrlAddition = "&newusers=true";
} else {
// Sorting switch, called by browser.
switch ("{$_GET['sort']}") {
case "0":
$SORT = "id";
break;
case "1":
$SORT = "username";
break;
case "2":
$SORT = "lastlogin";
break;
case "3":
$SORT = "canLogin";
break;
case "4":
$SORT = "confirmed";
break;
case "5":
$SORT = "emailvalid";
break;
default:
$SORT = "username";
break;
}
// Normal or reverse sorting.
if ($_GET["r"] == "true") {
// Reverse sorting!
$SORTORDER = "DESC";
} else {
// Normal Order
$SORTORDER = "ASC";
}
// Limit folks.
if (isset($_GET[sort])) {
$sort = "&sort=" . $_GET[sort];
}
$folkCount = $DB->getCol("SELECT count(id) FROM users");
if ($folkCount[0] > 25) {
if (isset($_GET[l])) {
$l = sanitize($_GET[l]);
} else {
$l = "a";
}
// make the clickable thingy.
for ($p = "a"; $p != "aa"; $p++) {
$count = $DB->getCol("SELECT id FROM users WHERE username LIKE '" . $p . "%' AND confirmed='1'");
if ($count[0] > 0) {
$clickThingy .= " [<a href=\"index.php?action=editusers&l=" . $p . $sort . $newOnlyUrlAddition . "\">" . $p . "</a>]";
} else {
$clickThingy .= " [" . $p . "]";
}
}
}
if ($_GET[sort] == "6") {
$users = $DB->query("select * from users, api_keys where users.confirmed='1' AND users.deleted='0' AND api_keys.userid = users.id AND username LIKE '" . $l . "%' order by users.username {$SORTORDER}");
} else {
// Query the database according to rights.
$users = $DB->query("select * from users where deleted='0' AND confirmed='1' AND username LIKE '" . $l . "%' order by {$SORT} {$SORTORDER}");
}
}
// Build the tables.
$table = new table(7, true);
$table->addHeader(">> Manage Users");
$mode = array("bold" => true, "align" => "left");
$table->addRow("#060644");
$table->addCol($clickThingy, array("colspan" => "7", "align" => "center"));
$table->addRow("#060622");
$i = "0";
foreach ($fields as $field) {
if ($_GET["sort"] == "{$i}" && $_GET[r] != "true") {
// Offer reverse sorting.
$table->addCol("<a href=\"index.php?action=editusers&sort={$i}&r=true" . $newOnlyUrlAdditio . "\">{$field}</a>", $mode);
} else {
// Offer real sorting.
$table->addCol("<a href=\"index.php?action=editusers&sort={$i}" . $newOnlyUrlAddition . "\">{$field}</a>", $mode);
}
$i++;
}
// create the database.
if ($users->numRows() == 0 && $showOnlyNew == true) {
$table->addRow();
$table->addCol("There are no new users waiting.", array("align" => "center", "colspan" => "7"));
} else {
//.........这里部分代码省略.........
示例7: makePreferences
//.........这里部分代码省略.........
$page = "<h2>Your Preferences</h2>";
$page .= "<form action=\"index.php\" method=\"POST\">";
$page .= $cantimer_table->flush();
$page .= "<input type=\"hidden\" name=\"action\" value=\"changecanpage\">";
$page .= "<input type=\"hidden\" name=\"check\" value=\"check\"></form>";
$page .= "<form action=\"index.php\" method=\"POST\">";
$page .= $opt_table->flush();
$page .= "<input type=\"hidden\" name=\"check\" value=\"check\">";
$page .= "<input type=\"hidden\" name=\"action\" value=\"optIn\"></form>";
$page .= "<form action=\"index.php\" method=\"POST\">";
$page .= $sir_table->flush();
$page .= "<input type=\"hidden\" name=\"check\" value=\"check\">";
$page .= "<input type=\"hidden\" name=\"action\" value=\"sirchange\"></form>";
if ($MySelf->canChangeEmail()) {
$page .= "<form action=\"index.php\" method=\"post\">";
$page .= $email_table->flush();
$page .= "<input type=\"hidden\" name=\"action\" value=\"changeemail\">";
$page .= "<input type=\"hidden\" name=\"check\" value=\"check\">";
$page .= "</form>";
}
if ($MySelf->canChangePwd()) {
$page .= "<form action=\"index.php\" method=\"post\">";
$page .= $password_table->flush();
$page .= "<input type=\"hidden\" name=\"action\" value=\"changepw\">";
$page .= "<input type=\"hidden\" name=\"check\" value=\"check\">";
$page .= "<input type=\"hidden\" name=\"username\" value=\"%%USERNAME%%\">";
$page .= "</form>";
}
// Api Keys
// Load possible current keys.
$api = new api($MySelf->getID());
$api_key = $api->getApiKey();
$api_id = $api->getApiID();
if (!$api->valid()) {
$api->authorizeApi();
}
// Do the api table.
$api_table = new table(2, true);
$api_table->addHeader(">> Api key management");
$api_table->addRow();
$api_table->addCol("Here you can supply your limited-access API-Key. Its used for quick-login for now.", array("colspan" => 2));
if ($api_id && $api->valid()) {
$s1 = "<input type =\"hidden\" name=\"apiID\" value=\"{$api_id}\">{$api_id}";
} else {
$s1 = "<input type=\"text\" name=\"apiID\" value=\"{$api_id}\">";
$doApiLink = true;
}
if ($api_key && $api->valid()) {
$s2 = "<input type =\"hidden\" name=\"apiKey\" value=\"{$api_key}\">{$api_key}";
} else {
$s2 = "<input type=\"text\" size=\"80\" name=\"apiKey\" value=\"{$api_key}\">";
$doApiLink = true;
}
$api_table->addRow();
$api_table->addCol("API ID:");
$api_table->addCol($s1);
$api_table->addRow();
$api_table->addCol("Verification Code:");
$api_table->addCol($s2);
// Add the API link to eve online.
global $IGB;
global $IGB_VISUAL;
if ($doApiLink && (!$IGB || $IGB && $IGB_VISUAL)) {
$api_table->addRow();
$api_table->addCol("Get your API key here:");
$api_table->addCol("<a href=\"http://support.eveonline.com/api/default.asp\">http://support.eveonline.com/api/default.asp</a>");