Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class IPLimit extends Database {
- //[..]
- public function check($id) {
- $now = time();
- $result = $this->getRow($this->table, $this->ip, $this->col_ip);
- if ($result) {
- $last = strtotime($result[$this->col_last_access]);
- if (($last + $this->expiry ) < $now) {
- $this->updateRow($this->table, array(
- $this->col_last_fileid => $id,
- $this->col_access_count => $result[$this->col_access_count] + 1), $this->ip, $this->col_ip);
- } else {
- $this->timeLeft = ( ( $last + $this->expiry) - $now);
- return false;
- }
- } else {
- $this->insertRow($this->table, array(
- $this->col_ip => $this->ip,
- $this->col_last_fileid => $id
- ));
- }
- return true;
- }
- //[..]
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement