/
vlanAdmin.php
90 lines (80 loc) · 4.59 KB
/
vlanAdmin.php
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
84
85
86
87
88
89
90
<?php
//
// +----------------------------------------------------------------------+
// | RackMan http://rackman.jasonantman.com |
// +----------------------------------------------------------------------+
// | Copyright (c) 2009 Jason Antman. |
// | |
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 3 of the License, or |
// | (at your option) any later version. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to: |
// | |
// | Free Software Foundation, Inc. |
// | 59 Temple Place - Suite 330 |
// | Boston, MA 02111-1307, USA. |
// +----------------------------------------------------------------------+
// | ADDITIONAL TERMS (pursuant to GPL Section 7): |
// | 1) You may not remove any of the "Author" or "Copyright" attributions|
// | from this file or any others distributed with this software. |
// | 2) If modified, you must make substantial effort to differentiate |
// | your modified version from the original, while retaining all |
// | attribution to the original project and authors. |
// +----------------------------------------------------------------------+
// |Please use the above URL for bug reports and feature/support requests.|
// +----------------------------------------------------------------------+
// | Authors: Jason Antman <jason@jasonantman.com> |
// +----------------------------------------------------------------------+
// | $LastChangedRevision:: $ |
// | $HeadURL:: $ |
// +----------------------------------------------------------------------+
require_once('../config/config.php');
require_once('../inc/funcs.php.inc');
rackman_mysql_connect() or die("Error connecting to MySQL.\n");
mysql_select_db($dbName) or die("Error selecting MySQL database: ".$dbName."\n");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Room Admin - Rack Management</title>
<link rel="stylesheet" type="text/css" href="../main.css" />
</head>
<body>
<?php
if(isset($_POST['action']))
{
// handle the form
$query = "INSERT INTO vlans SET vlan_num=".((int)$_POST['vlan_num']).",vlan_name='".mysql_real_escape_string($_POST['vlan_name'])."',vlan_desc='".mysql_real_escape_string($_POST['vlan_desc'])."';";
$result = mysql_query($query) or die("Error in query: ".$query."\nError: ".mysql_error());
}
// show the form
echo '<h2>VLANS:</h2>'."\n";
// show the existing locations
$query = "SELECT * FROM vlans ORDER BY vlan_num;";
$result = mysql_query($query) or die("Error in query: ".$query."\nError: ".mysql_error());
while($row = mysql_fetch_assoc($result))
{
echo 'VLAN '.$row['vlan_num'].' - '.$row['vlan_name'].' ('.$row['vlan_desc'].')<br />'."\n";
}
echo '<br />'."\n";
// end showing the locations
echo '<form name="vlanAdmin" method="post">'."\n";
echo '<input type="radio" name="action" id="action" value="add" checked="checked" /><label>Add VLAN:</label> <strong>Number:</strong> ';
echo '<input type="text" name="vlan_num" size="4" />';
echo ' <strong>Name: </strong><input type="text" name="vlan_name" size="20" /> <strong>Description:</strong><input type="text" name="vlan_desc" size="40" />'."\n";
echo '<div id="buttonDiv"><input type="submit" value="Submit"><input type="reset" value="Reset"></div>'."\n";
echo '</form>'."\n";
require_once('../footer.php');
?>
</body>
</html>