| @@ 82-86 (lines=5) @@ | ||
| 79 | **/ |
|
| 80 | public function add($userID, $address, $currency=NULL) { |
|
| 81 | if ($currency === NULL) $currency = $this->config['currency']; |
|
| 82 | if ($address != $this->getCoinAddress($userID) && $this->existsCoinAddress($address)) { |
|
| 83 | $this->setErrorMessage('Unable to update coin address, address already exists'); |
|
| 84 | return false; |
|
| 85 | } |
|
| 86 | $stmt = $this->mysqli->prepare("INSERT INTO " . $this->getTableName() . " (account_id, currency, coin_address) VALUES (?, ?, ?)"); |
|
| 87 | if ( $this->checkStmt($stmt) && $stmt->bind_param('iss', $userID, $currency, $address) && $stmt->execute()) { |
|
| 88 | return true; |
|
| 89 | } |
|
| @@ 118-122 (lines=5) @@ | ||
| 115 | **/ |
|
| 116 | public function update($userID, $address, $ap_threshold, $currency=NULL) { |
|
| 117 | if ($currency === NULL) $currency = $this->config['currency']; |
|
| 118 | if ($address != $this->getCoinAddress($userID) && $this->existsCoinAddress($address)) { |
|
| 119 | $this->setErrorMessage('Unable to update coin address, address already exists'); |
|
| 120 | return false; |
|
| 121 | } |
|
| 122 | if ($this->getCoinAddress($userID) != NULL) { |
|
| 123 | $stmt = $this->mysqli->prepare("UPDATE " . $this->getTableName() . " SET coin_address = ?, ap_threshold = ? WHERE account_id = ? AND currency = ?"); |
|
| 124 | if ( $this->checkStmt($stmt) && $stmt->bind_param('sdis', $address, $ap_threshold, $userID, $currency) && $stmt->execute()) { |
|
| 125 | return true; |
|
| @@ 519-523 (lines=5) @@ | ||
| 516 | return false; |
|
| 517 | } |
|
| 518 | if (!empty($address)) { |
|
| 519 | if ($address != $this->coin_address->getCoinAddress($userID) && $this->coin_address->existsCoinAddress($address)) { |
|
| 520 | $this->setErrorMessage('Address is already in use'); |
|
| 521 | return false; |
|
| 522 | } |
|
| 523 | if ($this->bitcoin->can_connect() === true) { |
|
| 524 | if (!$this->bitcoin->validateaddress($address)) { |
|
| 525 | $this->setErrorMessage('Invalid coin address'); |
|
| 526 | return false; |
|