Subversion-Projekte lars-tiefland.openvz_admin

Revision

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

Revision 92 Revision 99
Zeile 1... Zeile 1...
1
<?php
1
<?php
2
	//$Id: ip.class.php 92 2008-02-16 23:24:18Z lars $
2
	//$Id: ip.class.php 99 2008-02-19 20:25:04Z lars $
3
/**
3
/**
4
 * @author Lars Tiefland
4
 * @author Lars Tiefland
5
 * @copyright 2007
5
 * @copyright 2007
Zeile 6... Zeile 6...
6
 
6
 
Zeile 7... Zeile 7...
7
 */
7
 */
8
 
8
 
9
 
9
 
10
	class IP
10
	class IP
11
	{
11
	{
12
		protected $ip;
12
		protected $ip;
13
		protected $used;
13
		protected $hn;
14
		protected $dns;
14
		protected $dns;
15
		protected $gw;
15
		protected $gw;
16
		function __construct($ip=NULL, $used=0, $dns=0, $gw=0)
16
		function __construct($ip=NULL, $hn=0, $dns=0, $gw=0)
17
		{
17
		{
18
			global $db;
18
			global $db;
19
			if(!is_null($ip))
19
			if(!is_null($ip))
20
			{
20
			{
21
				$sql="SELECT * FROM ips WHERE ip='$ip'";
21
				$sql="SELECT * FROM ips WHERE ip='$ip'";
22
				$res=$db->query($sql);
22
				$res=$db->query($sql);
23
				$row=$res->fetchRow();
23
				$row=$res->fetchRow();
24
				$this->ip=$row["ip"];
24
				$this->ip=$row["ip"];
25
				$this->used=$row["used"];
25
				$this->hn=$row["hn"];
26
				$this->dns=$row["dns"];
26
				$this->dns=$row["dns"];
27
				$this->gw=$row["gs"];
27
				$this->gw=$row["gs"];
28
			}
28
			}
29
			else
29
			else
30
			{
30
			{
31
				$this->ip=$ip;
31
				$this->ip=$ip;
32
				$this->used=$used;
32
				$this->hn=$hn;
33
				$this->dns=$dns;
33
				$this->dns=$dns;
Zeile 34... Zeile 34...
34
				$this->gw=$gw;
34
				$this->gw=$gw;
35
			}
35
			}
36
		}
36
		}
37
		
37
		
38
		function toArray()
38
		function toArray()
39
		{
39
		{
40
			$out["ip"]=$this->ip;
40
			$out["ip"]=$this->ip;
41
			$out["dns"]=$this->dns;
41
			$out["dns"]=$this->dns;
Zeile 42... Zeile 42...
42
			$out["gw"]=$this->gw;
42
			$out["gw"]=$this->gw;
43
			$out["used"]=$this->used;
43
			$out["hn"]=$this->hn;
Zeile 52... Zeile 52...
52
			$row=$res->fetchRow();
52
			$row=$res->fetchRow();
53
			$ip=new IP($row["ip"]);
53
			$ip=new IP($row["ip"]);
54
			return $ip->toArray();
54
			return $ip->toArray();
55
		}
55
		}
Zeile 56... Zeile 56...
56
		
56
		
57
		static function getIPs($used=0, $dns=0, $gw=0)		
57
		static function getIPs($hn=1, $used=0, $dns=0, $gw=0)		
58
		{
58
		{
59
			global $db;
59
			global $db;
60
			$sql="SELECT id, ip FROM ips WHERE dns=$dns AND gw=$gw";
60
			$sql="SELECT id, ip FROM ips WHERE dns=$dns AND gw=$gw AND hn=$hn";
61
			$res=$db->query($sql);
61
			$res=$db->query($sql);
62
			$out[-1]="Bitte w&auml;hlen!";
62
			$out[-1]="Bitte w&auml;hlen!";
63
			while($row=$res->fetchRow())
63
			while($row=$res->fetchRow())
64
			{
64
			{