confirm device deletion, remove base_url

git-svn-id: http://www.observium.org/svn/observer/trunk@2647 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-10-05 10:15:48 +00:00
parent 83f335785b
commit 42d43c47e5
2 changed files with 28 additions and 8 deletions

View File

@@ -1,3 +1,5 @@
<h1>Delete Host</h1>
<?php <?php
if ($_SESSION['userlevel'] < 10) if ($_SESSION['userlevel'] < 10)
@@ -6,16 +8,31 @@ if ($_SESSION['userlevel'] < 10)
exit; exit;
} }
if ($_REQUEST['id']) if (is_numeric($_REQUEST['id']))
{ {
echo(delete_device(mres($_REQUEST['id']))); if ($_REQUEST['confirm'])
} {
print_message(delete_device(mres($_REQUEST['id'])));
}
else
{
$device = device_by_id_cache($_REQUEST['id']);
print_message("Are you sure you want to delete device " . $device['hostname'] . "?");
?>
<br />
<form name="form1" method="post" action="">
<input type="hidden" name="id" value="<?php echo $_REQUEST['id'] ?>" />
<input type="hidden" name="confirm" value="1" />
<input type="submit" class="submit" name="Submit" value="Confirm host deletion" />
<?php
}
}
else
{
?> ?>
<form name="form1" method="post" action=""> <form name="form1" method="post" action="">
<h1>Delete Host</h1>
<br />
<p><select name="id"> <p><select name="id">
<?php <?php
@@ -27,7 +44,10 @@ foreach (dbFetchRows("SELECT * FROM `devices` ORDER BY `hostname`") as $data)
?> ?>
</select> </select>
<input type="hidden" name="confirm" value="1" />
<input type="submit" class="submit" name="Submit" value="Delete Host"> <input type="submit" class="submit" name="Submit" value="Delete Host" />
</p> </p>
</form> </form>
<?php
}
?>

View File

@@ -64,7 +64,7 @@ if ($updated && $update_message)
<tr> <tr>
<td> <td>
<h5> <h5>
<form id="delete_host" name="delete_host" method="post" action="<?php echo($config['base_url'].'/delhost/'); ?>"> <form id="delete_host" name="delete_host" method="post" action="delhost/">
<img src="images/16/server_delete.png" align="absmiddle"> <img src="images/16/server_delete.png" align="absmiddle">
<input type="hidden" name="id" value="<?php echo($device['device_id']); ?>"> <input type="hidden" name="id" value="<?php echo($device['device_id']); ?>">
<input type="submit" class="submit" name="Submit" value="Delete device"> <input type="submit" class="submit" name="Submit" value="Delete device">