Files
librenms-librenms/html/pages/addsrv.php
T

76 lines
1.8 KiB
PHP
Raw Normal View History

2007-04-03 14:10:23 +00:00
<?php
2007-06-24 14:56:47 +00:00
if($_SESSION['userlevel'] < '10') {
echo("<span class='alert'>Insufficient privileges to perform this function.</span>");
2007-04-03 14:10:23 +00:00
} else {
if($_POST['addsrv']) {
2007-11-21 14:26:24 +00:00
if($_SESSION['userlevel'] == '10') {
2007-04-03 14:10:23 +00:00
include("includes/add-srv.inc");
}
}
2008-03-24 01:21:11 +00:00
if ($handle = opendir($config['install_dir'] . "/includes/services/")) {
2007-04-03 14:10:23 +00:00
while (false !== ($file = readdir($handle))) {
2007-04-07 19:25:55 +00:00
if ($file != "." && $file != ".." && !strstr($file, ".")) {
2007-04-03 14:10:23 +00:00
$servicesform .= "<option value='$file'>$file</option>";
}
}
closedir($handle);
}
$query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`");
while($device = mysql_fetch_array($query)) {
2007-11-21 14:26:24 +00:00
$devicesform .= "<option value='" . $device['device_id'] . "'>" . $device['hostname'] . "</option>";
2007-04-03 14:10:23 +00:00
}
if($updated) { print_message("Device Settings Saved"); }
echo("
<h4>Add Service</h4>
<form id='addsrv' name='addsrv' method='post' action=''>
<input type=hidden name='addsrv' value='yes'>
<table width='200' border='0'>
<tr>
<td>
Device
</td>
<td>
<select name='device'>
$devicesform
</select>
</td>
</tr>
<tr>
<td>
Type
</td>
<td>
<select name='type'>
$servicesform
</select>
</td>
</tr>
<tr>
<td width='300'><div align='right'>Description</div></td>
<td colspan='2'><textarea name='descr' cols='50'></textarea></td>
</tr>
<tr>
<td width='300'><div align='right'>IP Address</div></td>
<td colspan='2'><input name='ip'></textarea></td>
</tr>
<tr>
<td width='300'><div align='right'>Parameters</div></td>
<td colspan='2'><input name='params'></textarea></td>
</tr>
<tr>
</table>
<input type='submit' name='Submit' value='Add' />
<label><br />
</label>
</form>");
}