-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathaddNewNetwork.php
More file actions
42 lines (33 loc) · 886 Bytes
/
addNewNetwork.php
File metadata and controls
42 lines (33 loc) · 886 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
41
42
<?php
$newNetwork = $_GET['newNetwork'];
$newMask = $_GET['newMask'];
$newDescription = $_GET['newDescription'];
$newColour = $_GET['newColour'];
$newRoot = isset($_GET['root']) ? $_GET['root'] : 0;
$insIp = new IPv6();
if($_GET['format'] == "hex")
$insIp->initHex($newNetwork, $newMask);
else
$insIp->initBinary($newNetwork, $newMask);
$q = "INSERT INTO `ipamv6` (
`network` ,
`network_bin` ,
`mask` ,
`color` ,
`description`,
`root`)
VALUES (
'".$insIp->getMyExpandedAddress()."',
'".$insIp->binNetwork()."',
'".$insIp->myPrefix."',
'".$newColour."',
'".$newDescription."',
'".$newRoot."'
);";
$res = $sql->query($q);
$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();
?>