예제 #1
0
 } else {
     //fetch
     $row = $res2->fetch(PDO::FETCH_ASSOC);
     //var
     $gold = $row['gold'];
     //save memory
     unset($row);
     //We might have a formula to calculate the Coins by Amount Donated
     $AmountCoins = abs($Amount);
     //Set the amount we are Giving/Taking
     $finance->SetAmount($AmountCoins);
     //Detect if the payment is a deduction or not
     if ($Amount < 0) {
         $Logs->append('The transaction is a Deduction Type.');
         //Take the coins from the user
         $Deduct = $finance->Charge('Deduction of Gold Coins', CA_SOURCE_TYPE_DEDUCTION);
         //Check if the deduction was successfull
         if ($Deduct === true) {
             //Deduction success
             $Logs->SetLogType(TRANSACTION_LOG_TYPE_NORMAL);
             //append message to the log
             $Logs->append("The deduction was successfull.");
         } else {
             //Deduction failed
             $Logs->SetLogType(TRANSACTION_LOG_TYPE_URGENT);
             //append message to the log
             $Logs->append("The deduction of coins failed, error returned: " . $Deduct . ". ");
         }
         unset($Deduct);
     } else {
         $Logs->append('The transaction is a Reward Type.');
예제 #2
0
$chars = new server_Character();
//start logging
$logs->add('PSTORE_GOLD', 'Starting log session. Using currency: Gold Coins, Amount of Purchase: ' . $GoldAmount . ', selected realm: ' . $RealmId . '.', 'pending');
//set the realm
if ($chars->setRealm($RealmId)) {
    //check if the character belongs to this account
    if ($chars->isMyCharacter(false, $character)) {
        //send the gold
        $sentGold = $command->sendMoney($character, $GoldAmount * 10000, 'In-Game Gold Delivery', $RealmId);
        //check if any of the actions have failed and log it
        if ($sentGold !== true) {
            $logs->update(false, 'The website failed to execute the send money command and returned: ' . $sentGold . '.', 'error');
            $ERRORS->Add("The website failed to deliver your purchase. Please contact the administration.");
        } else {
            //charge for the purchase
            $Charge = $finance->Charge("In-Game Gold", CA_SOURCE_TYPE_PURCHASE);
            if ($Charge === true) {
                //update the log
                $logs->update(false, 'The user has been charged for his purchase.', 'ok');
            } else {
                //update the log
                $logs->update(false, 'The user was not charged for his purchase, website failed to update.', 'error');
            }
            unset($Charge);
            //free up some memory
            unset($finance);
        }
        //check for fatal errors before proceeding to the complete page
        $ERRORS->Check('/index.php?page=purchase_gold');
        //redirect
        $ERRORS->triggerSuccess();
예제 #3
0
             $reason = 'Cancelled order';
             $reasonUser = '******';
             break;
         case 10:
             $reason = 'Partially reversed transaction';
             $reasonUser = '******';
             break;
         default:
             $reason = 'Unknown code ' . (int) $_GET['reason'];
             $reasonUser = '******';
             break;
     }
     //append message to the log
     $Logs->append("The transaction is deduction type, reason: \"" . $reason . "\". ");
     //Take the coins from the user
     $Deduct = $finance->Charge('Deduction reason: ' . $reasonUser . '.', CA_SOURCE_TYPE_DEDUCTION);
     //Check if the deduction was successfull
     if ($Deduct === true) {
         //Deduction success
         $Logs->SetLogType(TRANSACTION_LOG_TYPE_NORMAL);
         //append message to the log
         $Logs->append("The deduction was successfull.");
     } else {
         //Deduction failed
         $Logs->SetLogType(TRANSACTION_LOG_TYPE_URGENT);
         //append message to the log
         $Logs->append("The deduction of coins failed, error returned: " . $Deduct . ". ");
     }
     unset($reason, $reasonUser, $Deduct);
 } else {
     // Give credits to user
예제 #4
0
####################################################################
## The actual script begins here
//construct the characters handler
$chars = new server_Character();
//start logging
$logs->add('PSTORE_FACTION', 'Starting log session, initial value of the required currency: ' . $accountGold . ' Gold, selected realm: ' . $RealmId . '.', 'pending');
//set the realm
if ($chars->setRealm($RealmId)) {
    //check if the character belongs to this account
    if ($chars->isMyCharacter(false, $character)) {
        //level the character
        $FactionChange = $command->FactionChange($character, $RealmId);
        //check if the command was successfull
        if ($FactionChange === true) {
            //charge for the purchase
            $Charge = $finance->Charge("Faction Change", CA_SOURCE_TYPE_NONE);
            if ($Charge === true) {
                //update the log
                $logs->update(false, 'The faction change command has been executed and the user has been successfully charged for his purchase.', 'ok');
            } else {
                //update the log
                $logs->update(false, 'The user was not charged for his purchase, website failed to update.', 'error');
            }
            unset($Charge);
            //free up some memory
            unset($finance);
        } else {
            $ERRORS->Add("The website failed to complete your order. Please contact the administration.");
            //update the log
            $logs->update(false, 'Soap failed to execute the faction change command.', 'error');
        }
예제 #5
0
$ERRORS->Check('/index.php?page=changedname');
############################################################
######## UPDATE THE ACCOUNT"S DISPLAY NAME #################
//start logging
$logs->add('CHANGE_DNAME', 'Starting log session for the Change Display Name service. Using currency: ' . $currency . '.', 'pending');
//Apply the new display name to the account
$update = $DB->prepare("UPDATE `account_data` SET `displayName` = :name WHERE `id` = :acc LIMIT 1;");
$update->bindParam(':name', $displayName, PDO::PARAM_STR);
$update->bindParam(':acc', $CURUSER->get('id'), PDO::PARAM_INT);
$update->execute();
//check if the account was affected
if ($update->rowCount() > 0) {
    //update the log
    $logs->update(false, 'The user\'s display name has been successfully changed.', 'pending');
    //charge for the purchase
    $Charge = $finance->Charge("Display name change", CA_SOURCE_TYPE_PURCHASE);
    if ($Charge === true) {
        //update the log
        $logs->update(false, 'The user has been charged for his purchase.', 'ok');
    } else {
        //update the log
        $logs->update(false, 'The user was not charged for his purchase, website failed to update.', 'error');
    }
    unset($Charge);
    //free up some memory
    unset($finance);
    ######################################
    ########## Redirect ##################
    $ERRORS->triggerSuccess();
} else {
    $ERRORS->Add('The website failed to change your Display Name. Please contact the administration.');
예제 #6
0
 //send the bags
 $sentBags = $command->sendItems($character, $bagsString, 'Premium Store Delivery', $RealmId);
 //check if any of the actions have failed and log it
 if ($levelUp !== true) {
     $logs->update(false, 'The website failed to execute the level command and returned: ' . $levelUp . '.', 'error');
 }
 if ($sentGold !== true) {
     $logs->update(false, 'The website failed to execute the send money command and returned: ' . $sentGold . '.', 'error');
 }
 if ($sentBags !== true) {
     $logs->update(false, 'The website failed to execute the send items command and returned: ' . $sentBags . '.', 'error');
 }
 //check if one of those actions was successful
 if ($levelUp === true or $sentGold === true or $sentBags === true) {
     //charge for the purchase
     $Charge = $finance->Charge("Level Up", CA_SOURCE_TYPE_PURCHASE);
     if ($Charge === true) {
         //update the log
         $logs->update(false, 'The user has been charged for his purchase.', 'ok');
     } else {
         //update the log
         $logs->update(false, 'The user was not charged for his purchase, website failed to update.', 'error');
     }
     unset($Charge);
     //free up some memory
     unset($finance);
 } else {
     $ERRORS->Add("The website failed to deliver your purchase. Please contact the administration.");
     //update the log
     $logs->update(false, 'Soap failed to execute any of the level up commands.', 'error');
 }
예제 #7
0
####################################################################
## The actual script begins here
//construct the characters handler
$chars = new server_Character();
//start logging
$logs->add('PSTORE_CUSTOMIZE', 'Starting log session, initial value of the required currency: ' . $accountGold . ' Gold, selected realm: ' . $RealmId . '.', 'pending');
//set the realm
if ($chars->setRealm($RealmId)) {
    //check if the character belongs to this account
    if ($chars->isMyCharacter(false, $character)) {
        //recustomize the character
        $recustomization = $command->Customize($character, $RealmId);
        //check if the command was successfull
        if ($recustomization === true) {
            //charge for the purchase
            $Charge = $finance->Charge("Character Recustomization", CA_SOURCE_TYPE_NONE);
            if ($Charge === true) {
                //update the log
                $logs->update(false, 'The recustomization command has been executed and the user has been successfully charged for his purchase.', 'ok');
            } else {
                //update the log
                $logs->update(false, 'The user was not charged for his purchase, website failed to update.', 'error');
            }
            unset($Charge);
            //free up some memory
            unset($finance);
        } else {
            $ERRORS->Add("The website failed to complete your order. Please contact the administration.");
            //update the log
            $logs->update(false, 'Soap failed to execute the recustomization command.', 'error');
        }
예제 #8
0
 //Calculate the expire time
 $DurationStrings = array(BOOST_DURATION_10 => '10 days', BOOST_DURATION_15 => '15 days', BOOST_DURATION_30 => '30 days');
 $Expires = $time->getTimestamp() + strtotime($DurationStrings[$DurationId], 0);
 //Give the boost
 $insert = $RealmDB->prepare("INSERT INTO `player_boosts` (`account_Id`, `boosts`, `setdate`, `unsetdate`, `active`) VALUES (:acc, :boost, :setdate, :expire, '1');");
 $insert->bindParam(':acc', $CURUSER->get('id'), PDO::PARAM_INT);
 $insert->bindParam(':boost', $BoostId, PDO::PARAM_INT);
 $insert->bindParam(':setdate', $time->getTimestamp(), PDO::PARAM_INT);
 $insert->bindParam(':expire', $Expires, PDO::PARAM_INT);
 $insert->execute();
 //check if the account was affected
 if ($insert->rowCount() > 0) {
     //update the log
     $logs->update(false, 'The boost has been insert with expire time: ' . $Expires . ' [' . $DurationStrings[$DurationId] . '].', 'pending');
     //charge for the purchase
     $Charge = $finance->Charge("Purchased Boost", CA_SOURCE_TYPE_PURCHASE);
     if ($Charge === true) {
         //update the log
         $logs->update(false, 'The user has been charged for his purchase.', 'ok');
     } else {
         //update the log
         $logs->update(false, 'The user was not charged for his purchase, website failed to update.', 'error');
     }
     unset($Charge);
     //free up some memory
     unset($finance);
     ######################################
     ########## Redirect ##################
     $ERRORS->triggerSuccess();
 } else {
     $ERRORS->Add('The website failed to set your boost. Please contact the administration.');