本文整理汇总了PHP中Account::AddCredits方法的典型用法代码示例。如果您正苦于以下问题:PHP Account::AddCredits方法的具体用法?PHP Account::AddCredits怎么用?PHP Account::AddCredits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account::AddCredits方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PrizeWinner
function PrizeWinner(&$db, $post)
{
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/Main.php";
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Manager/Language/{$MainLanguage}/Events.php";
$db->Query("SELECT AccountID FROM Character WHERE Name = '" . $post['Name'] . "'");
if ($db->NumRows() != 1) {
return $EventsMessage035;
}
$data = $db->GetRow();
$memb___id = $data[0];
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Account.class.php";
$acc = new Account($db);
$db->Query("SELECT * FROM Z_EventsSchedule WHERE idx = '" . $post['idx'] . "' AND (winner IS NULL OR winner = '')");
if ($db->NumRows() != 1) {
return "Oops ;)";
}
$data = $db->GetRow();
for ($i = 1; $i <= 5; $i++) {
if ($data["currency{$i}"] > 0) {
$acc->AddCredits($memb___id, $i, $data["currency{$i}"], $db);
}
}
$db->Query("UPDATE Z_EventsSchedule SET winner = '" . $post['Name'] . "' WHERE idx = '" . $post['idx'] . "'");
return $EventsMessage034;
}
示例2: elseif
if (in_array('', $post) && $post['type'] == 0) {
$mensagem = "<div class='alert alert-info'><b>{$acc->memb_name}</b>, por favor preencha todas os campos para continuar.</div>";
} elseif ($post['valor'] < VALOR_MIN || $post['valor'] > VALOR_MAX) {
$mensagem = "<div class='alert alert-warning'><b>{$acc->memb_name}</b>, o valor transferido deve conter no mínimo " . VALOR_MIN . " e máximo " . VALOR_MAX . ".</div>";
} else {
$db->Query("SELECT memb___id FROM MEMB_INFO WHERE memb___id = '" . $post['destino'] . "'");
if ($db->NumRows() <= 0) {
$mensagem = "<div class='alert alert-danger'><b>{$acc->memb_name}</b>, login não encontrado no banco de dados, por favor digite novamente.</div>";
} elseif ($post['destino'] == $acc->memb___id) {
$mensagem = "<div class='alert alert-warning'><b>{$acc->memb_name}</b>, você não pode transferir para sua propria conta, por favor digite um login diferente do seu.</div>";
} elseif ($acc->GetCreditAmount($acc->memb___id, $post['type'], $db) < $post['valor']) {
$mensagem = "<div class='alert alert-info'><b>{$acc->memb_name}</b>, você não tem " . $moedas[$post['type']] . " suficiente para fazer a transferencia.</div>";
} else {
//
$acc->ReduceCredits($acc->memb___id, $post['type'], $post['valor'], $db);
$acc->AddCredits($post['destino'], $post['type'], $post['valor'], $db);
$mensagem = "<div class='alert alert-success'><b>{$acc->memb_name}</b>, você acaba de transferir <b>" . $post['valor'] . " " . $moedas[$post['type']] . "</b> para a conta <b>" . $post['destino'] . "</b>.</b></div>";
}
}
}
break;
}
}
?>
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title"> <a> <i class="fa fa-arrow-circle-o-right"></i> Transferência de Moedas </a> </h4>
</div>
<div class="panel-body">
示例3: ConfirmDonation
function ConfirmDonation(&$db, $idx)
{
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/Main.php";
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/Donations.php";
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Manager/Language/{$MainLanguage}/Donations.php";
$db->Query("SELECT * FROM Z_Income WHERE idx = '{$idx}'");
$data = $db->GetRow();
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Account.class.php";
$acc = new Account($db);
$Amount = $data['amount'];
if (isset($DonationsPercentDeposit) && $DonationsPercentDeposit != 100) {
$Amount = (int) ($Amount * $DonationsPercentDeposit / 100);
}
$acc->AddCredits($data['memb___id'], 0, $Amount, $db);
$db->Query("UPDATE Z_Income SET status = '1' , date_confirm = getdate() WHERE idx = '{$idx}'");
$dateClass = new Date();
$currentDateTime = $dateClass->DateFormat(date("Y-m-d")) . " " . $dateClass->TimeFormat(date("H:i"), "h");
$replaces = array("[number]" => $idx, "[amount]" => $Amount, "[date]" => $currentDateTime);
foreach ($replaces as $Key => $Value) {
$DonationsMessage29 = str_replace($Key, $Value, $DonationsMessage29);
$DonationsMessage33 = str_replace($Key, $Value, $DonationsMessage33);
$DonationsMessage34 = str_replace($Key, $Value, $DonationsMessage34);
}
if ($DonationsMessage) {
$acc->NewUserMessage($db, $data['memb___id'], $DonationsMessage29, $DonationsMessage34);
}
if ($DonationsMail) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Mail.class.php";
$db->Query("SELECT mail_addr,memb_name FROM MEMB_INFO WHERE memb___id = '" . $data['memb___id'] . "'");
$userData = $db->GetRow();
$mailCass = new Mail();
$mailCass->SendMail($userData['mail_addr'], $userData['memb_name'], $DonationsMessage29, $DonationsMessage33);
}
return $DonationsMessage35;
}
示例4: SaveServerData
function SaveServerData(&$db, $post)
{
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/Main.php";
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Manager/Language/{$MainLanguage}/Users.php";
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Language/{$MainLanguage}/GenericMessages.php";
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/VIP_.php";
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/SQL.php";
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/Manager.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Account.class.php";
$acc = new Account($db);
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Manager/System/Manager.class.php";
$mn = new Manager();
if ($mn->GetUserLevel($_SESSION['ManagerId'], $db) >= $ManagerServerSaveLevel) {
$query = "\n\t\t\tUPDATE MEMB_INFO SET \n\t\t\t{$SQLVIPColumn} = '" . $post['VipId'] . "',\n\t\t\t{$SQLVIPDateColumn} = '" . $post['DueYear'] . "-" . $post['DueMonth'] . "-" . $post['DueDay'] . "'\n\t\t\tWHERE memb___id = '" . $post['memb___id'] . "'";
$db->Query($query);
$NewDue = $post['ItemDueYear'] . "-" . $post['ItemDueMonth'] . "-" . $post['ItemDueDay'];
$acc->SetVipItem($post['memb___id'], $post['VipItem'], $db, $NewDue);
for ($i = 1; $i <= 5; $i++) {
if (isset($post["Credit{$i}"])) {
$acc->AddCredits($post['memb___id'], $i, $post["Credit{$i}"], $db, "set");
}
}
for ($i = 1; $i <= 5; $i++) {
if (isset($post["GameCredit{$i}"]) && strlen($post["GameCredit{$i}"]) > 0) {
$db->Query("SELECT * FROM Z_GameCurrencies WHERE idx = '{$i}'");
$data = $db->GetRow();
$database = $data['database'];
$table = $data['table'];
$column = $data['column'];
$accountColumn = $data['accountColumn'];
if (!empty($accountColumn)) {
$db->Query("SELECT {$column} FROM {$database}.dbo.{$table} WHERE {$accountColumn} = '" . $post['memb___id'] . "'");
if ($db->NumRows() < 1) {
if (!$db->Query("INSERT INTO {$database}.dbo.{$table} ({$column},{$accountColumn}) VALUES ('" . $post["GameCredit{$i}"] . "','" . $post['memb___id'] . "')")) {
return "Fatal error.";
}
} else {
$db->Query("UPDATE {$database}.dbo.{$table} SET {$column} = '" . $post["GameCredit{$i}"] . "' WHERE {$accountColumn} = '" . $post['memb___id'] . "'");
}
}
}
}
return $UsersMessage040;
}
return $GenericMessage07;
}
示例5: round
exit;
}
curl_close($ch);
if (strcmp($res, "VERIFIED") == 0) {
// check whether the payment_status is Completed
// check that txn_id has not been previously processed
$item_name = $_POST['item_name'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];
$custom = $_POST['custom'];
if ($payment_status == "Completed") {
$payment_amount *= ${"PayPalExchangeTo" . $payment_currency};
$payment_amount = round($payment_amount);
$db->Query("SELECT COUNT(idx) FROM Z_Income WHERE data = '{$txn_id}'");
$data = $db->GetRow();
if ($data[0] < 1) {
$acc->AddCredits($custom, 0, $payment_amount, $db);
//$db->Query("INSERT INTO XW_Income (memb___id, amount, bank, way, date_confirm, data, status) VALUES ('$custom', '$payment_amount', 'PayPal', 'PayPal', getdate(), '$txn_id', '1')");
}
}
$string = "" . date("Y-m-d") . "\t\"{$payment_status}\"\t\"{$custom}\"\t\"R\${$payment_amount}\"\t\"{$txn_id}\"\r\n";
$file = fopen("PayPalLog.txt", "a");
fwrite($file, $string);
fclose($file);
}
$db->Disconnect();
echo "<script>window.location.href='/';</script>";
示例6: explode
if ($confirma) {
$TransacaoID = $_POST['TransacaoID'];
$Referencia = $_POST['Referencia'];
$StatusTransacao = $_POST['StatusTransacao'];
$CliNome = $_POST['CliNome'];
$ProdValor_1 = explode(",", $_POST['ProdValor_1']);
$ProdValor_1 = $ProdValor_1[0];
$TipoPagamento = $_POST['TipoPagamento'];
if (strpos($TipoPagamento, "Cart") !== false) {
$TipoPagamento = "Cartao de Credito";
}
if ($StatusTransacao == "Aprovado") {
if (isset($DonationsPercentPagSeg) && $DonationsPercentPagSeg != 100) {
$ProdValor_1 = ceil($ProdValor_1 * $DonationsPercentPagSeg / 100);
}
$acc->AddCredits($Referencia, 0, $ProdValor_1, $db);
if (!$db->Query("INSERT INTO Z_Income (memb___id, amount, bank, way, date_confirm, data, status) VALUES ('{$Referencia}', '{$ProdValor_1}', 'PagSeguro', '{$TipoPagamento}', getdate(), '{$TransacaoID}', '1')")) {
$handle = fopen("PagSeguroError.txt", "a");
if ($handle) {
$string = date("Y-m-d H:i") . " - Erro de escrita no INSERT: -> ('{$Referencia}', '{$ProdValor_1}', '{$TipoPagamento}', '{$TransacaoID}', '1') \r\n";
fwrite($handle, $string);
fclose($handle);
}
}
$db->Query("SELECT memb___id FROM Z_Income WHERE bank = 'PagSeguro' AND data = '{$TransacaoID}'");
if ($db->NumRows() < 1) {
$handle = fopen("PagSeguroError.txt", "a");
if ($handle) {
$string = date("Y-m-d H:i") . " - Erro de leitura da linha\r\n";
fwrite($handle, $string);
fclose($handle);
示例7: CancelPurchases
function CancelPurchases(&$db, $post)
{
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/Main.php";
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/WebShop.php";
require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Manager/Language/{$MainLanguage}/WebShop.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Account.class.php";
$acc = new Account($db);
$chargeBack = 0;
foreach ($post['purchases'] as $key => $value) {
$db->Query("SELECT * FROM Z_WebShopLog WHERE idx = '{$value}' AND status = '1'");
if ($db->NumRows() > 0) {
$data = $db->GetRow();
if ($data['insurance'] == 0) {
$reversal = (int) ($data['price'] * $WebShopCancelPercentNoInsurance / 100);
} else {
$reversal = (int) ($data['price'] * $WebShopCancelPercentInsurance / 100);
}
$acc->AddCredits($data['memb___id'], $data['currency'], $reversal, $db, "add");
$chargeBack += $reversal;
$db->Query("UPDATE Z_WebShopLog SET status = '0' WHERE idx = '{$value}'");
}
}
return count($post['purchases']) . " " . $WebShopMessage025 . "<br />" . $WebShopMessage131 . $chargeBack;
}