Esempio n. 1
0
     header("Location: /admin/profile.php/?id=" . $accountInfo['id']);
     break;
 case "unblock":
     $account->setState(ACCOUNT_STATE_ENABLED);
     header("Location: /admin/profile.php/?id=" . $accountInfo['id']);
     break;
 case "verify":
     $account->setVerify(1);
     header("Location: /admin/profile.php/?id=" . $accountInfo['id']);
     break;
 case "unverify":
     $account->setVerify(0);
     header("Location: /admin/profile.php/?id=" . $accountInfo['id']);
     break;
 case "ghost_set":
     $account->setGhost(1);
     header("Location: /admin/profile.php/?id=" . $accountInfo['id']);
     break;
 case "ghost_unset":
     $account->setGhost(0);
     header("Location: /admin/profile.php/?id=" . $accountInfo['id']);
     break;
 case "delete-cover":
     $data = array("originCoverUrl" => '', "normalCoverUrl" => '');
     $account->setCover($data);
     header("Location: /admin/profile.php/?id=" . $accountInfo['id']);
     break;
 case "delete-photo":
     $data = array("originPhotoUrl" => '', "normalPhotoUrl" => '', "lowPhotoUrl" => '');
     $account->setPhoto($data);
     header("Location: /admin/profile.php/?id=" . $accountInfo['id']);
<?php

/*!
 * ifsoft.co.uk engine v1.0
 *
 * http://ifsoft.com.ua, http://ifsoft.co.uk
 * qascript@ifsoft.co.uk
 *
 * Copyright 2012-2016 Demyanchuk Dmitry (https://vk.com/dmitry.demyanchuk)
 */
include_once $_SERVER['DOCUMENT_ROOT'] . "/core/init.inc.php";
include_once $_SERVER['DOCUMENT_ROOT'] . "/config/api.inc.php";
if (!empty($_POST)) {
    $accountId = isset($_POST['accountId']) ? $_POST['accountId'] : 0;
    $accessToken = isset($_POST['accessToken']) ? $_POST['accessToken'] : '';
    $cost = isset($_POST['cost']) ? $_POST['cost'] : 0;
    $cost = helper::clearInt($cost);
    $auth = new auth($dbo);
    if (!$auth->authorize($accountId, $accessToken)) {
        api::printError(ERROR_ACCESS_TOKEN, "Error authorization.");
    }
    $result = array("error" => true, "error_code" => ERROR_UNKNOWN);
    $account = new account($dbo, $accountId);
    $balance = $account->getBalance();
    if ($balance >= $cost) {
        $account->setBalance($account->getBalance() - $cost);
        $result = $account->setGhost(1);
    }
    echo json_encode($result);
    exit;
}