public static function addNewLTCWallet() { $account = Core::validate($_POST['ACCOUNT']); $share = Core::validate($_POST['SHARE']); // percent if ($account == null || $share == null || !Core::isDouble($share)) { print 'Incorrect input data'; exit; } $result = WalletsLtc::findBy(array('account' => $account)); if (!empty($result)) { print 'This account already exists'; exit; } $litecoin = new jsonRPCClient('http://' . LTC_RPC_USER . ':' . LTC_RPC_PASSWORD . '@' . LTC_RPC_HOST . ':' . LTC_RPC_PORT . '/'); try { $balance = $litecoin->getbalance($account); } catch (Exception $e) { print $e; exit; } $wallet = new WalletsLtc(); $wallet->setAccount($account); $wallet->setValue($balance); $wallet->setShare($share / 100.0); $wallet->insert(); header('Location: /admin/ltc'); }