admin.php 23.6 KB
Newer Older
Eric - kg6wxc's avatar
Eric - kg6wxc committed
1
<?php 
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
ini_set('session.gc_maxlifetime', 3600);
session_set_cookie_params(3600);
session_start();
$now = time();
if (isset($_SESSION['discard_after']) && $now > $_SESSION['discard_after']) {
	//old session get rid of it
	session_unset();
	session_destroy();
	session_start();
}
if (isset($_POST['logMeOut'])) {
	session_unset();
	session_destroy();
	$_POST = array();
	header('Location: admin.php');
	die();
}
Eric - kg6wxc's avatar
Eric - kg6wxc committed
19
$INCLUDE_DIR = "../..";
Eric - kg6wxc's avatar
Eric - kg6wxc committed
20
21
$USER_SETTINGS = parse_ini_file($INCLUDE_DIR . "/scripts/user-settings.ini");
include $INCLUDE_DIR . "/scripts/wxc_functions.inc";
22
@include $INCLUDE_DIR . "/custom.inc";
Eric - kg6wxc's avatar
Eric - kg6wxc committed
23
24
25
$sqlSrvStatus;
$arname = "";
$sql_connection = wxc_connectToMySQL();
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
$dateTime = new DateTime("now", new DateTimeZone('America/Los_Angeles'));
$localTime = $dateTime -> format('Y-m-d');
if (!isset($_SESSION['userLoggedIn'])) {
    if (!isset($_POST['username']) && !isset($_POST['password'])) {
        //does a "super user" exist yet in the DB?
        //if not create it, maybe this is the first time running
        //or it is an existing DB, but doesn't have any users yet
        //(I thought this would be better than to have to create a whole new
        // .sql file with the default user/pass in it)
        $doesAdminUserExistYet = mysqli_query($sql_connection, "select user, admin from users where admin = 1");
        
        echo "<!DOCTYPE html>\n";
        echo "<html>\n";
        echo "<head>\n";
        echo "<title>MeshMap Admin Page Login</title>\n";
        echo "<meta http-equiv='Pragma' content='no-cache'>\n";
        echo "<meta http-equiv='Expires' content='-1'>\n";
		if (file_exists("./admin.css")) {
			echo "<link rel='stylesheet' href='admin.css'>\n";
		}else {
			echo "<link rel='stylesheet' href='admin-default.css'>\n";
		}
        echo "</head>\n";
        echo "<body>\n";
        
        if (!mysqli_num_rows($doesAdminUserExistYet)) {
            //this only shows up if a super user does not exist yet
            echo "<center><strong>There is no super user yet!</strong></center>\n";
            echo "<br>\n";
            echo "<center>Please create one!</center>\n";
        //  echo "<br>";
        //  echo "";
        	echo "<form id='first_login_form' action='admin.php' method='post'>\n";
        	echo "<input type='hidden' name='first_login' value='first_login'>\n";
        	echo "<table>\n";
        	echo "<tr>\n";
        	echo "<td>Callsign/Username</td>\n";
        	echo "<td><input type='text' name='user' value=''></td>\n";
        	echo "</tr>\n";
		echo "<tr>\n";
        	echo "<td>Password</td>\n";
        	echo "<td><input type='password' name='passwd' value=''></td>\n";
        	echo "</tr>\n";
		echo "</table>\n";
        	echo "<br>\n";
        	echo "<center>You should be redirected to the login page after you click submit.</center>\n";
        	echo "<center><input type='submit' value='Submit'></center>\n";
        	echo "</form>\n";
        	echo "<br>\n";
        	echo "<br>\n";
        	if (isset($_POST['first_login']) && isset($_POST['user']) && isset($_POST['passwd'])) {
        		$user = $_POST['user'];
        		$passwd = $_POST['passwd'];
        //		$salt = bin2hex(random_bytes(16)); // random_bytes() is only in PHP7
        		$salt = bin2hex(openssl_random_pseudo_bytes(16));
        		$cryptedPasswd = crypt($passwd, $salt);
        		$add_initial_user = wxc_putMySql("insert into users (user, passwd, admin) values ('$user', '$cryptedPasswd', 1)");
        		if ($add_initial_user) {
        			$_POST = array();
        			header("Location: admin.php");
        			die;
        		}
        	}
        }else {
	        //login page
	        echo "<center><strong>Please login to use the MeshMap Admin interface.</strong></center>\n";
	        echo "<br>\n";
	        echo "<form name='mapAdminLogin' method='POST'>\n";
	        echo "<center>Username: <input type='text' name='username' value='' autofocus></center><br>\n";
	        echo "<center>Password: <input type='password' name='password' value=''></center><br>\n";
	        echo "<center>" . "<input type='submit' value='Submit'></center></form>\n";
	        echo "<br>\n";
	        echo "</body>\n";
	        echo "</html>\n";
        }
    }else {
    	$passwordCheckResult = 0;
        $usernameIsGood = 0;
        $passwordIsGood = 0;
Eric - kg6wxc's avatar
Eric - kg6wxc committed
105

106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
        $username = $_POST['username'];
        $password = $_POST['password'];
        
        //check username
        $usernameCheckResult = mysqli_query($sql_connection, "SELECT id, user, admin from users where user='$username'");
        $userArray = mysqli_fetch_array($usernameCheckResult);
        $userID = $userArray['id'];
        $super_user = $userArray['admin'];
		$usernameCheckResult = mysqli_num_rows($usernameCheckResult);
        if ($usernameCheckResult) {
            $usernameIsGood = 1;
        }else {
        	echo "<!DOCTYPE html>\n";
        	echo "<html>\n";
        	echo "<head>\n";
        	echo "<title>MeshMap Admin Page Login</title>\n";
        	echo "<meta http-equiv='Pragma' content='no-cache'>\n";
        	echo "<meta http-equiv='Expires' content='-1'>\n";
			if (file_exists("./admin.css")) {
				echo "<link rel='stylesheet' href='admin.css'>\n";
			}else {
				echo "<link rel='stylesheet' href='admin-default.css'>\n";
			}
			echo "</head>\n";
        	echo "<body>\n";
        	echo "<br><br>\n";
        	echo "<center><strong><redText>No such user: " . $username . "!</redText></strong></center>\n";
        	echo "<br>\n";
        	echo "<center>Please try again...</center>\n";
        	echo "<br>\n";
        	//login page
        	echo "<center><strong>Please login to use the MeshMap Admin interface.<br>\n";
        	echo "<form name='mapAdminLogin' method='POST'>\n";
        	echo "<center>Username: <input type='text' name='username' value='' autofocus></center><br>\n";
        	echo "<center>Password: <input type='password' name='password' value=''></center><br>\n";
        	echo "<center>" . "<input type='submit' value='Submit'></center></form>";
        	echo "<br>";
        	echo "</body>\n";
        	echo "</html>\n";
        	die;
		}
        if ($usernameIsGood) {
        $query = "select passwd from users where id='" . $userID . "' and user='" . $username . "'";
        $storedPasswd = wxc_getMySql($query);
        $storedPasswd = $storedPasswd['passwd'];
        if (crypt($password, $storedPasswd) == $storedPasswd) {
        	$passwordCheckResult = 1;
        }else {
        	echo "<!DOCTYPE html>\n";
        	echo "<html>\n";
        	echo "<head>\n";
        	echo "<title>MeshMap Admin Page Login</title>\n";
        	echo "<meta http-equiv='Pragma' content='no-cache'>\n";
        	echo "<meta http-equiv='Expires' content='-1'>\n";
			if (file_exists("./admin.css")) {
				echo "<link rel='stylesheet' href='admin.css'>\n";
			}else {
				echo "<link rel='stylesheet' href='admin-default.css'>\n";
			}
        	echo "</head>\n";
        	echo "<body>\n";
        	echo "<br><br>\n";
        	echo "<center><strong><redText>Wrong password for: " . $username . "!</redText></strong></center>\n";
        	echo "<br>\n";
        	echo "<center>Please try again...</center>\n";
        	echo "<br>\n";
        	//login page
        	echo "<center><strong>Please login to use the MeshMap Admin interface.<br>\n";
        	echo "<form name='mapAdminLogin' method='POST'>\n";
        	echo "<center>Username: <input type='text' name='username' value='' autofocus></center><br>\n";
        	echo "<center>Password: <input type='password' name='password' value=''></center><br>\n";
        	echo "<center>" . "<input type='submit' value='Submit'></center></form>";
        	echo "<br>";
        	echo "</body>\n";
        	echo "</html>\n";
		}}
        if ($passwordCheckResult) {
            $passwordIsGood = 1;
            session_regenerate_id(FALSE);
            $_SESSION['username'] = $_POST['username'];
            $_SESSION['password'] = $_POST['password'];
        }
        if ($usernameIsGood && $passwordIsGood) {
            $_SESSION['userLoggedIn'] = 1;
            $_SESSION['id'] = $userID;
            $_SESSION['super_user'] = $super_user;
            wxc_putMySql("update users set last_login = now() where id='$userID' and user='$username'");
        }
    }
Eric - kg6wxc's avatar
Eric - kg6wxc committed
195
}
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
if (isset($_SESSION['userLoggedIn']) && $_SESSION['userLoggedIn'] = 1) {
    if (!$sql_connection) {
        $sqlSrvStatus = 0;
    }else {
        $sqlSrvStatus = 1;
        $totalNumNodes = mysqli_num_rows(mysqli_query($sql_connection, "SELECT node from node_info"));
        $totalNumNodesWithLocations = mysqli_num_rows(mysqli_query($sql_connection, "SELECT node FROM node_info WHERE lat != '0' AND lon != '0'"));
        $totalNumLinks = mysqli_num_rows(mysqli_query($sql_connection, "SELECT node from topology"));
        $totalNumLinksWithLocations = mysqli_num_rows(mysqli_query($sql_connection, "SELECT node from topology where ((linklat != '0' OR linklat IS NOT NULL) AND (linklon != '0' OR linklon IS NOT NULL)) AND ((nodelat != '0' OR nodelat IS NOT NULL) AND (nodelon != '0' OR nodelon IS NOT NULL));"));
        $totalRemovedNodes = mysqli_num_rows(mysqli_query($sql_connection, "SELECT node from removed_nodes"));
        $totalIgnoredNodes = mysqli_num_rows(mysqli_query($sql_connection, "SELECT ip FROM hosts_ignore"));
        $lastUpdateNodeInfo = wxc_getMySql("SELECT currently_running, table_last_update, script_last_run FROM map_info WHERE id = 'NODEINFO'");
        $lastUpdateLinkInfo = wxc_getMySql("SELECT table_last_update FROM map_info WHERE id = 'LINKINFO'");
        $totalNumNonMeshMarkers = mysqli_num_rows(mysqli_query($sql_connection, "SELECT name from marker_info"));
            
    }
Eric - kg6wxc's avatar
Eric - kg6wxc committed
212

213
214
215
216
217
218
219
220
221
222
    echo "<!DOCTYPE html>\n";
    echo "<html>\n";
    echo "<head>\n";
    echo "<title>MeshMap Admin Page</title>\n";
    
    if (file_exists("./admin.css")) {
    	echo "<link rel='stylesheet' href='admin.css'>\n";
    }else {
    	echo "<link rel='stylesheet' href='admin-default.css'>\n";
    }
Eric - kg6wxc's avatar
Eric - kg6wxc committed
223

224
225
226
    echo "<script src='../javascripts/jquery-3.2.1.js'></script>\n";

    $mainJavaScript = <<< EOD
Eric - kg6wxc's avatar
Eric - kg6wxc committed
227
<script>
228
229
230
231
232
	var arname = '';
	function loadThePage(div_id, script) {
		$("#"+div_id).html('<center><br><strong>Loading...</strong><br></center>');
    		if (script == "changeLocation" ) {
            	$.ajax({
Eric - kg6wxc's avatar
Eric - kg6wxc committed
233
                    type: "POST",
234
                    url: "update_node_location.php",
Eric - kg6wxc's avatar
Eric - kg6wxc committed
235
236
237
                    data: "arname="+arname,
                    success: function(msg){
                            $("#"+div_id).html(msg);
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
    						$('#nav_link_location').css("background-color", "#dddddd");
    						$('#nav_link_non_mesh').css("background-color", "");
    						$('#nav_link_removed').css("background-color", "");
                            $('#nav_link_ignored').css("background-color", "");
    						$('#nav_link_report').css("background-color", "");
							$('#nav_link_users').css("background-color", "");
    						$('#nav_link_other').css("background-color", "");
                    	}
            	});
            }
            if (script == "nonMeshStations") {
                $.ajax({
                        type: "POST",
                        url: "non_mesh_stations.php",
                        data: "arname="+arname,
                        success: function(msg){
                            $("#"+div_id).html(msg);
    						$('#nav_link_location').css("background-color", "");
    						$('#nav_link_non_mesh').css("background-color", "#dddddd");
    						$('#nav_link_removed').css("background-color", "");
                            $('#nav_link_ignored').css("background-color", "");
    						$('#nav_link_report').css("background-color", "");
							$('#nav_link_users').css("background-color", "");
    						$('#nav_link_other').css("background-color", "");
    
                        }
                });
            }
            if (script == "removedNodes") {
                $.ajax({
                        type: "POST",
                        url: "view_removed_nodes.php",
                        data: "arname="+arname,
                        success: function(msg){
                            $("#"+div_id).html(msg);
    						$('#nav_link_location').css("background-color", "");
    						$('#nav_link_non_mesh').css("background-color", "");
    						$('#nav_link_removed').css("background-color", "#dddddd");
                            $('#nav_link_ignored').css("background-color", "");
    						$('#nav_link_report').css("background-color", "");
							$('#nav_link_users').css("background-color", "");
    						$('#nav_link_other').css("background-color", "");
    
                        }
                });
            }
            if (script == "ignoredNodes") {
                $.ajax({
                        type: "POST",
                        url: "view_ignored_nodes.php",
                        data: "arname="+arname,
                        success: function(msg){
                            $("#"+div_id).html(msg);
    						$('#nav_link_location').css("background-color", "");
    						$('#nav_link_non_mesh').css("background-color", "");
    						$('#nav_link_removed').css("background-color", "");
                            $('#nav_link_ignored').css("background-color", "#dddddd");
    						$('#nav_link_report').css("background-color", "");
							$('#nav_link_users').css("background-color", "");
    						$('#nav_link_other').css("background-color", "");
    
                        }
                });
            }
            if (script == "nodeReport") {
                $.ajax({
                        type: "POST",
                        url: "../node_report.php",
                        //data: "arname="+arname,
						//data: "admin_page=admin_page",
						data: {admin_page: "admin_page"},
                        success: function(msg){
                            $("#"+div_id).html(msg);
    						$('#nav_link_location').css("background-color", "");
    						$('#nav_link_non_mesh').css("background-color", "");
    						$('#nav_link_removed').css("background-color", "");
                            $('#nav_link_ignored').css("background-color", "");
    						$('#nav_link_report').css("background-color", "#dddddd");
							$('#nav_link_users').css("background-color", "");
    						$('#nav_link_other').css("background-color", "");
    
    					}
                });
            }
            if (script == "users") {
                $.ajax({
                        type: "POST",
                        url: "users.php",
                        data: "arname="+arname,
                        success: function(msg){
                            $("#"+div_id).html(msg);
    						$('#nav_link_location').css("background-color", "");
    						$('#nav_link_non_mesh').css("background-color", "");
    						$('#nav_link_removed').css("background-color", "");
                            $('#nav_link_ignored').css("background-color", "");
    						$('#nav_link_report').css("background-color", "");
							$('#nav_link_users').css("background-color", "#dddddd");
    						$('#nav_link_other').css("background-color", "");
    
    					}
                });
            }
    	if (script == "otherAdmin") {
                $.ajax({
                        type: "POST",
                        url: "otherAdmin.php",
                        data: "arname="+arname,
                        success: function(msg){
                            $("#"+div_id).html(msg);
                            $('#nav_link_location').css("background-color", "");
                            $('#nav_link_non_mesh').css("background-color", "");
                            $('#nav_link_removed').css("background-color", "");
                            $('#nav_link_ignored').css("background-color", "");
                            $('#nav_link_report').css("background-color", "");
							$('#nav_link_users').css("background-color", "");
    						$('#nav_link_other').css("background-color", "#dddddd");
    
                                            }
                });
            }
            if (script == "viewMap") {
                $.ajax({
                        type: "POST",
                        url: "../map.php",
                        data: "arname="+arname,
                        success: function(msg){
                                $("#"+div_id).html(msg);
                        }
                });
            }
    }
    //auto updating values in the "status" area (hopefully)
    var db_stats_ajax_call = function() {
    		//ajax query code
    		$.ajax({
    			type: "GET",
    			url: "status_updates.php",
    			data: "arname="+arname,
    			success: function(msg) {
    				$("#admin_status").html(msg);
    			}
    		});
    }
    var interval = 1000 * 60 * 1; //every 1 minute
    setInterval(db_stats_ajax_call, interval);
Eric - kg6wxc's avatar
Eric - kg6wxc committed
383
</script>
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
EOD;
    if (isset($_SESSION['userLoggedIn'])) {
		echo $mainJavaScript ."\n";
    }
    
	echo "</head>\n";
	echo "<body>\n";
	echo "<div id='admin_wrapper'>\n";
	
	echo "<div id='admin_header'>\n";
	
	echo "<img style='height: 1.5em;' src='../images/MESHMAP_LOGO.svg'>\n";
	echo "<strong><span class='em1-5Text'><a class='normalTextLink' id='admin_main_link' href=''>MeshMap Admin</a></span></strong>\n";
	echo "<span class='emDot5Text'>(beta)</span>\n";
	echo "&nbsp;&nbsp;&nbsp;&nbsp;";
	//echo "<span style='display: inline-block' class='emDot5Text'>Logged in as: ";
	echo "<span style='display: block' class='emDot5Text'>Logged in as: ";
	
	if (isset($_SESSION['username'])) {
	    echo "<strong>" . $_SESSION['username'] . "</strong>\n";
	}
	echo "&nbsp;";
	if (isset($_SESSION['super_user']) && $_SESSION['super_user'] == 1) {
		echo "<greenText>  superuser!</greenText>\n";
	}
	echo "&nbsp;";
	echo "<form style='display: inline;' name='mapAdminLogout' method='POST'>\n";
	echo "<input type='hidden' name='logMeOut' value='1'>\n";
	echo "<input type='submit' class='linkButton' value='(Logout)'>\n";
	echo "</form>\n";
	
	echo "<br>\n";
//	if (isset($_SESSION['username']) && $_SESSION['username'] == "map-admin") {
//		echo "<redText><strong>Using default username, you might want to change it.</strong></redText>\n";
//	}
//	if (isset($_SESSION['id']) == "map-admin") {
//		$username = $_SESSION['username'];
//		$query = "select passwd from map_info where id='map-admin' and user='" . $username . "'";
//		$storedPasswd = wxc_getMySql($query);
//		$storedPasswd = $storedPasswd['passwd'];
//		if (crypt("meshmap", $storedPasswd) == $storedPasswd) {
//			echo "<br><strong><redText>DEFAULT PASSWORD!! GO CHANGE IT WITH THE USERS TAB! NOW!</redText></strong>\n"; 
//		}
//	}
	echo "</span>\n";
//	echo "<br>\n";
	echo "Running on " . $_SERVER['HTTP_HOST'] . "\n";
	
	// The links at the lower part of the "header"
	echo "<div class='admin_nav_links' id='admin_nav_links'>\n";
	echo "<a id='nav_link_location' href=\"javascript:onclick=loadThePage('admin_content', 'changeLocation');\">Node Locations</a>\n";
	echo "&nbsp;&nbsp;\n";
	echo "<a id='nav_link_non_mesh' href=\"javascript:onclick=loadThePage('admin_content', 'nonMeshStations');\">Non-Mesh Markers</a>\n";
	echo "&nbsp;&nbsp;\n";
	echo "<a id='nav_link_removed' href=\"javascript:onclick=loadThePage('admin_content', 'removedNodes');\">Expired Nodes</a>\n";
	echo "&nbsp;&nbsp;\n";
	echo "<a id='nav_link_ignored' href=\"javascript:onclick=loadThePage('admin_content', 'ignoredNodes');\">Ignored Nodes</a>\n";
	echo "&nbsp;&nbsp;\n";
	echo "<a id='nav_link_report' href=\"javascript:onclick=loadThePage('admin_content', 'nodeReport');\">Node Report</a>\n";
	echo "&nbsp;&nbsp;\n";
	echo "<a id='nav_link_users' href=\"javascript:onclick=loadThePage('admin_content', 'users');\">Users</a>\n";
	echo "&nbsp;&nbsp;\n";
	echo "<a id='nav_link_other' href=\"javascript:onclick=loadThePage('admin_content', 'otherAdmin');\">Other Tasks</a>\n";
	echo "&nbsp;&nbsp;\n";
	
	// <!-- <s>View Map</s>(not yet, reload map page to see changes) -->
	// <!-- <a href="javascript:onclick=loadThePage('admin_content', 'viewMap');">View Map</a> -->
	echo "</div> <!-- end admin_nav_links inner div -->\n";
	
	echo "<div id='admin_status'>\n";
	echo "<table id='admin_sql_status_table'>\n";
	echo "<thead>\n";
	echo "<tr>\n";
	echo "<th colspan='3' class='admin_sql_status_table_background'>\n";
	echo "<strong>SQL server </strong>\n";
	
	echo "&nbsp;( " . $USER_SETTINGS['sql_server'] . " ): \n";
	if($sqlSrvStatus == 1) {
	    echo '<img class="img-valign emDot75Text" src="../images/greenDot.png">' . "\n";
	}else {
	    echo '<img class="img-valign emDot75Text" src="../images/redDot.png">' . "\n";
	}
	
	echo "</th>";
	echo "<th class=\"admin_sql_status_table_background\"></th>\n";
	echo "<th class=\"admin_sql_status_table_background\"></th>\n";
	echo "<th style=\"text-align: right;\" colspan=\"3\" class=\"admin_sql_status_table_background\">\n";
	echo "Currently Polling Nodes: ";
	if($lastUpdateNodeInfo['currently_running'] == 1) {
	    echo '<img class="img-valign emDot75Text" src="../images/greenDot.png">' . "\n";
	}else {
	    echo '<img class="img-valign emDot75Text" src="../images/redDot.png">' . "\n";
	}
	echo "</tr>";
	echo "</thead>\n";
	echo "<tbody>";
	echo "<tr>\n";
	echo "<td class=\"admin_sql_status_table_background\">Nodes:</td>\n";
	echo "<td class=\"admin_sql_status_table_background\">$totalNumNodes</td>\n";
	echo "<td class=\"admin_sql_status_table_background\">With Locations:</td>\n";
	echo "<td class=\"admin_sql_status_table_background\">$totalNumNodesWithLocations</td>\n";
	echo "<td colspan=\"2\" class=\"admin_sql_status_table_background\">Nodes Last Polled:</td>\n";
	echo "<td class=\"admin_sql_status_table_background\">" . $lastUpdateNodeInfo['script_last_run'] . "\n";
	echo "<td class=\"admin_sql_status_table_background\"></td>\n";
	echo "</tr>";
	echo "<tr>";
	echo "<td class=\"admin_sql_status_table_background\">Links:</td>\n";
	echo "<td class=\"admin_sql_status_table_background\">$totalNumLinks</td>\n";
	echo "<td class=\"admin_sql_status_table_background\">With Locations:</td>\n";
	echo "<td class=\"admin_sql_status_table_background\">$totalNumLinksWithLocations</td>\n";
	echo "<td colspan=\"2\" class=\"admin_sql_status_table_background\">Links Last Updated:</td>\n";
	echo "<td class=\"admin_sql_status_table_background\">" . $lastUpdateLinkInfo['table_last_update'] . "\n";
	echo "<td class=\"admin_sql_status_table_background\">&nbsp;</td>\n";
	echo "</tr>\n";
	echo "<tr>\n";
	echo "<td class=\"admin_sql_status_table_background\">Expired:</td>\n";
	echo "<td style=\"text-align: left;\" class=\"admin_sql_status_table_background\">$totalRemovedNodes</td>\n";
	echo "<td style=\"text-align: right;\" class=\"admin_sql_status_table_background\">Ignored:</td>\n";
	echo "<td class=\"admin_sql_status_table_background\">$totalIgnoredNodes</td>\n";
	echo "<td class=\"admin_sql_status_table_background\">Non Mesh Icons:</td>\n";
	echo "<td class=\"admin_sql_status_table_background\">$totalNumNonMeshMarkers</td>\n";
	echo "<td colspan=\"2\" style=\"text-align: right;\" class=\"admin_sql_status_table_background\">Parallel Mode: ";
		if ($USER_SETTINGS['node_polling_parallel'] == "1") {
		    echo "Yes";
		}else {
		    echo "No";
		}
	echo "</td>\n";
	echo "</tr>\n";
	echo "</tbody>";
	echo "</table>\n";
	echo "</div> <!-- end admin_status inner div -->\n";
	
	echo "</div> <!-- end admin_header div -->\n";
	
	echo "<div id='admin_content'>\n";
	echo "<br>\n";
	echo "Please use the tabs/links above to navigate to the different sections.\n";
	echo "<br>\n";
	echo "<br>\n";
	echo "Most tables are sortable, just click on the header.\n";
	echo "<br>\n";
	echo "<br>\n";
	echo "Eventually, you should be able to have different users and actually have to login to use most of this.\n";
	echo "<br>\n";
	echo "<br>\n";
	echo "Have fun and let me know any issues or ideas you find.\n";
	echo "<br>\n";
	echo "(especially any \"metrics\" you can think of to watch in the status area)\n";
	echo "<br>\n";
	echo "-wxc\n";
	echo "</div>\n";
	
	echo "</div> <!-- wrapper close -->\n";
	echo "</body>\n";
	echo "</html>\n";
Eric - kg6wxc's avatar
Eric - kg6wxc committed
540
}
541
mysqli_close($sql_connection);
Eric - kg6wxc's avatar
Eric - kg6wxc committed
542
?>