本文整理汇总了PHP中client::setbank方法的典型用法代码示例。如果您正苦于以下问题:PHP client::setbank方法的具体用法?PHP client::setbank怎么用?PHP client::setbank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类client
的用法示例。
在下文中一共展示了client::setbank方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
$user = $users[$usernum];
$err = $client->login($user['passphrase']);
if ($err) {
echo "Error logging in as user {$usernum}: {$err}\n";
} else {
echo "Logged in as user {$usernum}\n";
$banks = $client->getbanks(true);
if (is_string($banks)) {
echo "Error getting banks: {$banks}\n";
} elseif (count($banks) > 0) {
$bank = false;
foreach ($banks as $bank) {
break;
}
$bankid = $bank[$t->BANKID];
$err = $client->setbank($bankid);
if ($err) {
echo "Error setting bank to {$bankid} for user {$usernum}: {$err}\n";
} else {
"Set bank for user {$usernum} to {$bankid}\n";
}
} else {
echo "No bank for user {$usernum}\n";
}
}
// Command loop
while (true) {
$id = $client->current_user();
if ($id) {
foreach ($users as $user) {
if ($user['id'] == $id) {
示例2: doit
//.........这里部分代码省略.........
$t = $server->t;
$bankid = $server->bankid();
$tokenid = $server->tokenid;
if (file_exists('client/settings.php')) {
require_once "client/settings.php";
}
$dbdir = "client/{$dbdir}";
$template_file = "client/{$template_file}";
$error = die_unless_client_properly_configured(true);
if (!$error) {
require_once "lib/client.php";
$clientdb = new fsdb("{$dbdir}");
$client = new client($clientdb, $ssl);
if ($enabledebug) {
$client->showprocess = 'appenddebug';
}
$hash = $client->passphrasehash($passphrase);
if (!$clientdb->get("privkey/{$hash}")) {
// Create the new account
$error = $client->newuser($passphrase);
} else {
$error = $client->login($passphrase);
}
if (!$error) {
$id = $client->id;
if ($clientdb->get("account/{$id}/bank/{$bankid}/req")) {
$error = 'Account already exists for that passphrase. ' . 'Use the <a href="client/">client interface</a> to administer.';
} else {
$error = $client->login($bankpass);
if (!$error) {
$error = $client->addbank($bankurl);
}
if (!$error) {
$error = $client->setbank($bankid);
}
if (!$error) {
$error = $client->spend($id, $tokenid, "10000");
}
if ($error) {
$error = "While spending tokens from bank: {$error}";
}
}
if (!$error) {
$error = $client->login($passphrase);
if (!$error) {
$error = $client->addbank($bankurl, $name);
}
if (!$error) {
?>
<p>Your bank is now ready for business. You may now login as administrator in the
<a href="client/">Client interface</a>, accept your initial tokens from
the bank, and start inviting customers.</p>
<?php
return;
}
}
}
}
}
}
if (!$error) {
$error = " ";
}
if ($drawadmin) {
?>
<p>Congratulations! You have succesfully initialized your bank.</p>