コード例 #1
0
ファイル: profile.php プロジェクト: JohnWilliamsMSU/Steady
 $accountId = isset($_GET['id']) ? $_GET['id'] : 0;
 $accessToken = isset($_GET['access_token']) ? $_GET['access_token'] : 0;
 $act = isset($_GET['act']) ? $_GET['act'] : '';
 $accountId = helper::clearInt($accountId);
 $account = new account($dbo, $accountId);
 $accountInfo = $account->get();
 $messages = new messages($dbo);
 $messages->setRequestFrom($accountId);
 if ($accessToken === admin::getAccessToken() && !APP_DEMO) {
     switch ($act) {
         case "disconnect":
             $account->setFacebookId('');
             header("Location: /admin/profile.php/?id=" . $accountInfo['id']);
             break;
         case "showAdmob":
             $account->setAdmob(1);
             header("Location: /admin/profile.php/?id=" . $accountInfo['id']);
             break;
         case "hideAdmob":
             $account->setAdmob(0);
             header("Location: /admin/profile.php/?id=" . $accountInfo['id']);
             break;
         case "close":
             $auth->removeAll($accountId);
             header("Location: /admin/profile.php/?id=" . $accountInfo['id']);
             break;
         case "block":
             $account->setState(ACCOUNT_STATE_BLOCKED);
             header("Location: /admin/profile.php/?id=" . $accountInfo['id']);
             break;
         case "unblock":
コード例 #2
-1
<?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->setAdmob(0);
    }
    echo json_encode($result);
    exit;
}