-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserviceengines.php
More file actions
83 lines (78 loc) · 2.49 KB
/
serviceengines.php
File metadata and controls
83 lines (78 loc) · 2.49 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
?>
<h1>Service Engines</h1>
<?php
if (isset($_GET['delete'])) {
?>
<div>
<?php
// sql to delete a record
$sql = "DELETE FROM streaming_engine WHERE streaming_engine_id=" . $_GET['delete'];
if (mysql_query($sql) === TRUE) {
echo "Service Engine deleted successfully<br>";
} else {
echo "Error deleting service engine: " . mysql_error();
}
?>
</div>
<?php
}
if (isset($_GET['add'])) {
//TODO validate
$sql = "INSERT INTO streaming_engine (ip_address) VALUES (INET_ATON('" . $_GET['ipaddress'] . "'))";
if (mysql_query($sql) === TRUE) {
echo "Service Engine added successfully<br>";
} else {
echo "Error adding Service Engine " . mysql_error();
}
}
$sees = mysql_query("SELECT streaming_engine_id as id, INET_NTOA(ip_address) as ip FROM streaming_engine")
or die('mysql error' . mysql_error());
?>
<div>
<div class="tableclass">
<form action="index.php" method="get">
<table border="1px solid">
<tr>
<td>ID</td>
<td>IP address</td>
<td></td>
</tr>
<?php
while ($row = mysql_fetch_array($sees)) {
?>
<tr>
<td>
<?php echo $row['id']; ?>
</td>
<td>
<?php echo $row['ip']; ?>
</td>
<td>
<input type="hidden" name="do" value="serviceengines" />
<button type="submit" name="delete" value="<?php echo $row['id']; ?>">Delete</button>
</td>
</tr>
<?php
}
?>
</table>
</form>
</div>
<br>
<div>
<h2>Add new Service Engine:</h2>
<form action="index.php" method="get">
IP address: <input type="text" name="ipaddress"/>
<input type="hidden" name="do" value="serviceengines" />
<button type="submit" name="add" value="add">Add new</button>
</form>
</div>
<br>
<a href="<?php echo $_SITEROOT; ?>">Back</a>
</div>