-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdeleteNetwork.php
More file actions
49 lines (38 loc) · 1.5 KB
/
deleteNetwork.php
File metadata and controls
49 lines (38 loc) · 1.5 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
<?php
$id = $_GET['id'];
$hasSubnet = false;
$q = "SELECT * FROM `ipamv6` WHERE `id`= '".$id."';";
$res = $sql->query($q);
$row = $sql->array_result($res);
$ip = new IPv6();
$ip->initBinary($row['network_bin'], $row['mask']);
// check if there are subnets
$q="SELECT * FROM `ipamv6` WHERE `network_bin` LIKE '".substr($row['network_bin'], 0, $row['mask'])."%' AND `mask` > '".$row['mask']."' LIMIT 1;";
$res = $sql->query($q);
$row = $sql->array_result($res);
if($row['id']!="")
$hasSubnet=true;
?>
<form action="./deleteNetworks.php" method="get" class="delete-network-form">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<input type="hidden" name="url" value="<?php echo $_SERVER["HTTP_REFERER"]; ?>">
<div class="confirmation-message">
Do you really want to delete <?php echo $ip->getMyCompressedAddress(); ?>/<?php echo $ip->myPrefix; ?>?
</div>
<div class="form-actions">
<?php if($hasSubnet) { ?>
<div class="subnet-option">
<label>
<input type="checkbox" name="subnets" value="1">
also delete <b>all</b> subnets!
</label>
</div>
<?php } else { ?>
<input type="hidden" name="subnets" value="0">
<?php } ?>
<div class="button-group">
<input type="submit" value="Yes" class="btn btn-danger">
<input type="button" value="Cancel" onclick="history.go(-1);" class="btn btn-secondary">
</div>
</div>
</form>