-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstoreEditedNetwork.php
More file actions
40 lines (29 loc) · 923 Bytes
/
storeEditedNetwork.php
File metadata and controls
40 lines (29 loc) · 923 Bytes
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
<?php
$id = $_GET['id'];
$newNetwork = $_GET['newNetwork'];
$newMask = $_GET['newMask'];
$newDescription = $_GET['newDescription'];
$newColor = $_GET['newColor'];
$newRoot = isset($_GET['root']) ? $_GET['root'] : 0;
$insIp = new IPv6();
if($_GET['format']=="hex")
$insIp->initHex($newNetwork, $newMask);
else
$insIp->initBinary($newNetwork, $newMask);
$q= "UPDATE `ipamv6` SET
`network` = '".$insIp->getMyExpandedAddress()."',
`network_bin` = '".$insIp->binNetwork()."',
`mask` = '".$newMask."',
`color` = '".$newColor."',
`root` = '".$newRoot."',
`description` = '".$newDescription."'
WHERE
`id` = ".$id.";";
$res = $sql->query($q);
#header("Location: ./?action=showIpv6Route");
$mask = (floor($newMask/8) * 8);
if($mask >= 128)
$mask=120;
header("Location: ./?action=sudoku&mask=".$mask."&network=".substr($insIp->binNetwork(), 0, $mask).str_repeat("0", (128 - $mask)));
exit();
?>