domain.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. {
  10. var $db;
  11. var $base;
  12. function __construct(&$base)
  13. {
  14. $this->domainmodel($base);
  15. }
  16. function domainmodel(&$base)
  17. {
  18. $this->base = $base;
  19. $this->db = $base->db;
  20. }
  21. function add_domain($domain, $ip)
  22. {
  23. if ($domain)
  24. {
  25. $this->db->query("INSERT INTO " . UC_DBTABLEPRE . "domains SET domain='$domain', ip='$ip'");
  26. }
  27. return $this->db->insert_id();
  28. }
  29. function get_total_num()
  30. {
  31. $data = $this->db->result_first("SELECT COUNT(*) FROM " . UC_DBTABLEPRE . "domains");
  32. return $data;
  33. }
  34. function get_list($page, $ppp, $totalnum)
  35. {
  36. $start = $this->base->page_get_start($page, $ppp, $totalnum);
  37. $data = $this->db->fetch_all("SELECT * FROM " . UC_DBTABLEPRE . "domains LIMIT $start, $ppp");
  38. return $data;
  39. }
  40. function delete_domain($arr)
  41. {
  42. $domainids = $this->base->implode($arr);
  43. $this->db->query("DELETE FROM " . UC_DBTABLEPRE . "domains WHERE id IN ($domainids)");
  44. return $this->db->affected_rows();
  45. }
  46. function update_domain($domain, $ip, $id)
  47. {
  48. $this->db->query("UPDATE " . UC_DBTABLEPRE . "domains SET domain='$domain', ip='$ip' WHERE id='$id'");
  49. return $this->db->affected_rows();
  50. }
  51. }