domain.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /*
  3. [UCenter] (C)2001-2099 Comsenz Inc.
  4. This is NOT a freeware, use is subject to license terms
  5. $Id: domain.php 1059 2011-03-01 07:25:09Z monkey $
  6. */
  7. !defined('IN_UC') && exit('Access Denied');
  8. class domainmodel {
  9. var $db;
  10. var $base;
  11. function __construct(&$base) {
  12. $this->domainmodel($base);
  13. }
  14. function domainmodel(&$base) {
  15. $this->base = $base;
  16. $this->db = $base->db;
  17. }
  18. function add_domain($domain, $ip) {
  19. if($domain) {
  20. $this->db->query("INSERT INTO ".UC_DBTABLEPRE."domains SET domain='$domain', ip='$ip'");
  21. }
  22. return $this->db->insert_id();
  23. }
  24. function get_total_num() {
  25. $data = $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."domains");
  26. return $data;
  27. }
  28. function get_list($page, $ppp, $totalnum) {
  29. $start = $this->base->page_get_start($page, $ppp, $totalnum);
  30. $data = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."domains LIMIT $start, $ppp");
  31. return $data;
  32. }
  33. function delete_domain($arr) {
  34. $domainids = $this->base->implode($arr);
  35. $this->db->query("DELETE FROM ".UC_DBTABLEPRE."domains WHERE id IN ($domainids)");
  36. return $this->db->affected_rows();
  37. }
  38. function update_domain($domain, $ip, $id) {
  39. $this->db->query("UPDATE ".UC_DBTABLEPRE."domains SET domain='$domain', ip='$ip' WHERE id='$id'");
  40. return $this->db->affected_rows();
  41. }
  42. }
  43. ?>