Subversion-Projekte lars-tiefland.openvz_admin

Revision

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

Revision 109 Revision 133
Zeile 1... Zeile 1...
1
<?php
1
<?php
Zeile 2... Zeile 2...
2
 
2
 
3
	//$Id: hn.class.php 109 2008-05-09 22:19:52Z lars $
3
	//$Id: hn.class.php 133 2008-05-22 16:48:38Z lars $
4
	/**
4
	/**
5
	 * @author Lars Tiefland
5
	 * @author Lars Tiefland
6
	 * @copyright 2008
6
	 * @copyright 2008
7
	 * @package	openvzadmin
7
	 * @package	openvzadmin
Zeile 11... Zeile 11...
11
		protected $id;
11
		protected $id;
12
		protected $ip;
12
		protected $ip;
13
		protected $name;
13
		protected $name;
14
		protected $ve_start;
14
		protected $ve_start;
15
		protected $ve_end;
15
		protected $ve_end;
-
 
16
		var $status;
Zeile 16... Zeile 17...
16
		
17
		
17
		function __construct($ip=NULL,$name="",$ve_start="101",$ve_end="199")
18
		function __construct($ip=NULL,$name="",$ve_start="101",$ve_end="199")
18
		{
19
		{
19
			global $db;
20
			global $db;
Zeile 25... Zeile 26...
25
				$this->id=$row["id"];
26
				$this->id=$row["id"];
26
				$this->ip=$row["ip"];
27
				$this->ip=$row["ip"];
27
				$this->name=$row["h_name"];
28
				$this->name=$row["h_name"];
28
				$this->ve_start=$row["ve_start"];
29
				$this->ve_start=$row["ve_start"];
29
				$this->ve_end=$row["ve_end"];
30
				$this->ve_end=$row["ve_end"];
-
 
31
				$this->status=$this->getStatus();
30
			}
32
			}
31
			else
33
			else
32
			{
34
			{
33
				$this->id=0;
35
				$this->id=0;
34
				$this->ip=$ip;
36
				$this->ip=$ip;
35
				$this->name=$name;
37
				$this->name=$name;
36
				$this->ve_start=$ve_start;
38
				$this->ve_start=$ve_start;
37
				$this->ve_end=$ve_end;
39
				$this->ve_end=$ve_end;
-
 
40
				$this->status="online";
38
			}
41
			}
39
		}
42
		}
Zeile 40... Zeile 43...
40
		
43
		
41
		function toArray()
44
		function toArray()
Zeile 68... Zeile 71...
68
			{
71
			{
69
				$out[$row["id"]]=$row["h_name"];
72
				$out[$row["id"]]=$row["h_name"];
70
			}
73
			}
71
			return $out;
74
			return $out;
72
		}
75
		}
-
 
76
		
-
 
77
		function getStatus()
-
 
78
		{
-
 
79
			$cmd="ping $this->name -c1";
-
 
80
			exec($cmd, $out, $ret);
-
 
81
			if($ret)
-
 
82
			{
-
 
83
				$status="offline";
-
 
84
			}
-
 
85
			else
-
 
86
			{
-
 
87
				$status="online";
-
 
88
			}
-
 
89
			return $status;
-
 
90
		}
73
	}
91
	}
74
?>
92
?>
75
93