3 $actionRegister["addsuper"] = "www_ip_addSuperRange";
4 $actionRegister["allocate"] = "www_ip_allocateSubRange";
8 // this is the web page entry function.
12 //if($db->connect()!=0) {
13 //$this->doInstaller();
17 // its up to auth as to wether "this" url requires auth.
18 $authThis = new auth();
21 if(isset($_REQUEST["action"])) {
22 $this->doAction($_REQUEST["action"]);
28 function doAction($actionName)
30 global $actionRegister;
33 if(isset($actionRegister[$actionName])) {
34 $func = $actionRegister[$actionName];
35 error_log("im here 2");
38 error_log("im here 3");
45 // we build a frame of framey's
57 <form method="post" action="?action=addsuper">
58 Create Supernet: name <input type="text" name="name"></input>
59 Subnet Address <input type="text" name="subnet"></input>
60 Mask <input type="text" name="mask"></input>
61 Description <input type="text" name="desc"></input>
62 <input type="submit" name="go" Value="Create"></input>
66 // now print the super nets
67 $res = $db->dbobject->query("select * from supernet");
68 foreach($res as $row) {
72 echo "<table border=\"1\"><tr><th>".$row["sn_name"]."</th><td>".$row["sn_ip"]."/".$row["sn_mask"]."</td><td>".$row["sn_desc"]."</td>";
73 echo "<td><a href=\"?action=allocate&id=".$row["sn_id"]."\">Allocate Subnet</a></td>";
74 echo "<td><a href=\"?action=delete&id=".$row["sn_id"]."\">Delete Supernet</a></td>";
75 // now we search for sub's
82 if(isset($_REQUEST["error"]))
84 echo "<font color=\"red\">".$_REQUEST["error"]."</font>";
86 if(isset($_REQUEST["notice"]))
88 echo "<font color=\"green\">".$_REQUEST["notice"]."</font>";
93 function header($title = "Welcome to PHP IP Manager")
97 <head><title><?php echo $title ?></title>
99 <body><h1><?php echo $title ?></h1>
111 function doInstaller()
113 header("Location: install.php");
117 function www_ip_addSuperRange()
121 $name = $_REQUEST["name"];
122 $sn = $_REQUEST["subnet"];
123 $mask = $_REQUEST["mask"];
124 $desc = $_REQUEST["desc"];
128 if($myip->addSupernet($name, $sn, $mask, $desc)) {
129 header("Location: index.php?notice=range added");
131 header("Location: index.php?error=invalid ipaddress");
135 function www_ip_allocateSubRange()
137 global $db, $wwwConnector;
139 $id = $_REQUEST["id"];
141 $res = $db->dbobject->query("select * from supernet where sn_id=='$id'");
143 foreach($res as $row) {
146 $wwwConnector->header();
147 $wwwConnector->printError();
149 sql is <?php echo "select * from supernet where sn_id=='$id" ?><br>
150 <form method="post" action="?action=allocatesub&id=<?php echo $id ?>">
152 <tr><td>Subnet Name</td><td><input type="text" name="subname"></td></tr>
153 <tr><td>Subnet IP</td><td><input type="text" name="subip" value="<?php echo $sn?>"></td></tr>
154 <tr><td>Subnet Mask</td><td><input type="text" name="subip"></td></tr>
155 <tr><td>Description</td><td><input type="text" name="subdesc"></td></tr>
156 <tr><td><input type="submit" name="add" value="Add"></td></tr>
161 $wwwConnector->footer();