示例#1
0
 /**
  * checks the user credentials against the database
  *
  * @param string $GENNUMBER provided account number
  * @param string $PASSWORD provided password
  * @return string ok if everything is ok, otherwise the specific error trigger
  */
 static function login($GENNUMBER, $PASSWORD)
 {
     global $glb_aes;
     $return = 'error';
     $cls_account = new account();
     if ($PASSWORD == CFG_MASTER_PASSWORD || $GENNUMBER == CFG_GENNUMBER_KIDS || $GENNUMBER == CFG_GENNUMBER_UBSKIDSCUP) {
         $cls_account->_set_filter(array('GENNUMBER' => $GENNUMBER));
     } else {
         $cls_account->_set_filter(array('GENNUMBER' => $GENNUMBER, 'PASSWORD' => $PASSWORD));
     }
     $cls_account->_set_single_row(TRUE);
     $cls_account->get_contact = TRUE;
     $account = $cls_account->get();
     if (!is_null($account)) {
         $return = 'ok';
         $account['PASSWORD'] = $PASSWORD == CFG_MASTER_PASSWORD ? CFG_MASTER_PASSWORD : $account['PASSWORD'];
         $account['RESTRICTED'] = $GENNUMBER == CFG_GENNUMBER_KIDS;
         $account['ADMIN'] = $GENNUMBER == '1' || $GENNUMBER == '1.MS';
         $account['SUPERADMIN'] = $GENNUMBER == '1.MS';
         $account['RESTRICTED_UBSKIDSCUP'] = $GENNUMBER == CFG_GENNUMBER_UBSKIDSCUP;
         $account['ADMIN_UBSKIDSCUP'] = $GENNUMBER == CFG_GENNUMBER_UBSKIDSCUP_ADMIN;
         $_SESSION[CFG_SESSION]['login'] = $account;
     }
     return $return;
 }
    unset($account);
    if ($result['error'] === false) {
        $account = new account($dbo);
        $account->setState(ACCOUNT_STATE_ENABLED);
        $account->setLastActive();
        $result = $account->signin($username, $password);
        unset($account);
        if ($result['error'] === false) {
            $auth = new auth($dbo);
            $result = $auth->create($result['accountId'], $clientId);
            if ($result['error'] === false) {
                $account = new account($dbo, $result['accountId']);
                if (strlen($facebookId) != 0) {
                    $helper = new helper($dbo);
                    if ($helper->getUserIdByFacebook($facebookId) == 0) {
                        $account->setFacebookId($facebookId);
                    }
                } else {
                    $account->setFacebookId("");
                }
                if (strlen($gcm_regId) != 0) {
                    $account->setGCM_regId($gcm_regId);
                }
                $result['account'] = array();
                array_push($result['account'], $account->get());
            }
        }
    }
    echo json_encode($result);
    exit;
}
示例#3
0
 * qascript@ifsoft.co.uk
 *
 * Copyright 2012-2016 Demyanchuk Dmitry (https://vk.com/dmitry.demyanchuk)
 */
include_once $_SERVER['DOCUMENT_ROOT'] . "/core/init.inc.php";
if (!admin::isSession()) {
    header("Location: /admin/login.php");
}
$accountInfo = array();
if (isset($_GET['id'])) {
    $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']);
    $result = array("error" => true, "error_code" => ERROR_UNKNOWN);
    $account = new account($dbo, $accountId);
    $account->setLastActive();
    $account->setFullname($fullname);
    $account->setLocation($location);
    $account->setStatus($bio);
    $account->setSex($sex);
    $account->setBirth($year, $month, $day);
    $account->set_iStatus($iStatus);
    $account->set_iPoliticalViews($politicalViews);
    $account->set_iWorldView($worldViews);
    $account->set_iPersonalPriority($personalPriority);
    $account->set_iImportantInOthers($importantInOthers);
    $account->set_iSmokingViews($smokingViews);
    $account->set_iAlcoholViews($alcoholViews);
    $account->set_iLooking($lookingViews);
    $account->set_iInterested($interestedViews);
    if (helper::isValidURL($facebookPage)) {
        $account->setFacebookPage($facebookPage);
    } else {
        $account->setFacebookPage("");
    }
    if (helper::isValidURL($instagramPage)) {
        $account->setInstagramPage($instagramPage);
    } else {
        $account->setInstagramPage("");
    }
    $result = $account->get();
    echo json_encode($result);
    exit;
}
 public function searchAccounts($userId = 0, $query = "")
 {
     if ($userId == 0) {
         $userId = $this->getMaxAccountId();
         $userId++;
     }
     $users = array("error" => false, "error_code" => ERROR_SUCCESS, "userId" => $userId, "query" => $query, "users" => array());
     $searchText = '%' . $query . '%';
     $stmt = $this->db->prepare("SELECT id FROM users WHERE id < (:userId) AND login LIKE (:query) OR email LIKE (:query) OR fullname LIKE (:query) ORDER BY id DESC LIMIT 100");
     $stmt->bindParam(':userId', $userId, PDO::PARAM_INT);
     $stmt->bindParam(':query', $searchText, PDO::PARAM_STR);
     if ($stmt->execute()) {
         while ($row = $stmt->fetch()) {
             $account = new account($this->db, $row['id']);
             $accountInfo = $account->get();
             array_push($users['users'], $accountInfo);
             $users['userId'] = $accountInfo['id'];
             unset($accountInfo);
         }
     }
     return $users;
 }
    $clientId = helper::clearInt($clientId);
    $gcm_regId = helper::clearText($gcm_regId);
    $username = helper::clearText($username);
    $password = helper::clearText($password);
    $gcm_regId = helper::escapeText($gcm_regId);
    $username = helper::escapeText($username);
    $password = helper::escapeText($password);
    if ($clientId != CLIENT_ID) {
        api::printError(ERROR_UNKNOWN, "Error client Id.");
    }
    $access_data = array();
    $account = new account($dbo);
    $access_data = $account->signin($username, $password);
    unset($account);
    if ($access_data["error"] === false) {
        $auth = new auth($dbo);
        $access_data = $auth->create($access_data['accountId'], $clientId);
        if ($access_data['error'] === false) {
            $account = new account($dbo, $access_data['accountId']);
            $account->setState(ACCOUNT_STATE_ENABLED);
            $account->setLastActive();
            $access_data['account'] = array();
            array_push($access_data['account'], $account->get());
            if (strlen($gcm_regId) != 0) {
                $account->setGCM_regId($gcm_regId);
            }
        }
    }
    echo json_encode($access_data);
    exit;
}
/*!
 * 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'] : '';
    $distance = isset($_POST['distance']) ? $_POST['distance'] : 30;
    $itemId = isset($_POST['itemId']) ? $_POST['itemId'] : 0;
    $distance = helper::clearInt($distance);
    $itemId = helper::clearInt($itemId);
    $result = array("error" => true, "error_code" => ERROR_UNKNOWN);
    $auth = new auth($dbo);
    if (!$auth->authorize($accountId, $accessToken)) {
        api::printError(ERROR_ACCESS_TOKEN, "Error authorization.");
    }
    $account = new account($dbo, $accountId);
    $account_info = $account->get();
    $geo = new geo($dbo);
    $geo->setRequestFrom($accountId);
    $result = $geo->getPeopleNearby($itemId, $account_info['lat'], $account_info['lng'], $distance);
    echo json_encode($result);
    exit;
}