Exemplo n.º 1
0
 if ($clientId != CLIENT_ID) {
     api::printError(ERROR_UNKNOWN, "Error client Id.");
 }
 $result = array("error" => true);
 $account = new account($dbo);
 $result = $account->signup($username, $fullname, $password, $email, $user_sex, $user_year, $user_month, $user_day);
 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());
Exemplo n.º 2
0
    $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;
}