Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_SESSION["isAdmin"]) && $_SESSION["isAdmin"] == 1){
- ?>
- <section id='mainSensorManagement'>
- <h1 style="color:rgba(53,149,225,1);margin-bottom: 25px;">Sensor Management</h1><hr>
- <table id="sensorTable" class="table">
- <thead>
- <tr>
- <th>ID</th>
- <th>Hostname</th>
- <th>IP-Address</th>
- <th>Is blocked?</th>
- <th>Update</th>
- <th>Delete</th>
- </tr>
- </thead>
- <tbody>
- <?php
- //Execute query to MySQL database to get all monitors
- $res = $db->query("SELECT * FROM tblMonitor");
- while($arr = $res->fetch_assoc()){
- $id = $arr["idMonitor"];
- $name = $arr["dtMonitor"];
- $ip = $arr["dtIP"];
- $isBlocked = $arr["dtIsBlocked"];
- echo "
- <tr><form action='php/private/updateMonitor.php?id=$id' method='POST' onsubmit=\"return confirm('Do you really want to update this monitor?');\">
- <td><input type='text' name='idMonitor' value='".$id."' required".$id." placeholder='Name' disabled readonly class='form-control'></td>
- <td><input type='text' name='dtMonitor' value='".$name."' required".$name." placeholder='Name' class='form-control'></td>
- <td><input type='text' name='dtIP' value='".$ip."' required".$ip." placeholder='IP-Address' class='form-control'></td>";
- if(functions::sanitize_string_for_html($isBlocked, $db, 1) == 1)echo "<td><a href='php/private/setBlockState.php?fId=$id&fBlockState=0' id='".$id."IsBlocked'><img src='img/blocked.png' alt='Blocked' height='24'></a></td>";
- else echo "<td><a href='php/private/setBlockState.php?fId=$id&fBlockState=1' id='".$id."IsBlocked'><img src='img/notblocked.png' alt='Unblocked' height='24'></a></td>";
- echo "<td><input type='submit' name='fUpdate' value='Update' class='btn btn-primary'></td></form>
- <td><form action='php/private/deleteMonitor.php?id=$id' method='POST' onsubmit=\"return confirm('Do you really want to delete this monitor?');\"><input type='submit' name='fDelete' value='Delete' class='btn btn-danger'></form></td>
- </tr>
- ";
- }
- ?>
- <tr><form action="php/private/addMonitor.php" method="POST">
- <td><input type="text" name="fHostname" placeholder="Hostname" required class="form-control"></td>
- <td><input type="text" name="fIP" placeholder="IP-Address" required class="form-control"></td>
- <td><input type="submit" name="fAdd" value="Add" required class="btn btn-primary"></td>
- <td></td>
- <td></td>
- <td></td></form>
- </tr>
- </tbody>
- </table>
- </section>
- <?php
- }else header("Location:/");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement