Commit bfbf4570 authored by Eric - kg6wxc's avatar Eric - kg6wxc
Browse files

Bugfix/Update/Enhancement Admin pages

Finally finished a rough version of some admin pages that allow for
maintenance of the DB, fixing node locations, removing nodes, etc...
Username/Password is required to use the admin pages.
You must create an intial user/password.
When you first load the admin page it will ask you to create an initial
user.
This initial user is a "super user" and will be able to create other
users.
(more info is on the admin pages themselves)

Fixed a stupid mistake in export2csv.php.

Rearranged the columns in the node_info datebase which make the data
more readable when exported as CSV file.

Removed old DB columns that were now unused.

Changed the *.css-default file(s) to *-default.css so that IE will use
them without complaints.

More than a few other little changes here and there...
parent 12b091b3
...@@ -26,8 +26,10 @@ Donations / Beer accepted! :) (paypal possibly coming soon, email: kg6wxc@gmail. ...@@ -26,8 +26,10 @@ Donations / Beer accepted! :) (paypal possibly coming soon, email: kg6wxc@gmail.
<ul> <ul>
<li><strong>Apache webserver</strong><br/> <li><strong>Apache webserver</strong><br/>
(or equiv)</li> (or equiv)</li>
<li><strong>PHP</strong></li> <li><strong>PHP5+</strong></li>
<li><strong>PHP mysqli extension</strong></li> <li><strong>mysqli PHP extension</strong></li>
<li><strong>openssl PHP extension</strong><br/>
(One or both of these extensions may need to be enabled in php.ini)</li>
<li><strong>MySQL/MariaDB</strong><br/> <li><strong>MySQL/MariaDB</strong><br/>
(Other database systems are up to you)</li> (Other database systems are up to you)</li>
<li><strong>An AREDN Mesh node available over the local network</strong><br/> <li><strong>An AREDN Mesh node available over the local network</strong><br/>
...@@ -94,11 +96,12 @@ Building/Using a map tile server is not for the faint of heart!</blockquote> ...@@ -94,11 +96,12 @@ Building/Using a map tile server is not for the faint of heart!</blockquote>
<li><p><strong>2: Import the SQL file to create the database</strong><br/> <li><p><strong>2: Import the SQL file to create the database</strong><br/>
<em>Example</em>: <code>sudo mysql &lt; node_map.sql</code></p></li> <em>Example</em>: <code>sudo mysql &lt; node_map.sql</code></p></li>
<li><p><strong>3: Create a user for the database, you might have to login to the mysql server as root.</strong><br/> <li><p><strong>3: Create a user for the database, you might have to login to the mysql server as root.</strong><br/>
Here is an example of creating a mySQL user and granting access to the node_map database:</p> Here is an example of creating a mySQL user and granting access to the node_map database:<br/>
Choose your own password!</p>
<blockquote><p><code>sudo mysql</code><br/> <blockquote><p><code>sudo mysql</code><br/>
<code>CREATE USER 'mesh-map'@'localhost' IDENTIFIED BY 'password';</code><br/> <code>CREATE USER 'mesh-map'@'localhost' IDENTIFIED BY 'password';</code><br/>
<code>GRANT SELECT, DELETE, DROP, INSERT, TRIGGER, UPDATE on node_map.* TO 'mesh-map'@'localhost';</code><br/> <code>GRANT ALL PRIVILEGES on node_map.* TO 'mesh-map'@'localhost';</code><br/>
<code>FLUSH PRIVLEGES;</code></p></blockquote></li> <code>FLUSH PRIVLEGES;</code></p></blockquote></li>
<li><p><strong>4: Copy scripts/user-settings.ini-default to /scripts/user-settings.ini and edit the user-settings.ini file</strong></p> <li><p><strong>4: Copy scripts/user-settings.ini-default to /scripts/user-settings.ini and edit the user-settings.ini file</strong></p>
...@@ -108,7 +111,8 @@ It is <strong>very important</strong> to make sure your SQL username and passwor ...@@ -108,7 +111,8 @@ It is <strong>very important</strong> to make sure your SQL username and passwor
<li>Also important is, if the system that this is running on cannot resolve &ldquo;localnode.local.mesh&rdquo; you can change that in the user-settings.ini file.</li> <li>Also important is, if the system that this is running on cannot resolve &ldquo;localnode.local.mesh&rdquo; you can change that in the user-settings.ini file.</li>
<li>Once you save to the user-settings.ini file any changes you make will not be overwritten by future updates.<br/> <li>Once you save to the user-settings.ini file any changes you make will not be overwritten by future updates.<br/>
The &ldquo;-default&rdquo; files <em>will probably</em> change though and you will need to update your personal files when this happens.</li> The &ldquo;-default&rdquo; files <em>will probably</em> change though and you will need to update your personal files when this happens.</li>
<li>There are many other things you can change in the ini files. Default Map center position, the header messages, etc.</li> <li>There are many other things you can change in the ini files.<br/>
The default center position of the map, node expiration intervals, the header messages, logo, etc.</li>
<li><em>Please read</em> the comments in the user-settings.ini file for more info about the different settings.</li> <li><em>Please read</em> the comments in the user-settings.ini file for more info about the different settings.</li>
<li>There is also a &ldquo;custom.inc-default&rdquo; PHP file that can be used for more site specific overrides if needed.<br/> <li>There is also a &ldquo;custom.inc-default&rdquo; PHP file that can be used for more site specific overrides if needed.<br/>
Read that file for info on what it does, it can safely be ignored by most users.</li> Read that file for info on what it does, it can safely be ignored by most users.</li>
...@@ -194,18 +198,24 @@ Hopefully in the future this process can be more automated.</p> ...@@ -194,18 +198,24 @@ Hopefully in the future this process can be more automated.</p>
This can be useful to see if all the data is there or to find nodes that have no location set. (or other issues)</p> This can be useful to see if all the data is there or to find nodes that have no location set. (or other issues)</p>
<p>There is an &ldquo;admin&rdquo; page, which is still in the works, what is there now does work tho.<br/> <p>There is an &ldquo;admin&rdquo; page, which is still in the works, what is there now does work tho.<br/>
Try to load up: http://(hostname)/meshmap/admin/admin.php in your web browser.<br/> Load up: http://(hostname)/meshmap/admin/admin.php in your web browser.<br/>
The first time the admin page is loaded it will ask you to create a username and password, do so.<br/>
This initial user will be a &ldquo;super-user&rdquo; and can then add/remove other users.<br/>
I&rsquo;ve tried to provide instructions on the admin pages themselves.<br/> I&rsquo;ve tried to provide instructions on the admin pages themselves.<br/>
From the admin pages you can &ldquo;fix&rdquo; a nodes location, which can be helpful for those users that forget the &ldquo;-&rdquo; in front of their longitude. :)<br/> From the admin pages you can &ldquo;fix&rdquo; a nodes location, which can be helpful for those users that forget the &ldquo;-&rdquo; in front of their longitude. :)<br/>
The admin pages also allow for the addition of &ldquo;Non Mesh&rdquo; Markers, fire stations, police stations, EOC&rsquo;s , etc&hellip;</p> You can add the &ldquo;Non Mesh&rdquo; Markers, fire stations, police stations, EOC&rsquo;s , etc from the admin pages&hellip;<br/>
The admin pages also allow for some maintenance of the database, more feedback is encouraged on this!</p>
<p>You can change the way the page looks by copying webpage/css/meshmap.css-default to webpage/css/meshmap.css.</p> <p>You can change the way the page looks by copying webpage/css/meshmap-default.css to webpage/css/meshmap.css.<br/>
The meshmap.css file will be used in place of the -default.css file.<br/>
(This also applies to other *-default.css files)</p>
<h2>ToDo List</h2> <h2>ToDo List</h2>
<hr /> <hr />
<p>(In no particular order)<br/> <p>(In no particular order)<br/>
- [x] Finally finish my admin page idea.<br/>
- [x] Add new MeshMap Logo.<br/> - [x] Add new MeshMap Logo.<br/>
- [x] Change the user editable files to be distributed with &ldquo;-default&rdquo; added to the extension, no more tar.gz file.<br/> - [x] Change the user editable files to be distributed with &ldquo;-default&rdquo; added to the extension, no more tar.gz file.<br/>
- [x] Use a cookie instead of _POST for the internet check (No more stupid dialog box on refresh).<br/> - [x] Use a cookie instead of _POST for the internet check (No more stupid dialog box on refresh).<br/>
......
...@@ -19,8 +19,10 @@ Donations / Beer accepted! :) (paypal possibly coming soon, email: kg6wxc@gmail. ...@@ -19,8 +19,10 @@ Donations / Beer accepted! :) (paypal possibly coming soon, email: kg6wxc@gmail.
--------------- ---------------
- **Apache webserver** - **Apache webserver**
(or equiv) (or equiv)
- **PHP** - **PHP5+**
- **PHP mysqli extension** - **mysqli PHP extension**
- **openssl PHP extension**
(One or both of these extensions may need to be enabled in php.ini)
- **MySQL/MariaDB** - **MySQL/MariaDB**
(Other database systems are up to you) (Other database systems are up to you)
- **An AREDN Mesh node available over the local network** - **An AREDN Mesh node available over the local network**
...@@ -75,10 +77,11 @@ Building/Using a map tile server is not for the faint of heart!</blockquote> ...@@ -75,10 +77,11 @@ Building/Using a map tile server is not for the faint of heart!</blockquote>
*Example*: `sudo mysql < node_map.sql` *Example*: `sudo mysql < node_map.sql`
- **3: Create a user for the database, you might have to login to the mysql server as root.** - **3: Create a user for the database, you might have to login to the mysql server as root.**
Here is an example of creating a mySQL user and granting access to the node_map database: Here is an example of creating a mySQL user and granting access to the node_map database:
Choose your own password!
> `sudo mysql` > `sudo mysql`
> `CREATE USER 'mesh-map'@'localhost' IDENTIFIED BY 'password';` > `CREATE USER 'mesh-map'@'localhost' IDENTIFIED BY 'password';`
> `GRANT SELECT, DELETE, DROP, INSERT, TRIGGER, UPDATE on node_map.* TO 'mesh-map'@'localhost';` > `GRANT ALL PRIVILEGES on node_map.* TO 'mesh-map'@'localhost';`
> `FLUSH PRIVLEGES;` > `FLUSH PRIVLEGES;`
- **4: Copy scripts/user-settings.ini-default to /scripts/user-settings.ini and edit the user-settings.ini file** - **4: Copy scripts/user-settings.ini-default to /scripts/user-settings.ini and edit the user-settings.ini file**
...@@ -87,7 +90,8 @@ Here is an example of creating a mySQL user and granting access to the node_map ...@@ -87,7 +90,8 @@ Here is an example of creating a mySQL user and granting access to the node_map
* Also important is, if the system that this is running on cannot resolve "localnode.local.mesh" you can change that in the user-settings.ini file. * Also important is, if the system that this is running on cannot resolve "localnode.local.mesh" you can change that in the user-settings.ini file.
* Once you save to the user-settings.ini file any changes you make will not be overwritten by future updates. * Once you save to the user-settings.ini file any changes you make will not be overwritten by future updates.
The "-default" files *will probably* change though and you will need to update your personal files when this happens. The "-default" files *will probably* change though and you will need to update your personal files when this happens.
* There are many other things you can change in the ini files. Default Map center position, the header messages, etc. * There are many other things you can change in the ini files.
The default center position of the map, node expiration intervals, the header messages, logo, etc.
* *Please read* the comments in the user-settings.ini file for more info about the different settings. * *Please read* the comments in the user-settings.ini file for more info about the different settings.
* There is also a "custom.inc-default" PHP file that can be used for more site specific overrides if needed. * There is also a "custom.inc-default" PHP file that can be used for more site specific overrides if needed.
Read that file for info on what it does, it can safely be ignored by most users. Read that file for info on what it does, it can safely be ignored by most users.
...@@ -152,16 +156,22 @@ http://(hostname)/meshmap/node_report.php will show you all the info in the DB w ...@@ -152,16 +156,22 @@ http://(hostname)/meshmap/node_report.php will show you all the info in the DB w
This can be useful to see if all the data is there or to find nodes that have no location set. (or other issues) This can be useful to see if all the data is there or to find nodes that have no location set. (or other issues)
There is an "admin" page, which is still in the works, what is there now does work tho. There is an "admin" page, which is still in the works, what is there now does work tho.
Try to load up: http://(hostname)/meshmap/admin/admin.php in your web browser. Load up: http://(hostname)/meshmap/admin/admin.php in your web browser.
The first time the admin page is loaded it will ask you to create a username and password, do so.
This initial user will be a "super-user" and can then add/remove other users.
I've tried to provide instructions on the admin pages themselves. I've tried to provide instructions on the admin pages themselves.
From the admin pages you can "fix" a nodes location, which can be helpful for those users that forget the "-" in front of their longitude. :) From the admin pages you can "fix" a nodes location, which can be helpful for those users that forget the "-" in front of their longitude. :)
The admin pages also allow for the addition of "Non Mesh" Markers, fire stations, police stations, EOC's , etc... You can add the "Non Mesh" Markers, fire stations, police stations, EOC's , etc from the admin pages...
The admin pages also allow for some maintenance of the database, more feedback is encouraged on this!
You can change the way the page looks by copying webpage/css/meshmap.css-default to webpage/css/meshmap.css. You can change the way the page looks by copying webpage/css/meshmap-default.css to webpage/css/meshmap.css.
The meshmap.css file will be used in place of the -default.css file.
(This also applies to other *-default.css files)
## ToDo List ## ToDo List
---------- ----------
(In no particular order) (In no particular order)
- [x] Finally finish my admin page idea.
- [x] Add new MeshMap Logo. - [x] Add new MeshMap Logo.
- [x] Change the user editable files to be distributed with "-default" added to the extension, no more tar.gz file. - [x] Change the user editable files to be distributed with "-default" added to the extension, no more tar.gz file.
- [x] Use a cookie instead of _POST for the internet check (No more stupid dialog box on refresh). - [x] Use a cookie instead of _POST for the internet check (No more stupid dialog box on refresh).
......
-- -------------------------------------------------------- -- --------------------------------------------------------
-- Host: camphost -- Host: 192.168.81.222
-- Server version: 10.0.30-MariaDB - MariaDB Server -- Server version: 10.2.14-MariaDB-log - MariaDB Server
-- Server OS: Linux -- Server OS: Linux
-- HeidiSQL Version: 9.5.0.5264 -- HeidiSQL Version: 9.4.0.5125
-- -------------------------------------------------------- -- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
...@@ -26,28 +26,16 @@ CREATE TABLE IF NOT EXISTS `hosts_ignore` ( ...@@ -26,28 +26,16 @@ CREATE TABLE IF NOT EXISTS `hosts_ignore` (
KEY `name` (`name`) KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Hostnames to ignore because they are probably not AREDN nodes.'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Hostnames to ignore because they are probably not AREDN nodes.';
-- Data exporting was unselected.
-- Dumping structure for table node_map.mac_ip_name_map
CREATE TABLE IF NOT EXISTS `mac_ip_name_map` (
`mac_address` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`ip_address` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`node_name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
UNIQUE KEY `hostname` (`node_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Hostnames, IP address, and MAC addresses';
-- Data exporting was unselected. -- Data exporting was unselected.
-- Dumping structure for table node_map.map_info -- Dumping structure for table node_map.map_info
CREATE TABLE IF NOT EXISTS `map_info` ( CREATE TABLE IF NOT EXISTS `map_info` (
`id` varchar(50) COLLATE utf8_unicode_ci NOT NULL, `id` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`table_or_script_name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `table_or_script_name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`table_records_num` int(11) DEFAULT NULL, `table_records_num` int(11) DEFAULT NULL,
`table_update_num` int(11) NOT NULL DEFAULT '0', `table_update_num` int(11) NOT NULL DEFAULT 0,
`table_last_update` datetime DEFAULT NULL, `table_last_update` datetime DEFAULT NULL,
`script_last_run` datetime DEFAULT NULL, `script_last_run` datetime DEFAULT NULL,
`currently_running` int(11) DEFAULT '0' COMMENT 'tells us if getNodeInfo is currently running or not', `currently_running` int(11) DEFAULT 0 COMMENT 'tells us if getNodeInfo is currently running or not',
`user` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`passwd` varchar(256) COLLATE utf8_unicode_ci DEFAULT NULL,
`last_login` datetime DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Keeping track of some things about the map'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Keeping track of some things about the map';
...@@ -67,53 +55,51 @@ CREATE TABLE IF NOT EXISTS `marker_info` ( ...@@ -67,53 +55,51 @@ CREATE TABLE IF NOT EXISTS `marker_info` (
-- Data exporting was unselected. -- Data exporting was unselected.
-- Dumping structure for table node_map.node_info -- Dumping structure for table node_map.node_info
CREATE TABLE IF NOT EXISTS `node_info` ( CREATE TABLE IF NOT EXISTS `node_info` (
`wifi_mac_address` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`node` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `node` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`lat` double DEFAULT NULL, `wlan_ip` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`lon` double DEFAULT NULL, `last_seen` datetime DEFAULT NULL,
`model` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `model` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`firmware_version` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `firmware_version` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`ssid` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `ssid` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`channel` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`chanbw` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `chanbw` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`api_version` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`board_id` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`tunnel_installed` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `tunnel_installed` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`active_tunnel_count` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `active_tunnel_count` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`channel` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `lat` double DEFAULT NULL,
`grid_square` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `lon` double DEFAULT NULL,
`wifi_mac_address` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`api_version` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`board_id` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`firmware_mfg` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `firmware_mfg` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`grid_square` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`lan_ip` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `lan_ip` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`wlan_ip` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `sysinfo_json` mediumblob DEFAULT NULL,
`sysinfo_json` mediumblob, `location_fix` int(11) DEFAULT 0,
`olsrinfo_json` mediumblob,
`last_seen` datetime DEFAULT NULL,
`location_fix` int(11) DEFAULT '0',
UNIQUE KEY `node` (`node`) UNIQUE KEY `node` (`node`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Information about the nodes\r\ntaken from sysinfo.json that is on every node.'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Information about the nodes\r\ntaken from sysinfo.json that is on every node.';
-- Data exporting was unselected. -- Data exporting was unselected.
-- Dumping structure for table node_map.removed_nodes -- Dumping structure for table node_map.removed_nodes
CREATE TABLE IF NOT EXISTS `removed_nodes` ( CREATE TABLE IF NOT EXISTS `removed_nodes` (
`wifi_mac_address` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`node` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `node` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`lat` double DEFAULT NULL, `wlan_ip` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`lon` double DEFAULT NULL, `last_seen` datetime DEFAULT NULL,
`model` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `model` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`firmware_version` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `firmware_version` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`ssid` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `ssid` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`channel` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`chanbw` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `chanbw` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`api_version` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`board_id` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`tunnel_installed` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `tunnel_installed` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`active_tunnel_count` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `active_tunnel_count` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`channel` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `lat` double DEFAULT NULL,
`gridsquare` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `lon` double DEFAULT NULL,
`wifi_mac_address` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`api_version` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`board_id` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`firmware_mfg` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `firmware_mfg` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`grid_square` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`lan_ip` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `lan_ip` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`wlan_ip` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `sysinfo_json` mediumblob DEFAULT NULL,
`sysinfo_json` mediumblob,
`olsrinfo_json` mediumblob,
`last_seen` datetime DEFAULT NULL,
`time_removed` datetime DEFAULT NULL, `time_removed` datetime DEFAULT NULL,
UNIQUE KEY `node` (`node`) UNIQUE KEY `node` (`node`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='A place to put old nodes'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='A place to put old nodes';
...@@ -137,7 +123,7 @@ CREATE TABLE IF NOT EXISTS `topology` ( ...@@ -137,7 +123,7 @@ CREATE TABLE IF NOT EXISTS `topology` (
-- Dumping structure for table node_map.users -- Dumping structure for table node_map.users
CREATE TABLE IF NOT EXISTS `users` ( CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`admin` int(1) DEFAULT '0', `admin` int(1) DEFAULT 0,
`user` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `user` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`passwd` varchar(256) COLLATE utf8_unicode_ci DEFAULT NULL, `passwd` varchar(256) COLLATE utf8_unicode_ci DEFAULT NULL,
`last_login` datetime DEFAULT NULL, `last_login` datetime DEFAULT NULL,
......
...@@ -538,21 +538,21 @@ if ($getNodeInfo) { ...@@ -538,21 +538,21 @@ if ($getNodeInfo) {
$sql = "INSERT INTO $sql_db_tbl( $sql = "INSERT INTO $sql_db_tbl(
wifi_mac_address, node, model, firmware_version, lat, lon, grid_square, ssid, chanbw, api_version, board_id, wifi_mac_address, node, model, firmware_version, lat, lon, grid_square, ssid, chanbw, api_version, board_id,
tunnel_installed, active_tunnel_count, channel, firmware_mfg, lan_ip, wlan_ip, sysinfo_json, olsrinfo_json, last_seen) tunnel_installed, active_tunnel_count, channel, firmware_mfg, lan_ip, wlan_ip, sysinfo_json, last_seen)
VALUES('$wifi_mac_address', '$node', '$model', '$firmware_version', VALUES('$wifi_mac_address', '$node', '$model', '$firmware_version',
'$lat', '$lon', '$grid_square', '$ssid', '$chanbw', '$api_version', '$board_id', '$lat', '$lon', '$grid_square', '$ssid', '$chanbw', '$api_version', '$board_id',
'$tunnel_installed', '$active_tunnel_count', '$channel', '$tunnel_installed', '$active_tunnel_count', '$channel',
'$firmware_mfg', '$lan_ip', '$wlan_ip', '$sysinfoJson', '$olsrdInfo', NOW()) '$firmware_mfg', '$lan_ip', '$wlan_ip', '$sysinfoJson', NOW())
ON DUPLICATE KEY UPDATE wifi_mac_address = '$wifi_mac_address', node = '$node', model = '$model', firmware_version = '$firmware_version', ON DUPLICATE KEY UPDATE wifi_mac_address = '$wifi_mac_address', node = '$node', model = '$model', firmware_version = '$firmware_version',
lat = '$lat', lon = '$lon', grid_square = '$grid_square', ssid = '$ssid', chanbw = '$chanbw', api_version = '$api_version', lat = '$lat', lon = '$lon', grid_square = '$grid_square', ssid = '$ssid', chanbw = '$chanbw', api_version = '$api_version',
board_id = '$board_id', tunnel_installed = '$tunnel_installed', board_id = '$board_id', tunnel_installed = '$tunnel_installed',
active_tunnel_count = '$active_tunnel_count', channel = '$channel', active_tunnel_count = '$active_tunnel_count', channel = '$channel',
firmware_mfg = '$firmware_mfg', lan_ip = '$lan_ip', wlan_ip = '$wlan_ip', firmware_mfg = '$firmware_mfg', lan_ip = '$lan_ip', wlan_ip = '$wlan_ip',
sysinfo_json = '$sysinfoJson', olsrinfo_json = '$olsrdInfo', last_seen = NOW()"; sysinfo_json = '$sysinfoJson', last_seen = NOW()";
$sql_no_location_info = "INSERT INTO $sql_db_tbl( $sql_no_location_info = "INSERT INTO $sql_db_tbl(
wifi_mac_address, node, model, firmware_version, grid_square, ssid, chanbw, api_version, board_id, wifi_mac_address, node, model, firmware_version, grid_square, ssid, chanbw, api_version, board_id,
tunnel_installed, active_tunnel_count, channel, firmware_mfg, lan_ip, wlan_ip, sysinfo_json, olsrinfo_json, last_seen) tunnel_installed, active_tunnel_count, channel, firmware_mfg, lan_ip, wlan_ip, sysinfo_json, last_seen)
VALUES('$wifi_mac_address', '$node', '$model', '$firmware_version', VALUES('$wifi_mac_address', '$node', '$model', '$firmware_version',
'$grid_square', '$ssid', '$chanbw', '$api_version', '$board_id', '$grid_square', '$ssid', '$chanbw', '$api_version', '$board_id',
'$tunnel_installed', '$active_tunnel_count', '$channel', '$tunnel_installed', '$active_tunnel_count', '$channel',
...@@ -562,7 +562,7 @@ if ($getNodeInfo) { ...@@ -562,7 +562,7 @@ if ($getNodeInfo) {
board_id = '$board_id', tunnel_installed = '$tunnel_installed', board_id = '$board_id', tunnel_installed = '$tunnel_installed',
active_tunnel_count = '$active_tunnel_count', channel = '$channel', active_tunnel_count = '$active_tunnel_count', channel = '$channel',
firmware_mfg = '$firmware_mfg', lan_ip = '$lan_ip', wlan_ip = '$wlan_ip', firmware_mfg = '$firmware_mfg', lan_ip = '$lan_ip', wlan_ip = '$wlan_ip',
sysinfo_json = '$sysinfoJson', olsrinfo_json = '$olsrdInfo', last_seen = NOW()"; sysinfo_json = '$sysinfoJson', last_seen = NOW()";
$sql_update_when_node_name_has_changed = "UPDATE $sql_db_tbl SET $sql_update_when_node_name_has_changed = "UPDATE $sql_db_tbl SET
node = '$node', model = '$model', node = '$node', model = '$model',
......
...@@ -85,7 +85,8 @@ function build_NodesAndLinks($NodeList, $TopoList, $MarkerList = null) ...@@ -85,7 +85,8 @@ function build_NodesAndLinks($NodeList, $TopoList, $MarkerList = null)
/* /*
* Find the Services for the node * Find the Services for the node
********************************/ ********************************/
$node_ServiceList = load_ServiceList($node_info['olsrinfo_json']); // $node_ServiceList = load_ServiceList($node_info['olsrinfo_json']);
$node_ServiceList = "";
/* /*
* Build the Nodes Marker * Build the Nodes Marker
......
...@@ -261,31 +261,31 @@ if($sysinfoJson === FALSE) { ...@@ -261,31 +261,31 @@ if($sysinfoJson === FALSE) {
$sql = "INSERT INTO $sql_db_tbl( $sql = "INSERT INTO $sql_db_tbl(
wifi_mac_address, node, model, firmware_version, lat, lon, grid_square, ssid, chanbw, api_version, board_id, wifi_mac_address, node, model, firmware_version, lat, lon, grid_square, ssid, chanbw, api_version, board_id,
tunnel_installed, active_tunnel_count, channel, firmware_mfg, lan_ip, wlan_ip, sysinfo_json, olsrinfo_json, last_seen) tunnel_installed, active_tunnel_count, channel, firmware_mfg, lan_ip, wlan_ip, sysinfo_json, last_seen)
VALUES('$wifi_mac_address', '$node', '$model', '$firmware_version', VALUES('$wifi_mac_address', '$node', '$model', '$firmware_version',
'$lat', '$lon', '$grid_square', '$ssid', '$chanbw', '$api_version', '$board_id', '$lat', '$lon', '$grid_square', '$ssid', '$chanbw', '$api_version', '$board_id',
'$tunnel_installed', '$active_tunnel_count', '$channel', '$tunnel_installed', '$active_tunnel_count', '$channel',
'$firmware_mfg', '$lan_ip', '$wlan_ip', '$sysinfoJson', '$olsrdInfo', NOW()) '$firmware_mfg', '$lan_ip', '$wlan_ip', '$sysinfoJson', NOW())
ON DUPLICATE KEY UPDATE wifi_mac_address = '$wifi_mac_address', node = '$node', model = '$model', firmware_version = '$firmware_version', ON DUPLICATE KEY UPDATE wifi_mac_address = '$wifi_mac_address', node = '$node', model = '$model', firmware_version = '$firmware_version',
lat = '$lat', lon = '$lon', grid_square = '$grid_square', ssid = '$ssid', chanbw = '$chanbw', api_version = '$api_version', lat = '$lat', lon = '$lon', grid_square = '$grid_square', ssid = '$ssid', chanbw = '$chanbw', api_version = '$api_version',
board_id = '$board_id', tunnel_installed = '$tunnel_installed', board_id = '$board_id', tunnel_installed = '$tunnel_installed',
active_tunnel_count = '$active_tunnel_count', channel = '$channel', active_tunnel_count = '$active_tunnel_count', channel = '$channel',
firmware_mfg = '$firmware_mfg', lan_ip = '$lan_ip', wlan_ip = '$wlan_ip', firmware_mfg = '$firmware_mfg', lan_ip = '$lan_ip', wlan_ip = '$wlan_ip',
sysinfo_json = '$sysinfoJson', olsrinfo_json = '$olsrdInfo', last_seen = NOW()"; sysinfo_json = '$sysinfoJson', last_seen = NOW()";
$sql_no_location_info = "INSERT INTO $sql_db_tbl( $sql_no_location_info = "INSERT INTO $sql_db_tbl(
wifi_mac_address, node, model, firmware_version, grid_square, ssid, chanbw, api_version, board_id, wifi_mac_address, node, model, firmware_version, grid_square, ssid, chanbw, api_version, board_id,
tunnel_installed, active_tunnel_count, channel, firmware_mfg, lan_ip, wlan_ip, sysinfo_json, olsrinfo_json, last_seen) tunnel_installed, active_tunnel_count, channel, firmware_mfg, lan_ip, wlan_ip, sysinfo_json, last_seen)
VALUES('$wifi_mac_address', '$node', '$model', '$firmware_version', VALUES('$wifi_mac_address', '$node', '$model', '$firmware_version',
'$grid_square', '$ssid', '$chanbw', '$api_version', '$board_id', '$grid_square', '$ssid', '$chanbw', '$api_version', '$board_id',
'$tunnel_installed', '$active_tunnel_count', '$channel', '$tunnel_installed', '$active_tunnel_count', '$channel',
'$firmware_mfg', '$lan_ip', '$wlan_ip', '$sysinfoJson', '$olsrdInfo', NOW()) '$firmware_mfg', '$lan_ip', '$wlan_ip', '$sysinfoJson', NOW())
ON DUPLICATE KEY UPDATE wifi_mac_address = '$wifi_mac_address', node = '$node', model = '$model', firmware_version = '$firmware_version', ON DUPLICATE KEY UPDATE wifi_mac_address = '$wifi_mac_address', node = '$node', model = '$model', firmware_version = '$firmware_version',
grid_square = '$grid_square', ssid = '$ssid', chanbw = '$chanbw', api_version = '$api_version', grid_square = '$grid_square', ssid = '$ssid', chanbw = '$chanbw', api_version = '$api_version',
board_id = '$board_id', tunnel_installed = '$tunnel_installed', board_id = '$board_id', tunnel_installed = '$tunnel_installed',
active_tunnel_count = '$active_tunnel_count', channel = '$channel', active_tunnel_count = '$active_tunnel_count', channel = '$channel',
firmware_mfg = '$firmware_mfg', lan_ip = '$lan_ip', wlan_ip = '$wlan_ip', firmware_mfg = '$firmware_mfg', lan_ip = '$lan_ip', wlan_ip = '$wlan_ip',
sysinfo_json = '$sysinfoJson', olsrinfo_json = '$olsrdInfo', last_seen = NOW()"; sysinfo_json = '$sysinfoJson', last_seen = NOW()";
$sql_update_when_node_name_has_changed = "UPDATE $sql_db_tbl SET $sql_update_when_node_name_has_changed = "UPDATE $sql_db_tbl SET
node = '$node', model = '$model', node = '$node', model = '$model',
......
...@@ -452,7 +452,7 @@ function wxc_checkOldNodes() { ...@@ -452,7 +452,7 @@ function wxc_checkOldNodes() {
$oldNodeQuery = $oldNodeQuery =
"INSERT INTO removed_nodes ( "INSERT INTO removed_nodes (
wifi_mac_address, node, model, firmware_version, lat, lon, ssid, chanbw, api_version, board_id, wifi_mac_address, node, model, firmware_version, lat, lon, ssid, chanbw, api_version, board_id,
tunnel_installed, active_tunnel_count, channel, firmware_mfg, lan_ip, wlan_ip, sysinfo_json, olsrinfo_json, last_seen, time_removed) tunnel_installed, active_tunnel_count, channel, firmware_mfg, lan_ip, wlan_ip, sysinfo_json, last_seen, time_removed)
VALUES "; VALUES ";
$valuesArray = array(); $valuesArray = array();
foreach ($oldNodes as $row) { foreach ($oldNodes as $row) {
...@@ -474,11 +474,11 @@ function wxc_checkOldNodes() { ...@@ -474,11 +474,11 @@ function wxc_checkOldNodes() {
$lan_ip = $row['lan_ip']; $lan_ip = $row['lan_ip'];
$wlan_ip = $row['wlan_ip']; $wlan_ip = $row['wlan_ip'];
$sysinfo_json = $row['sysinfo_json']; $sysinfo_json = $row['sysinfo_json'];
$olsrinfo_json = $row['olsrinfo_json']; //$olsrinfo_json = $row['olsrinfo_json'];
$last_seen = $row['last_seen']; $last_seen = $row['last_seen'];
$valuesArray[] = "('$wifi_mac_address', '$node', '$model', '$firmware_version', '$lat', '$lon', '$ssid', '$chanbw', '$api_version', '$board_id', $valuesArray[] = "('$wifi_mac_address', '$node', '$model', '$firmware_version', '$lat', '$lon', '$ssid', '$chanbw', '$api_version', '$board_id',
'$tunnel_installed', '$active_tunnel_count', '$channel', '$firmware_mfg', '$lan_ip', '$wlan_ip', '$sysinfo_json', '$olsrinfo_json', '$last_seen', NOW())"; '$tunnel_installed', '$active_tunnel_count', '$channel', '$firmware_mfg', '$lan_ip', '$wlan_ip', '$sysinfo_json', '$last_seen', NOW())";
} }
if ($valuesArray) { if ($valuesArray) {
......
<?php <?php
if ($_POST['action'] == "add_non_mesh_station") { session_start();
echo "<form action=\"adminpage.php\" method=\"POST\">\n"; if (!isset($_SESSION['userLoggedIn'])) {
echo "Input a new \"Non-MESH\" station:<br>"; echo "You are not logged in!<br>\n";
echo "Name: <input type=\"text\" name=\"new_station_name\" value=\"\"> "; echo "This page should be run from within the admin interface!\n";
echo "Description: <input type=\"text\" name=\"new_station_description\" value=\"\"> "; exit;
echo "Type: <select name=\"new_station_type\">"; }else {
echo "<option value=\"operator\">Radio Operator</option>"; if ($_POST['action'] == "add_non_mesh_station") {
echo "<option value=\"firedepartment\">Fire Department</option>"; echo "<form action=\"adminpage.php\" method=\"POST\">\n";
echo "<option value=\"police\">Police Station</option>"; echo "Input a new \"Non-MESH\" station:<br>";
echo "</select>"; echo "Name: <input type=\"text\" name=\"new_station_name\" value=\"\"> ";
echo "Lat: <input type=\"text\" name=\"new_station_lat\" value=\"\"> "; echo "Description: <input type=\"text\" name=\"new_station_description\" value=\"\"> ";
echo "Lon: <input type=\"text\" name=\"new_station_lon\" value=\"\"> "; echo "Type: <select name=\"new_station_type\">";
echo "<input type=\"hidden\" name=\"action\" value=\"add_non_mesh_station\">"; echo "<option value=\"operator\">Radio Operator</option>";
echo "<input type=\"hidden\" name=\"sub_action\" value=\"new_station\">"; echo "<option value=\"firedepartment\">Fire Department</option>";
echo "<input type=\"hidden\" name=\"user\" value=\"" . $user . "\">"; echo "<option value=\"police\">Police Station</option>";
echo "<input type=\"hidden\" name=\"password\" value=\"" . $userInputPasswd . "\">"; echo "</select>";
echo "<input type=\"submit\" value=\"Add\">"; echo "Lat: <input type=\"text\" name=\"new_station_lat\" value=\"\"> ";
echo "</form>"; echo "Lon: <input type=\"text\" name=\"new_station_lon\" value=\"\"> ";
if (($_POST['sub_action'] == "new_station") && (isset($_POST['new_station_name'])) && (isset($_POST['new_station_description'])) && echo "<input type=\"hidden\" name=\"action\" value=\"add_non_mesh_station\">";
(isset($_POST['new_station_type'])) && (isset($_POST['new_station_lat'])) && (isset($_POST['new_station_lon']))) { echo "<input type=\"hidden\" name=\"sub_action\" value=\"new_station\">";
$newStationName = $_POST['new_station_name']; echo "<input type=\"hidden\" name=\"user\" value=\"" . $user . "\">";
$newStationDescription = $_POST['new_station_description']; echo "<input type=\"hidden\" name=\"password\" value=\"" . $userInputPasswd . "\">";
$newStationType = $_POST['new_station_type']; echo "<input type=\"submit\" value=\"Add\">";
$newStationLat = $_POST['new_station_lat']; echo "</form>";
$newStationLon = $_POST['new_station_lon']; if (($_POST['sub_action'] == "new_station") && (isset($_POST['new_station_name'])) && (isset($_POST['new_station_description'])) &&
(isset($_POST['new_station_type'])) && (isset($_POST['new_station_lat'])) && (isset($_POST['new_station_lon']))) {
$addedToSql = wxc_putMySQL("INSERT INTO marker_info (name, description, type, lat, lon) VALUES ('$newStationName', '$newStationDescription', '$newStationType', '$newStationLat', '$newStationLon')"); $newStationName = $_POST['new_station_name'];
if ($addedToSql = 1) { $newStationDescription = $_POST['new_station_description'];
echo "Sucessfully added " . $newStationName . " to the database.<br>"; $newStationType = $_POST['new_station_type'];
unset($_POST['new_station_name']); $newStationLat = $_POST['new_station_lat'];
unset($_POST['new_station_description']); $newStationLon = $_POST['new_station_lon'];
unset($_POST['new_station_type']);
unset($_POST['new_station_lat']); $addedToSql = wxc_putMySQL("INSERT INTO marker_info (name, description, type, lat, lon) VALUES ('$newStationName', '$newStationDescription', '$newStationType', '$newStationLat', '$newStationLon')");
unset($_POST['new_station_lon']); if ($addedToSql = 1) {
unset($_POST['sub_action']); echo "Sucessfully added " . $newStationName . " to the database.<br>";
unset($_POST['new_station_name']);
unset($_POST['new_station_description']);
unset($_POST['new_station_type']);
unset($_POST['new_station_lat']);
unset($_POST['new_station_lon']);
unset($_POST['sub_action']);
}
} }
} $nonMeshStationsAndMarkers = mysqli_query($GLOBALS['sql_connection'], "SELECT name, description, type, lat, lon FROM marker_info") or die ("Could not get list of non mesh stations" . mysqli_error($GLOBALS['sql_connection']));
$nonMeshStationsAndMarkers = mysqli_query($GLOBALS['sql_connection'], "SELECT name, description, type, lat, lon FROM marker_info") or die ("Could not get list of non mesh stations" . mysqli_error($GLOBALS['sql_connection'])); if ($nonMeshStationsAndMarkers) {
if ($nonMeshStationsAndMarkers) { $nonMeshStationsAndMarkers = mysqli_fetch_all($nonMeshStationsAndMarkers, MYSQLI_ASSOC);
$nonMeshStationsAndMarkers = mysqli_fetch_all($nonMeshStationsAndMarkers, MYSQLI_ASSOC); echo "This is what is in the database:<br>\n";
echo "This is what is in the database:<br>\n"; echo "<table>";
echo "<table>"; echo "<tr><th><b>Name</b></th><th><b>Description</b></th><th><b>Type</b></th><th><b>Lat</b></th><th><b>Lon</b></th></tr>";
echo "<tr><th><b>Name</b></th><th><b>Description</b></th><th><b>Type</b></th><th><b>Lat</b></th><th><b>Lon</b></th></tr>"; foreach ($nonMeshStationsAndMarkers as $value) {
foreach ($nonMeshStationsAndMarkers as $value) {