-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
YazFi_www.js
1369 lines (1255 loc) · 63.9 KB
/
YazFi_www.js
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
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
383
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
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**----------------------------------------**/
/** Modified by Martinski W. [2023-Mar-24] **/
/**----------------------------------------**/
var clientswl01 = []; var sortnamewl01 = 'Hostname'; var sortdirwl01 = 'asc';
var clientswl02 = []; var sortnamewl02 = 'Hostname'; var sortdirwl02 = 'asc';
var clientdwl03 = []; var sortnamewl03 = 'Hostname'; var sortdirwl03 = 'asc';
var clientswl11 = []; var sortnamewl11 = 'Hostname'; var sortdirwl11 = 'asc';
var clientswl12 = []; var sortnamewl12 = 'Hostname'; var sortdirwl12 = 'asc';
var clientswl13 = []; var sortnamewl13 = 'Hostname'; var sortdirwl13 = 'asc';
var clientswl21 = []; var sortnamewl21 = 'Hostname'; var sortdirwl21 = 'asc';
var clientswl22 = []; var sortnamewl22 = 'Hostname'; var sortdirwl22 = 'asc';
var clientswl23 = []; var sortnamewl23 = 'Hostname'; var sortdirwl23 = 'asc';
var clientswl31 = []; var sortnamewl31 = 'Hostname'; var sortdirwl31 = 'asc';
var clientswl32 = []; var sortnamewl32 = 'Hostname'; var sortdirwl32 = 'asc';
var clientswl33 = []; var sortnamewl33 = 'Hostname'; var sortdirwl33 = 'asc';
var tout;
var numOfBands = 0;
var failedfields = [];
/**----------------------------------------------**/
/** Added/modified by Martinski W. [2023-Jan-29] **/
/**----------------------------------------------**/
/** The DHCP Lease Time values can be given in: **/
/** seconds, minutes, hours, days, or weeks. **/
/** Single '0' or 'I' indicates "infinite" value.**/
/**----------------------------------------------**/
const theDHCPLeaseTime=
{
uiLabel: 'DHCP Lease',
varType: 'dhcpLEASE',
varName: 'dhcplease',
minVal: 120, minStr: '2 minutes',
maxVal: 7776000, maxStr: '90 days',
infiniteTag: 'I',
errorMsg: function()
{
return (`Value is not between ${this.minVal} and ${this.maxVal} seconds (${this.minStr} to ${this.maxStr}).`);
},
hintMsg: function()
{
return (`DHCP Lease Time in seconds: ${this.minVal} (${this.minStr}) to ${this.maxVal} (${this.maxStr}). A single '0' or 'I' indicates an "infinite" lease time.`);
},
ValidateLeaseValue: function(theValue)
{
let timeUnits, timeFactor, timeNumber, timeValue;
const valueFormat0 = /^0+/;
const valueFormat1 = /^[0-9]{1,7}$/;
const valueFormat2 = /^[0-9]{1,6}[smhdw]{1}$/;
if (theValue == '0' || theValue == this.infiniteTag)
{ return true ; } //'I' or '0' for "infinite"//
if (valueFormat0.test(theValue))
{ return false; }
if (valueFormat1.test(theValue))
{
timeUnits = 's';
timeNumber = theValue;
}
else if (valueFormat2.test(theValue))
{
let valLen = theValue.length;
timeUnits = theValue.substring ((valLen - 1), valLen);
timeNumber = theValue.substring (0, (valLen - 1));
}
else { return false; }
switch (timeUnits)
{
case 's': timeFactor=1; break;
case 'm': timeFactor=60; break;
case 'h': timeFactor=3600; break;
case 'd': timeFactor=86400; break;
case 'w': timeFactor=604800; break;
}
if (!valueFormat1.test(timeNumber)) { return false; }
timeValue=(timeNumber * timeFactor);
if (timeValue < this.minVal || timeValue > this.maxVal)
{ return false; }
else
{ return true; }
},
ValidateLeaseInput: function(formField, event)
{
const theValue = formField.value;
const valueFormat = /^[0-9]{1,6}$/;
const keyPressed = (event.keyCode ? event.keyCode : event.which);
if (validator.isFunctionButton(event)) { return true; }
if (theValue == this.infiniteTag) { return false; }
if (keyPressed == 73 && theValue.length == 0) { return true; }
if (keyPressed > 47 && keyPressed < 58 &&
(theValue.length == 0 || theValue.charAt(0) != '0' || keyPressed != 48))
{ return true; }
if (theValue.length > 0 && theValue.charAt(0) != '0' && valueFormat.test(theValue) &&
(keyPressed == 115 || keyPressed == 109 || keyPressed == 104 || keyPressed == 100 || keyPressed == 119))
{ return true; }
if (event.metaKey &&
(keyPressed == 65 || keyPressed == 67 || keyPressed == 86 || keyPressed == 88 ||
keyPressed == 97 || keyPressed == 99 || keyPressed == 118 || keyPressed == 120))
{ return true; }
else
{ return false; }
}
};
const theDHCPStart=
{
uiLabel: 'DHCP Start',
varType: 'dhcpSTART',
varName: 'dhcpstart',
minVal: 2, maxVal: 253,
errorMsg1: 'DHCP Start is greater than or equal to DHCP End',
errorMsg2: function()
{ return (`Value is not between ${this.minVal} and ${this.maxVal}`); },
hintMsg: function()
{ return (`Start of DHCP pool (${this.minVal}-${this.maxVal})`); }
};
const theDHCPEnd=
{
uiLabel: 'DHCP End',
varType: 'dhcpEND',
varName: 'dhcpend',
minVal: 3, maxVal: 254,
errorMsg1: 'DHCP End is less than or equal to DHCP Start',
errorMsg2: function()
{ return (`Value is not between ${this.minVal} and ${this.maxVal}`); },
hintMsg: function()
{ return (`End of DHCP pool (${this.minVal}-${this.maxVal})`); }
};
/**-------------------------------------**/
/** Added by Martinski W. [2022-Dec-23] **/
/**-------------------------------------**/
const listOfGUIFieldNames=
[ 'enabled', 'ipaddr', theDHCPStart.varName, theDHCPEnd.varName, theDHCPLeaseTime.varName, 'dns1', 'dns2', 'vpnclientnumber', 'allowinternet', 'forcedns', 'redirectalltovpn', 'onewaytoguest', 'twowaytoguest', 'clientisolation' ];
const band_24GHz='24G';
const band_5GHz_1='5G_1';
const band_5GHz_2='5G_2';
const band_6GHz_1='6G_1';
const theGuestNet=
{
numOfGNsPerBand: 3,
listOfBandIFtags:
[
['wl01', 'wl02', 'wl03'],
['wl11', 'wl12', 'wl13'],
['wl21', 'wl22', 'wl23'],
['wl31', 'wl32', 'wl33']
],
wifiBands:
[
{
uiLabel: '2.4GHz',
bandType: band_24GHz,
ifPrefix: function()
{
if (productid == 'GT-AXE16000')
return ('wl3');
else
return ('wl0');
},
supported: function()
{
if (typeof wl_info == 'undefined' || wl_info == null)
return (true);
else
return (wl_info.band2g_support);
}
},
{
uiLabel: '5GHz',
bandType: band_5GHz_1,
ifPrefix: function()
{
if (productid == 'GT-AXE16000')
return ('wl0');
else
return ('wl1');
},
supported: function()
{
if (typeof wl_info == 'undefined' || wl_info == null)
return (true);
else
return (wl_info.band5g_support);
}
},
{
uiLabel: '5GHz-2',
bandType: band_5GHz_2,
ifPrefix: function()
{
if (productid == 'GT-AXE16000')
return ('wl1');
else if (wl_info.band5g_2_support)
return ('wl2');
else
return (null);
},
supported: function()
{ return (wl_info.band5g_2_support); }
},
{
uiLabel: '6GHz',
bandType: band_6GHz_1,
ifPrefix: function()
{
if (productid == 'GT-AXE16000' || wl_info.band6g_support)
return ('wl2');
else
return (null);
},
supported: function()
{ return (wl_info.band6g_support); }
}
],
IFacePrefix: function(theBandType)
{
let theIFprefix='';
for (var cnt=0; cnt < this.wifiBands.length; cnt++)
{
if (this.wifiBands[cnt].supported() &&
theBandType == this.wifiBands[cnt].bandType)
{ theIFprefix=this.wifiBands[cnt].ifPrefix(); break; }
}
return (theIFprefix);
},
IFaceUILabel: function(theBandType)
{
let theUILabel='';
for (var cnt=0; cnt < this.wifiBands.length; cnt++)
{
if (this.wifiBands[cnt].supported() &&
theBandType == this.wifiBands[cnt].bandType)
{ theUILabel=this.wifiBands[cnt].uiLabel; break; }
}
return (theUILabel);
},
UILabelFromPrefix: function(theIFnamePrefix)
{
let theUILabel='';
for (var cnt=0; cnt < this.wifiBands.length; cnt++)
{
if (this.wifiBands[cnt].supported() &&
theIFnamePrefix == this.wifiBands[cnt].ifPrefix())
{ theUILabel=this.wifiBands[cnt].uiLabel; break; }
}
return (theUILabel);
}
};
var $j = jQuery.noConflict();
/**-------------------------------------**/
/** Added by Martinski W. [2023-Jan-29] **/
/**-------------------------------------**/
function AddFailedField (formInput, errorMsg)
{
let failedFieldFound=false;
for (var cnt = 0; cnt < failedfields.length; cnt++)
{
if (failedfields[cnt][1] == errorMsg &&
failedfields[cnt][0].attr('name') == formInput.name)
{ failedFieldFound=true; break; }
}
if (failedFieldFound) { return false; }
failedfields.push ([$j(formInput), errorMsg]);
return true;
}
function initial(){
SetCurrentPage();
LoadCustomSettings();
show_menu();
get_conf_file();
ScriptUpdateLayout();
document.formScriptActions.action_script.value='start_YazFiconnectedclients';
document.formScriptActions.submit();
tout = setTimeout(get_connected_clients_file,5000);
}
/**----------------------------------------**/
/** Modified by Martinski W. [2022-Dec-05] **/
/**----------------------------------------**/
function YazHint(hintid){
var tag_name= document.getElementsByTagName('a');
for(var i=0;i<tag_name.length;i++){
tag_name[i].onmouseout=nd;
}
hinttext='My text goes here';
if(hintid == 1) hinttext='Enable YazFi for this Guest Network';
if(hintid == 2) hinttext='IP address/subnet to use for Guest Network';
if(hintid == 3) hinttext=theDHCPStart.hintMsg();
if(hintid == 4) hinttext=theDHCPEnd.hintMsg();
if(hintid == 5) hinttext=theDHCPLeaseTime.hintMsg();
if(hintid == 6) hinttext='IP address for primary DNS resolver';
if(hintid == 7) hinttext='IP address for secondary DNS resolver';
if(hintid == 8) hinttext='Should Guest Network DNS requests be forced/redirected to DNS1? N.B. This setting is ignored if sending to VPN, and VPN Client\'s DNS configuration is Exclusive';
if(hintid == 9) hinttext='Should Guest Network be allowed to access the internet?';
if(hintid == 10) hinttext='Should Guest Network traffic be sent via VPN?';
if(hintid == 11) hinttext='The number of the VPN Client to send traffic through (1-5)';
if(hintid == 12) hinttext='Should LAN/Guest Network traffic have unrestricted access to each other? Cannot be enabled if _ONEWAYTOGUEST is enabled';
if(hintid == 13) hinttext='Should LAN be able to initiate connections to Guest Network clients (but not the opposite)? Cannot be enabled if _TWOWAYTOGUEST is enabled';
if(hintid == 14) hinttext='Should Guest Network radio prevent clients from talking to each other?';
return overlib(hinttext,0,0);
}
/**----------------------------------------**/
/** Modified by Martinski W. [2022-Dec-05] **/
/**----------------------------------------**/
function OptionsEnableDisable(forminput){
var inputname = forminput.name;
var inputvalue = forminput.value;
var prefix = inputname.substring(0,inputname.lastIndexOf('_'));
var fieldnames = ['ipaddr',theDHCPStart.varName,theDHCPEnd.varName,theDHCPLeaseTime.varName,'dns1','dns2','vpnclientnumber'];
var fieldnames2 = ['allowinternet','forcedns','redirectalltovpn','onewaytoguest','twowaytoguest','clientisolation'];
if(inputvalue == 'false'){
for(var index = 0; index < fieldnames.length; index++){
$j('input[name='+prefix+'_'+fieldnames[index]+']').addClass('disabled');
$j('input[name='+prefix+'_'+fieldnames[index]+']').prop('disabled',true);
}
for(var index = 0; index < fieldnames2.length; index++){
$j('input[name='+prefix+'_'+fieldnames2[index]+']').prop('disabled',true);
}
}
else if(inputvalue == 'true'){
for(var index = 0; index < fieldnames.length; index++){
if(fieldnames2[index] == 'dns2' || fieldnames2[index] == 'vpnclientnumber'){continue;}
$j('input[name='+prefix+'_'+fieldnames[index]+']').removeClass('disabled');
$j('input[name='+prefix+'_'+fieldnames[index]+']').prop('disabled',false);
}
for(var index = 0; index < fieldnames2.length; index++){
$j('input[name='+prefix+'_'+fieldnames2[index]+']').prop('disabled',false);
}
if(eval('document.form.'+prefix+'_redirectalltovpn').value == 'true'){
$j('input[name='+prefix+'_vpnclientnumber]').removeClass('disabled');
$j('input[name='+prefix+'_vpnclientnumber]').prop('disabled',false);
}
if(eval('document.form.'+prefix+'_forcedns').value == 'false'){
$j('input[name='+prefix+'_dns2]').removeClass('disabled');
$j('input[name='+prefix+'_dns2]').prop('disabled',false);
}
if(eval('document.form.'+prefix+'_allowinternet').value == 'false'){
$j('input[name='+prefix+'_redirectalltovpn]').addClass('disabled');
$j('input[name='+prefix+'_redirectalltovpn]').prop('disabled',true);
$j('input[name='+prefix+'_vpnclientnumber]').addClass('disabled');
$j('input[name='+prefix+'_vpnclientnumber]').prop('disabled',true);
Validate_IP(eval('document.form.'+prefix+'_dns1'),'DNS');
Validate_IP(eval('document.form.'+prefix+'_dns2'),'DNS');
}
}
}
function SubOptionsEnableDisable(forminput,optiontype){
var inputname = forminput.name;
var inputvalue = forminput.value;
var prefix = inputname.substring(0,inputname.lastIndexOf('_'));
if(eval('document.form.'+prefix+'_enabled').value == 'true'){
if(inputvalue == 'false'){
if(optiontype == 'vpn'){
$j('input[name='+prefix+'_vpnclientnumber]').addClass('disabled');
$j('input[name='+prefix+'_vpnclientnumber]').prop('disabled',true);
}
else if(optiontype == 'dns'){
$j('input[name='+prefix+'_dns2]').removeClass('disabled');
$j('input[name='+prefix+'_dns2]').prop('disabled',false);
}
else if(optiontype == 'allowinternet'){
$j('input[name='+prefix+'_redirectalltovpn]').addClass('disabled');
$j('input[name='+prefix+'_redirectalltovpn]').prop('disabled',true);
$j('input[name='+prefix+'_vpnclientnumber]').addClass('disabled');
$j('input[name='+prefix+'_vpnclientnumber]').prop('disabled',true);
Validate_IP(eval('document.form.'+prefix+'_dns1'),'DNS');
Validate_IP(eval('document.form.'+prefix+'_dns2'),'DNS');
}
}
else if(inputvalue == 'true'){
if(optiontype == 'vpn'){
$j('input[name='+prefix+'_vpnclientnumber]').removeClass('disabled');
$j('input[name='+prefix+'_vpnclientnumber]').prop('disabled',false);
}
else if(optiontype == 'dns'){
$j('input[name='+prefix+'_dns2]').val($j('input[name='+prefix+'_dns1]').val());
$j('input[name='+prefix+'_dns2]').addClass('disabled');
$j('input[name='+prefix+'_dns2]').prop('disabled',true);
}
else if(optiontype == 'allowinternet'){
$j('input[name='+prefix+'_redirectalltovpn]').removeClass('disabled');
$j('input[name='+prefix+'_redirectalltovpn]').prop('disabled',false);
$j('input[name='+prefix+'_vpnclientnumber]').removeClass('disabled');
$j('input[name='+prefix+'_vpnclientnumber]').prop('disabled',false);
Validate_IP(eval('document.form.'+prefix+'_dns1'),'DNS');
Validate_IP(eval('document.form.'+prefix+'_dns2'),'DNS');
}
}
}
}
/**----------------------------------------**/
/** Modified by Martinski W. [2023-Jan-29] **/
/**----------------------------------------**/
function Validate_IP(forminput,iptype){
var inputvalue = forminput.value;
var inputname = forminput.name;
let errorMsg;
var prefix = inputname.substring(0,inputname.lastIndexOf('_'));
if(iptype == 'DNS'){
if(inputvalue.substring(inputvalue.lastIndexOf('.')) == '.0'){
forminput.value = inputvalue.substring(0,inputvalue.lastIndexOf('.'))+'.1';
}
}
if(/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(inputvalue)){
if(iptype != 'DNS'){
var fixedip = inputvalue.substring(0,inputvalue.lastIndexOf('.'))+'.0';
$j(forminput).val(fixedip);
if (/(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^192\.168\.)/.test(fixedip)){
if(! jy_checkIPConflict('LAN',fixedip,'255.255.255.0',document.form.lan_ipaddr.value,document.form.lan_netmask.value).state){
matchfound=false;
for(var i = 0; i < numOfBands; i++){
for(var i2 = 1; i2 <= theGuestNet.numOfGNsPerBand; i2++){
if('yazfi_wl'+i.toString()+i2.toString()+'_ipaddr' != inputname){
if(eval('document.form.yazfi_wl'+i.toString()+i2.toString()+'_ipaddr.value') == fixedip){
matchfound=true;
}
}
}
}
if(matchfound){
errorMsg='Conflict with another YazFi network';
$j(forminput).addClass('invalid');
if (AddFailedField (forminput, errorMsg)) { forminput.focus(); }
$j(forminput).on('mouseover',function(){return overlib(errorMsg,0,0);});
$j(forminput)[0].onmouseout = nd;
return false;
}
else{
$j(forminput).removeClass('invalid');
$j(forminput).off('mouseover');
return true;
}
}
else{
errorMsg='LAN IP conflict';
$j(forminput).addClass('invalid');
if (AddFailedField (forminput, errorMsg)) { forminput.focus(); }
$j(forminput).on('mouseover',function(){return overlib(errorMsg,0,0);});
$j(forminput)[0].onmouseout = nd;
return false;
}
}
else{
errorMsg='Not a private IP address';
$j(forminput).addClass('invalid');
if (AddFailedField (forminput, errorMsg)) { forminput.focus(); }
$j(forminput).on('mouseover',function(){return overlib(errorMsg,0,0);});
$j(forminput)[0].onmouseout = nd;
return false;
}
}
else if (iptype == 'DNS' && ! /(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^192\.168\.)/.test(inputvalue) && eval('document.form.'+prefix+'_allowinternet.value') == 'false'){
errorMsg='Allow internet disabled and non-private IP address used';
$j(forminput).addClass('invalid');
if (AddFailedField (forminput, errorMsg)) { forminput.focus(); }
$j(forminput).on('mouseover',function(){return overlib(errorMsg,0,0);});
$j(forminput)[0].onmouseout = nd;
return false;
}
else{
$j(forminput).removeClass('invalid');
$j(forminput).off('mouseover');
return true;
}
}
else{
errorMsg='Invalid IP Address';
$j(forminput).addClass('invalid');
if (AddFailedField (forminput, errorMsg)) { forminput.focus(); }
$j(forminput).on('mouseover',function(){return overlib(errorMsg,0,0);});
$j(forminput)[0].onmouseout = nd;
return false;
}
}
/**----------------------------------------**/
/** Modified by Martinski W. [2023-Jan-29] **/
/**----------------------------------------**/
function Validate_DHCP(forminput,dhcpType){
var inputname = forminput.name;
var inputvalue = forminput.value*1;
if(dhcpType == theDHCPStart.varType){
if(inputvalue >= eval('document.form.'+inputname.substring(0,inputname.indexOf('start'))+'end.value')*1){
$j(forminput).addClass('invalid');
if (AddFailedField (forminput, theDHCPStart.errorMsg1)) { forminput.focus(); }
$j(forminput).on('mouseover',function(){return overlib(theDHCPStart.errorMsg1,0,0);});
$j(forminput)[0].onmouseout = nd;
return false;
}
else{
if(inputvalue > theDHCPStart.maxVal || inputvalue < theDHCPStart.minVal){
$j(forminput).addClass('invalid');
if (AddFailedField (forminput, theDHCPStart.errorMsg2())) { forminput.focus(); }
$j(forminput).on('mouseover',function(){return overlib(theDHCPStart.errorMsg2(),0,0);});
$j(forminput)[0].onmouseout = nd;
return false;
}
else{
$j(forminput).removeClass('invalid');
$j(forminput).off('mouseover');
return true;
}
}
}
else if(dhcpType == theDHCPEnd.varType){
if(inputvalue <= eval('document.form.'+inputname.substring(0,inputname.indexOf('end'))+'start.value')*1){
$j(forminput).addClass('invalid');
if (AddFailedField (forminput, theDHCPEnd.errorMsg1)) { forminput.focus(); }
$j(forminput).on('mouseover',function(){return overlib(theDHCPEnd.errorMsg1,0,0);});
$j(forminput)[0].onmouseout = nd;
return false;
}
else{
if(inputvalue > theDHCPEnd.maxVal || inputvalue < theDHCPEnd.minVal){
$j(forminput).addClass('invalid');
if (AddFailedField (forminput, theDHCPEnd.errorMsg2())) { forminput.focus(); }
$j(forminput).on('mouseover',function(){return overlib(theDHCPEnd.errorMsg2(),0,0);});
$j(forminput)[0].onmouseout = nd;
return false;
}
else{
$j(forminput).removeClass('invalid');
$j(forminput).off('mouseover');
return true;
}
}
}
else if(dhcpType == theDHCPLeaseTime.varType){
if (!theDHCPLeaseTime.ValidateLeaseValue (forminput.value)){
$j(forminput).addClass('invalid');
if (AddFailedField (forminput, theDHCPLeaseTime.errorMsg())) { forminput.focus(); }
$j(forminput).on('mouseover',function(){return overlib(theDHCPLeaseTime.errorMsg(),0,0);});
$j(forminput)[0].onmouseout = nd;
return false;
}
else{
$j(forminput).removeClass('invalid');
$j(forminput).off('mouseover');
return true;
}
}
}
/**----------------------------------------**/
/** Modified by Martinski W. [2023-Jan-29] **/
/**----------------------------------------**/
function Validate_VPNClientNo(forminput){
var inputname = forminput.name;
var inputvalue = forminput.value*1;
const errorMsg='Value not between 1 and 5';
if(inputvalue > 5 || inputvalue < 1){
$j(forminput).addClass('invalid');
if (AddFailedField (forminput, errorMsg)) { forminput.focus(); }
$j(forminput).on('mouseover',function(){return overlib(errorMsg,0,0);});
$j(forminput)[0].onmouseout = nd;
return false;
}
else{
$j(forminput).removeClass('invalid');
$j(forminput).off('mouseover');
return true;
}
}
function Validate_OneTwoWay(forminput){
var onetwo = '';
var inputname = forminput.name;
var inputvalue = forminput.value;
(inputname.indexOf('oneway') != -1) ? onetwo = 'one' : onetwo = 'two';
if(onetwo == 'one'){
if(inputvalue == 'true'){
eval('document.form.'+inputname.substring(0,inputname.indexOf('one'))+'twowaytoguest.value=false');
}
}
else{
if(inputvalue == 'true'){
eval('document.form.'+inputname.substring(0,inputname.indexOf('two'))+'onewaytoguest.value=false');
}
}
}
/**----------------------------------------**/
/** Modified by Martinski W. [2022-Mar-24] **/
/**----------------------------------------**/
function Validate_All(){
var validationfailed = false, thePrefix='';
failedfields = [];
for(var i=0; i < numOfBands; i++){
for(var i2=1; i2 <= theGuestNet.numOfGNsPerBand; i2++)
{
thePrefix='yazfi_wl'+i+i2;
if (eval('document.form.'+thePrefix+'_enabled').value == 'false') {continue;}
if(! Validate_IP(eval('document.form.'+thePrefix+'_ipaddr'),'IP')){validationfailed=true;}
if(! Validate_DHCP(eval('document.form.'+thePrefix+'_'+theDHCPStart.varName),theDHCPStart.varType)){validationfailed=true;}
if(! Validate_DHCP(eval('document.form.'+thePrefix+'_'+theDHCPEnd.varName),theDHCPEnd.varType)){validationfailed=true;}
if(! Validate_DHCP(eval('document.form.'+thePrefix+'_'+theDHCPLeaseTime.varName),theDHCPLeaseTime.varType)){validationfailed=true;}
if(! Validate_IP(eval('document.form.'+thePrefix+'_dns1'),'DNS')){validationfailed=true;}
if(! Validate_IP(eval('document.form.'+thePrefix+'_dns2'),'DNS')){validationfailed=true;}
if(! Validate_VPNClientNo(eval('document.form.'+thePrefix+'_vpnclientnumber'))){validationfailed=true;}
}
}
var failedfieldsstring = '';
for(var i=0; i < failedfields.length; i++)
{
var guestnework = '';
var prefix = failedfields[i][0].attr('name').split('_')[1];
let theIFprefix=prefix.substring(0,3);
let theIFnumber=prefix.substring(3,4);
guestnetwork = theGuestNet.UILabelFromPrefix(theIFprefix)+' Guest Network '+theIFnumber;
failedfieldsstring += guestnetwork+' - '+failedfields[i][0].parent().parent().children().children()[0].innerHTML+' - '+failedfields[i][1]+'\n';
}
if(validationfailed){
alert('Validation for some fields failed, shown below. Please correct invalid values and try again.\n'+failedfieldsstring);
return false;
}
else{
return true;
}
}
/**----------------------------------------**/
/** Modified by Martinski W. [2022-Dec-23] **/
/**----------------------------------------**/
function get_conf_file(){
$j.ajax({
url: '/ext/YazFi/config.htm',
dataType: 'text',
error: function(xhr){
setTimeout(get_conf_file,1000);
},
success: function(data){
var settings = data.split('\n');
settings.reverse();
settings = settings.filter(Boolean);
let linesCount=settings.length;
let settingsCount=0;
let ifaceVarPrefix, ifacePrefix;
let showIFprefix, theIFprefixTag;
let ifaceUILabel, guestNetUILabel;
window['yazfi_settings'] = [];
for(var i = 0; i < linesCount; i++)
{
ifaceVarPrefix=settings[i].match(/^wl[0-3][1-3]_/);
var commentstart = settings[i].indexOf('#');
if (commentstart != -1 || ifaceVarPrefix == null) {continue;}
settingsCount+=1;
var setting=settings[i].split('=');
window['yazfi_settings'].unshift(setting);
}
if(typeof wl_info == 'undefined' || wl_info == null)
{
numOfBands = 2;
ifacePrefix=theGuestNet.IFacePrefix (band_24GHz);
ifaceUILabel=theGuestNet.IFaceUILabel (band_24GHz);
guestNetUILabel=`${ifaceUILabel} Guest Networks`;
$j('#table_config').append(BuildConfigTable(ifacePrefix, guestNetUILabel));
$j('#table_config').append('<tr><td style="padding:0px;height:10px;"></td></tr>');
ifacePrefix=theGuestNet.IFacePrefix (band_5GHz_1);
ifaceUILabel=theGuestNet.IFaceUILabel (band_5GHz_1);
guestNetUILabel=`${ifaceUILabel} Guest Networks`;
$j('#table_config').append(BuildConfigTable(ifacePrefix, guestNetUILabel));
}
else
{
showIFprefix=wl_info.band6g_support;
if(wl_info.band2g_support)
{
theIFprefixTag='';
ifacePrefix=theGuestNet.IFacePrefix (band_24GHz);
ifaceUILabel=theGuestNet.IFaceUILabel (band_24GHz);
if (showIFprefix) theIFprefixTag=` [${ifacePrefix}]`;
guestNetUILabel=`${ifaceUILabel}${theIFprefixTag} Guest Networks`;
$j('#table_config').append(BuildConfigTable(ifacePrefix, guestNetUILabel));
numOfBands = numOfBands+1;
}
if(wl_info.band5g_support)
{
theIFprefixTag='';
ifacePrefix=theGuestNet.IFacePrefix (band_5GHz_1);
ifaceUILabel=theGuestNet.IFaceUILabel (band_5GHz_1);
if (showIFprefix) theIFprefixTag=` [${ifacePrefix}]`;
guestNetUILabel=`${ifaceUILabel}${theIFprefixTag} Guest Networks`;
$j('#table_config').append('<tr><td style="padding:0px;height:10px;"></td></tr>');
$j('#table_config').append(BuildConfigTable(ifacePrefix, guestNetUILabel));
numOfBands = numOfBands+1;
}
if(wl_info.band5g_2_support)
{
theIFprefixTag='';
ifacePrefix=theGuestNet.IFacePrefix (band_5GHz_2);
ifaceUILabel=theGuestNet.IFaceUILabel (band_5GHz_2);
if (showIFprefix) theIFprefixTag=` [${ifacePrefix}]`;
guestNetUILabel=`${ifaceUILabel}${theIFprefixTag} Guest Networks`;
$j('#table_config').append('<tr><td style="padding:0px;height:10px;"></td></tr>');
$j('#table_config').append(BuildConfigTable(ifacePrefix, guestNetUILabel));
numOfBands = numOfBands+1;
}
if(wl_info.band6g_support)
{
theIFprefixTag='';
ifacePrefix=theGuestNet.IFacePrefix (band_6GHz_1);
ifaceUILabel=theGuestNet.IFaceUILabel (band_6GHz_1);
if (showIFprefix) theIFprefixTag=` [${ifacePrefix}]`;
guestNetUILabel=`${ifaceUILabel}${theIFprefixTag} Guest Networks`;
$j('#table_config').append('<tr><td style="padding:0px;height:10px;"></td></tr>');
$j('#table_config').append(BuildConfigTable(ifacePrefix, guestNetUILabel));
numOfBands = numOfBands+1;
}
}
$j('#table_config').append('<tr class="apply_gen" valign="top"><td style="background-color:rgb(77,89,93);border-top:0px;border-bottom:0px;height:5px;"></td></tr>');
var buttonshtml = '<tr class="apply_gen" valign="top" height="35px"><td style="background-color:rgb(77,89,93);border-top:0px;">';
buttonshtml += '<input name="button" type="button" class="button_gen" onclick="SaveConfig();" value="Apply"/></td></tr>';
$j('#table_config').append(buttonshtml);
for(var i = 0; i < settingsCount; i++)
{
var settingname = window['yazfi_settings'][i][0].toLowerCase();
var settingvalue = window['yazfi_settings'][i][1];
let varNameTags=settingname.split('_');
let supportedBand=false;
let supportedField=listOfGUIFieldNames.includes(varNameTags[1]);
for(var cnt = 0; cnt < numOfBands; cnt++)
{
if (theGuestNet.listOfBandIFtags[cnt].includes(varNameTags[0]))
{ supportedBand=true; break; }
}
if (!supportedBand || !supportedField) {continue;}
eval('document.form.yazfi_'+settingname).value = settingvalue;
if(settingname.indexOf('forcedns') != -1) SubOptionsEnableDisable($j('#yazfi_'+settingname.replace('_forcedns','')+'_fdns_'+settingvalue)[0],'dns');
if(settingname.indexOf('redirectalltovpn') != -1) SubOptionsEnableDisable($j('#yazfi_'+settingname.replace('_redirectalltovpn','')+'_redir_'+settingvalue)[0],'vpn');
if(settingname.indexOf('allowinternet') != -1) SubOptionsEnableDisable($j('#yazfi_'+settingname.replace('_allowinternet','')+'_allowinet_'+settingvalue)[0],'allowinternet');
if(settingname.indexOf('enabled') != -1) OptionsEnableDisable($j('#yazfi_'+settingname.replace('_enabled','')+'_en_'+settingvalue)[0]);
}
if($j('#firmver').text()*1 < 386.1){
if(productid == 'RT-AX88U' || productid == 'RT-AX3000'){
$j('input[name*=clientisolation][value=false]').prop('checked',true);
$j('input[name*=clientisolation]').attr('disabled',true);
}
}
for(var i = 0; i < numOfBands; i++){
for(var i2 = 1; i2 <= theGuestNet.numOfGNsPerBand; i2++){
if(eval('document.form.wl'+i+i2+'_bss_enabled').value == 0){
OptionsEnableDisable($j('#yazfi_wl'+i+i2+'_en_false')[0]);
$j('input[name=yazfi_wl'+i+i2+'_enabled]').prop('disabled',true);
}
}
}
}
});
}
/**----------------------------------------**/
/** Modified by Martinski W. [2022-Dec-23] **/
/**----------------------------------------**/
function get_connected_clients_file(){
d3.csv('/ext/YazFi/connectedclients.htm').then(function(data){
if(data.length > 0){
var unique = [];
var YazFiInterfaces = [];
for(var i = 0; i < data.length; i++){
if(!unique[data[i].INTERFACE]){
YazFiInterfaces.push(data[i].INTERFACE.replace('.',''));
unique[data[i].INTERFACE] = 1;
}
}
$j('#table_connectedclients').empty();
for(var i = 0; i < numOfBands; i++){
for(var i2 = 1; i2 <= theGuestNet.numOfGNsPerBand; i2++){
YazFiInterface = 'wl'+i.toString()+i2.toString();
window['clients'+YazFiInterface] = data.filter(function(item){
return item.INTERFACE.replace('.','') == YazFiInterface;
}).map(function(obj){
return {
Hostname: obj.HOSTNAME,
IPAddress: obj.IP,
MACAddress: obj.MAC,
Connected: obj.CONNECTED,
Rx: obj.RX,
Tx: obj.TX,
RSSI: obj.RSSI,
PHY: obj.PHY
}
});
if(eval('document.form.yazfi_'+YazFiInterface+'_enabled.value') == "true" && eval('document.form.'+YazFiInterface+'_bss_enabled.value') == 1){
$j('#table_connectedclients').append(BuildConnectedClientPlaceholderTable(YazFiInterface,eval('document.form.'+YazFiInterface+'_ssid.value')));
if(window['clients'+YazFiInterface].length > 0 && window['clients'+YazFiInterface][0].IPAddress != 'NOCLIENTS'){
SortTable('sortTable'+YazFiInterface,'clients'+YazFiInterface,eval('sortname'+YazFiInterface)+' '+eval('sortdir'+YazFiInterface).replace('desc','↑').replace('asc','↓').trim(),'sortname'+YazFiInterface,'sortdir'+YazFiInterface);
}
else{
$j('#sortTable'+YazFiInterface).css('height','30px');
$j('#sortTable'+YazFiInterface).css('overflow-y','hidden');
$j('#sortTable'+YazFiInterface).append(BuildConnectedClientsTableNoData('sortTable'+YazFiInterface));
}
}
}
}
}
if(document.getElementById('auto_refresh').checked){
document.formScriptActions.action_script.value='start_YazFiconnectedclients';
document.formScriptActions.submit();
tout = setTimeout(get_connected_clients_file,5000);
}
AddEventHandlers();
}).catch(function(){tout = setTimeout(get_connected_clients_file,1000);});
}
function SortTable(tableid,arrayid,sorttext,sortname,sortdir){
window[sortname] = sorttext.replace('↑','').replace('↓','').trim();
var sorttype = 'string';
var sortfield = window[sortname];
switch(window[sortname]){
case 'Connected':
sorttype = 'time';
break
case 'Rx':
case 'Tx':
case 'RSSI':
sorttype = 'number';
break
}
if(sorttype == 'string'){
if(sorttext.indexOf('↓') == -1 && sorttext.indexOf('↑') == -1){
eval(arrayid+' = '+arrayid+'.sort((a,b) => (a.'+sortfield+'.toLowerCase() > b.'+sortfield+'.toLowerCase()) ? 1 : ((b.'+sortfield+'.toLowerCase() > a.'+sortfield+'.toLowerCase()) ? -1 : 0));');
window[sortdir] = 'asc';
}
else if(sorttext.indexOf('↓') != -1){
eval(arrayid+' = '+arrayid+'.sort((a,b) => (a.'+sortfield+'.toLowerCase() > b.'+sortfield+'.toLowerCase()) ? 1 : ((b.'+sortfield+'.toLowerCase() > a.'+sortfield+'.toLowerCase()) ? -1 : 0));');
window[sortdir] = 'asc';
}
else{
eval(arrayid+' = '+arrayid+'.sort((a,b) => (a.'+sortfield+'.toLowerCase() < b.'+sortfield+'.toLowerCase()) ? 1 : ((b.'+sortfield+'.toLowerCase() < a.'+sortfield+'.toLowerCase()) ? -1 : 0));');
window[sortdir] = 'desc';
}
}
else if(sorttype == 'number'){
if(sorttext.indexOf('↓') == -1 && sorttext.indexOf('↑') == -1){
eval(arrayid+' = '+arrayid+'.sort((a,b) => parseFloat(a.'+sortfield+'.replace("m","000")) - parseFloat(b.'+sortfield+'.replace("m","000")));');
window[sortdir] = 'asc';
}
else if(sorttext.indexOf('↓') != -1){
eval(arrayid+' = '+arrayid+'.sort((a,b) => parseFloat(a.'+sortfield+'.replace("m","000")) - parseFloat(b.'+sortfield+'.replace("m","000")));');
window[sortdir] = 'asc';
}
else{
eval(arrayid+' = '+arrayid+'.sort((a,b) => parseFloat(b.'+sortfield+'.replace("m","000")) - parseFloat(a.'+sortfield+'.replace("m","000")));');
window[sortdir] = 'desc';
}
}
else if(sorttype == 'time'){
if(sorttext.indexOf('↓') == -1 && sorttext.indexOf('↑') == -1){
eval(arrayid+' = '+arrayid+'.sort((a,b) => parseFloat(HHMMSStoS(a.'+sortfield+'.replace("m","000"))) - parseFloat(HHMMSStoS(b.'+sortfield+'.replace("m","000"))));');
window[sortdir] = 'asc';
}
else if(sorttext.indexOf('↓') != -1){
eval(arrayid+' = '+arrayid+'.sort((a,b) => parseFloat(HHMMSStoS(a.'+sortfield+'.replace("m","000"))) - parseFloat(HHMMSStoS(b.'+sortfield+'.replace("m","000"))));');
window[sortdir] = 'asc';
}
else{
eval(arrayid+' = '+arrayid+'.sort((a,b) => parseFloat(HHMMSStoS(b.'+sortfield+'.replace("m","000"))) - parseFloat(HHMMSStoS(a.'+sortfield+'.replace("m","000"))));');
window[sortdir] = 'desc';
}
}
$j('#'+tableid).empty();
$j('#'+tableid).append(BuildConnectedClientsTable(tableid.replace('sortTable','')));
$j('#'+tableid).find('.sortable').each(function(index,element){
if(element.innerHTML.replace(/ \(.*\)/,'').replace(' ','') == window[sortname]){
if(window[sortdir] == 'asc'){
element.innerHTML = element.innerHTML+' ↑';
}
else{
element.innerHTML = element.innerHTML+' ↓';
}
}
});
}
function BuildConnectedClientPlaceholderTable(iface,title){
var tablehtml = '<div style="line-height:10px;"> </div>';
tablehtml+='<tr><td style="padding:0px;">';
tablehtml+='<table width="100%" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#6b8fa3" class="FormTable" id="table_clients_'+iface+'">';
tablehtml+='<thead class="collapsible-jquery" id="thead_clients_'+iface+'">';
tablehtml+='<tr>';
tablehtml+='<td>'+title+' (click to expand/collapse)</td>';
tablehtml+='</tr>';
tablehtml+='</thead>';
tablehtml+='<tr>';
tablehtml+='<td style="padding:0px;">';
tablehtml+='<div id="sortTable'+iface+'" class="sortTableContainer" style="height:150px;"></div>';
tablehtml+='</td>';
tablehtml+='</tr>';
tablehtml+='</table>';
tablehtml+='</td>';
tablehtml+='</tr>';
return tablehtml;
}
function BuildConnectedClientsTableNoData(){
var tablehtml = '<table width="100%" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#6b8fa3" class="sortTable">';
tablehtml += '<tr>';
tablehtml += '<td class="nodata">';
tablehtml += 'No connected clients';
tablehtml += '</td>';
tablehtml += '</tr>';
tablehtml += '</table>';
return tablehtml;
}
function BuildConnectedClientsTable(name){
var tablehtml = '<table border="0" cellpadding="0" cellspacing="0" width="100%" class="sortTable">';
tablehtml += '<col style="width:150px;">';
tablehtml += '<col style="width:100px;">';
tablehtml += '<col style="width:100px;">';
tablehtml += '<col style="width:60px;">';
tablehtml += '<col style="width:60px;">';
tablehtml += '<col style="width:65px;">';
tablehtml += '<col style="width:60px;">';
tablehtml += '<col style="width:40px;">';
tablehtml += '<thead class="sortTableHeader">';
tablehtml += '<tr>';
tablehtml += '<th class="sortable" onclick="SortTable(\'sortTable'+name+'\',\'clients'+name+'\',this.innerHTML.replace(/ \\(.*\\)/,\'\'),\'sortname'+name+'\',\'sortdir'+name+'\')">Hostname</th>';
tablehtml += '<th class="sortable" onclick="SortTable(\'sortTable'+name+'\',\'clients'+name+'\',this.innerHTML.replace(/ \\(.*\\)/,\'\').replace(\' \',\'\'),\'sortname'+name+'\',\'sortdir'+name+'\')">IP Address</th>';
tablehtml += '<th class="sortable" onclick="SortTable(\'sortTable'+name+'\',\'clients'+name+'\',this.innerHTML.replace(/ \\(.*\\)/,\'\').replace(\' \',\'\'),\'sortname'+name+'\',\'sortdir'+name+'\')">MAC Address</th>';
tablehtml += '<th class="sortable" onclick="SortTable(\'sortTable'+name+'\',\'clients'+name+'\',this.innerHTML.replace(/ \\(.*\\)/,\'\'),\'sortname'+name+'\',\'sortdir'+name+'\')">Connected</th>';
tablehtml += '<th class="sortable" onclick="SortTable(\'sortTable'+name+'\',\'clients'+name+'\',this.innerHTML.replace(/ \\(.*\\)/,\'\'),\'sortname'+name+'\',\'sortdir'+name+'\')">Rx (Mbps)</th>';
tablehtml += '<th class="sortable" onclick="SortTable(\'sortTable'+name+'\',\'clients'+name+'\',this.innerHTML.replace(/ \\(.*\\)/,\'\'),\'sortname'+name+'\',\'sortdir'+name+'\')">Tx (Mbps)</th>';
tablehtml += '<th class="sortable" onclick="SortTable(\'sortTable'+name+'\',\'clients'+name+'\',this.innerHTML.replace(/ \\(.*\\)/,\'\'),\'sortname'+name+'\',\'sortdir'+name+'\')">RSSI (dBm)</th>';
tablehtml += '<th class="sortable" onclick="SortTable(\'sortTable'+name+'\',\'clients'+name+'\',this.innerHTML.replace(/ \\(.*\\)/,\'\'),\'sortname'+name+'\',\'sortdir'+name+'\')">PHY</th>';
tablehtml += '</tr>';
tablehtml += '</thead>';
tablehtml += '<tbody class="sortTableContent">';
for(var i = 0; i < window['clients'+name].length; i++){
tablehtml += '<tr class="sortRow">';
tablehtml += '<td>'+window['clients'+name][i].Hostname+'</td>';
tablehtml += '<td>'+window['clients'+name][i].IPAddress+'</td>';
tablehtml += '<td>'+window['clients'+name][i].MACAddress+'</td>';
tablehtml += '<td>'+StoHHMMSS(window['clients'+name][i].Connected)+'</td>';
tablehtml += '<td>'+window['clients'+name][i].Rx+'</td>';
tablehtml += '<td>'+window['clients'+name][i].Tx+'</td>';
tablehtml += '<td>'+window['clients'+name][i].RSSI+'</td>';
tablehtml += '<td>'+window['clients'+name][i].PHY+'</td>';
tablehtml += '</tr>';
}
tablehtml += '</tbody>';