Subversion-Projekte lars-tiefland.openvz_admin

Revision

Revision 27 | Revision 30 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 27 Revision 29
Zeile 11... Zeile 11...
11
	{
11
	{
12
		protected $ip;
12
		protected $ip;
13
		protected $used;
13
		protected $used;
14
		protected $dns;
14
		protected $dns;
15
		protected $gw;
15
		protected $gw;
16
		function __construct($ip, $used=0, $dns=0, $gw=0)
16
		function __construct($ip=NULL, $used=0, $dns=0, $gw=0)
17
		{
17
		{
-
 
18
			if(!is_null($ip))
-
 
19
			{
-
 
20
				$sql="SELECT * FROM ips WHERE ip='$ip'";
-
 
21
				$res=$db->query($sql);
-
 
22
				$row=$res->fetchRow();
-
 
23
				$this->ip=$row["ip"];
-
 
24
				$this->used=$row["used"];
-
 
25
				$this->dns=$row["dns"];
-
 
26
				$this->gw=$row["gs"];
-
 
27
			}
-
 
28
			else
-
 
29
			{
18
			$this->ip=$ip;
30
				$this->ip=$ip;
19
			$this->used=$used;
31
				$this->used=$used;
20
			$this->dns=$dns;
32
				$this->dns=$dns;
21
			$this->gw=$gw;
33
				$this->gw=$gw;
-
 
34
			}
22
		}
35
		}
Zeile 23... Zeile 36...
23
		
36
		
24
		function toArray()
37
		function toArray()
25
		{
38
		{
Zeile 35... Zeile 48...
35
			global $db;
48
			global $db;
36
			$sql="SELECT id, ip FROM ips WHERE used=$used AND dns=$dns AND gw=$gw";
49
			$sql="SELECT id, ip FROM ips WHERE used=$used AND dns=$dns AND gw=$gw";
37
			$res=$db->query($sql);
50
			$res=$db->query($sql);
38
			while($row=$res->fetchRow())
51
			while($row=$res->fetchRow())
39
			{
52
			{
40
				$out[]=$row;
53
				$out[$row["id"]]=$row["ip"];
41
			}
54
			}
42
			return $out;
55
			return $out;
43
		}
56
		}
44
	}
57
	}
45
?>
58
?>
46
59