[go: up one dir, main page]

Menu

[r60]: / edit.php  Maximize  Restore  History

Download this file

95 lines (91 with data), 2.9 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?
require_once 'config.php';
if(!$is_admin){
header("Location: ".$_SERVER['HTTP_REFERER']);
}
if(!isset($_GET['machine'])){
if(!isset($_POST)){
die();
}
else {
$mid=$_POST['mid'];
foreach($_POST['service'] as $service){
if($service['id']!=null){
$temp= new MLService($service['id']);
$temp->loadFromArray($service);
$temp->save();
}
}
}
}
else {
$mid=$_GET['machine'];
}
$machine=new MLMachine($mid);
if($_POST){
$news=$_POST['service']['new'];
if($news['host']!=""){
$temp=new MLService();
$temp->loadFromArray($news);
$machine->updateService($temp);
}
}
//$services=getServicesOfMachine($mid);
$services=$machine->getServices();
?>
<html>
<body>
<form action='edit.php' method='post'>
<table align='center'>
<thead>
<tr>
<td colspan='6' style='text-align:center' >Services for <?php echo $machine->display." ( ".$machine->host." )"; ?></td>
</tr>
</thead>
<tr>
<td>Display</td>
<td>Protocol</td>
<td>Port</td>
<td>Interval</td>
<td>Count</td>
<td>Service Name</td>
<td>Del</td>
</tr>
<?php foreach($services as $service): ?>
<tr>
<td><input type='text' name='<?php echo "service[".$service->getID()."][display]"; ?>' value='<?php echo $service->getDisplay(); ?>' /> </td>
<td><?php echo getListOfProtocols($service->getID(),$service->getProtocol()) ?> </td>
<td><input type='text' name='<?php echo "service[".$service->getID()."][port]"; ?>' value='<?php echo $service->getPort(); ?>' /> </td>
<td><input type='text' name='<?php echo "service[".$service->getID()."][interval]"; ?>' value='<?php echo $service->getINterval(); ?>' /> </td>
<td>
<input type='text' name='<?php echo "service[".$service->getID()."][count]"; ?>' value='<?php echo $service->getCount(); ?>' />
<input type='hidden' name='<?php echo "service[".$service->getID()."][id]"; ?>' value='<?php echo $service->getID(); ?>' />
</td>
<td><input type='text' name='<?php echo "service[".$service->getID()."][service_name]"; ?>' value='<?php echo $service->getServiceName(); ?>' /> </td>
<td><input type='checkbox' name='<?php echo "service[".$service->getID()."][del]"; ?>' /> </td>
</tr>
<?php endforeach ?>
<tr>
<td colspan='6'><hr/></td>
</tr>
<tr>
<td><?php echo getListOfProtocols('new','http') ?> </td>
<td><input type='text' name="service[new][port]"/> </td>
<td><input type='text' name="service[new][interval]"/> </td>
<td>
<input type='text' name='service[new][count]' />
<input type='hidden' name='service[new][mid]' value='<?php echo $mid?>' />
</td>
<td><input type='text' name='<?php echo "service[new][service_name]"; ?>' /> </td>
<td></td>
</tr>
<tfoot>
<tr>
<td colspan='4'><input type='submit' value="Update" /></td>
</tr>
</tfoot>
</table>
<input type='hidden' name='mid' value='<?php echo $mid?>' />
</form>
</body>
</html>