Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- $check = $this->check_before_send();
- if ($check) {
- // что-то делаем
- }
- */
- public function check_before_send() {
- $sql = "SELECT * FROM signals_before_send WHERE symbol = '" . $this->symbol . "' AND signal_from = '" . $this->signal_from . "' AND time_insert < '" . time() - (int)20 . "'";
- $check_result = $this->db->query($sql);
- if ($check_result->num_rows > 0) {
- return false;
- } else {
- $sql = "INSERT INTO `signals_before_send`(
- `symbol`,
- `signal_from`,
- `time_insert`
- ) VALUES('" .
- implode("','", [
- $this->symbol,
- $this->signal_from,
- time()
- ])
- . "')";
- $this->db->query($sql);
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement