/** * Save nonce object. * * @param ConsumerNonce $nonce Nonce object * @return boolean True if the nonce object was successfully saved */ public function saveConsumerNonce($nonce) { global $DB; $data = ['consumerid' => $nonce->getConsumer()->getRecordId(), 'value' => $nonce->getValue(), 'expires' => $nonce->expires]; return $DB->insert_record($this->noncetable, (object) $data, false); }
/** * Save nonce object. * * @param ConsumerNonce $nonce Nonce object * * @return boolean True if the nonce object was successfully saved */ public function saveConsumerNonce($nonce) { $expires = date("{$this->dateFormat} {$this->timeFormat}", $nonce->expires); $sql = sprintf("INSERT INTO {$this->dbTableNamePrefix}" . DataConnector::NONCE_TABLE_NAME . " (consumer_pk, value, expires) VALUES (%d, %s, %s)", $nonce->getConsumer()->getRecordId(), DataConnector::quoted($nonce->getValue()), DataConnector::quoted($expires)); $ok = mysql_query($sql); return $ok; }
/** * Save nonce object. * * @param ConsumerNonce $nonce Nonce object * * @return boolean True if the nonce object was successfully saved */ public function saveConsumerNonce($nonce) { $id = $nonce->getConsumer()->getRecordId(); $value = $nonce->getValue(); $expires = date("{$this->dateFormat} {$this->timeFormat}", $nonce->expires); $sql = "INSERT INTO {$this->dbTableNamePrefix}" . DataConnector::NONCE_TABLE_NAME . ' (consumer_pk, value, expires) VALUES (:id, :value, :expires)'; $query = $this->db->prepare($sql); $query->bindValue('id', $id, PDO::PARAM_INT); $query->bindValue('value', $value, PDO::PARAM_STR); $query->bindValue('expires', $expires, PDO::PARAM_STR); $ok = $query->execute(); return $ok; }