table_common_visit.php 765 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: table_common_visit.php 30814 2012-06-21 06:37:56Z zhangguosheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_common_visit extends discuz_table
  12. {
  13. public function __construct() {
  14. $this->_table = 'common_visit';
  15. $this->_pk = 'ip';
  16. parent::__construct();
  17. }
  18. public function inc($ip, $viewadd = 1) {
  19. return DB::query('UPDATE %t SET view=view+(%d) WHERE `ip`=%s', array($this->_table, $viewadd, $ip));
  20. }
  21. public function range($start = 0, $limit = 0) {
  22. return DB::fetch_all('SELECT * FROM '.DB::table($this->_table).' ORDER BY view DESC'.DB::limit($start, $limit), $this->_pk);
  23. }
  24. }
  25. ?>