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