| ︙ | | |
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
|
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
|
+
-
+
+
|
**
** Show the content of the error log. Only the administrator can view
** this page.
**
** y=0x01 Show only hack attempts
** y=0x02 Show only panics and assertion faults
** y=0x04 Show hung backoffice processes
** y=0x08 Show POST requests from a different origin
** y=0x40 Show other uncategorized messages
**
** If y is omitted or is zero, a count of the various message types is
** shown.
*/
void errorlog_page(void){
i64 szFile;
FILE *in;
char *zLog;
const char *zType = P("y");
static const int eAllTypes = 0x47;
static const int eAllTypes = 0x4f;
long eType = 0;
int bOutput = 0;
int prevWasTime = 0;
int nHack = 0;
int nPanic = 0;
int nOther = 0;
int nHang = 0;
int nXPost = 0;
char z[10000];
char zTime[10000];
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
|
| ︙ | | |
899
900
901
902
903
904
905
906
907
908
909
910
911
912
|
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
|
+
+
+
|
}
if( eType & 0x02 ){
@ <li>Panics and assertion faults
}
if( eType & 0x04 ){
@ <li>Hung backoffice processes
}
if( eType & 0x08 ){
@ <li>POST requests from different origin
}
if( eType & 0x40 ){
@ <li>Other uncategorized messages
}
@ </ul>
}
@ <hr>
if( eType ){
|
| ︙ | | |
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
|
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
|
-
+
+
+
+
+
+
|
if( (strncmp(z,"panic: ", 7)==0 || strstr(z," assertion fault ")!=0) ){
bOutput = (eType & 0x02)!=0;
nPanic++;
}else
if( sqlite3_strglob("warning: backoffice process * still *",z)==0 ){
bOutput = (eType & 0x04)!=0;
nHang++;
}else{
}else
if( sqlite3_strglob("warning: POST from different origin*",z)==0 ){
bOutput = (eType & 0x08)!=0;
nXPost++;
}else
{
bOutput = (eType & 0x40)!=0;
nOther++;
}
if( bOutput ){
@ %h(zTime)\
}
}
|
| ︙ | | |
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
|
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
|
-
-
+
+
-
+
-
-
-
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
-
-
+
-
-
+
-
+
-
-
+
-
-
|
}
}
fclose(in);
if( eType ){
@ </pre>
}
if( eType==0 ){
int nNonHack = nPanic+nHang+nOther;
int nTotal = nNonHack + nHack;
int nNonHack = nPanic + nHang + nOther;
int nTotal = nNonHack + nHack + nXPost;
@ <p><table border="a" cellspacing="0" cellpadding="5">
@ <tr><td align="right">%d(nPanic)</td>
if( nPanic>0 ){
@ <tr><td align="right">%d(nPanic)</td>
@ <td><a href="./errorlog?y=2">Panics</a></td>
} else {
@ <td>Panics</td>
}
@ <tr><td align="right">%d(nHack)</td>
if( nHack>0 ){
@ <tr><td align="right">%d(nHack)</td>
@ <td><a href="./errorlog?y=1">Hack Attempts</a></td>
}
if( nNonHack ){
@ <tr><td align="right">%d(nNonHack)</td>
@ <td><a href="%R/errorlog?y=70">Other than hack attempts</a></td>
}
}else{
@ <td>Hack Attempts</td>
if( nHang>0 ){
@ <tr><td align="right">%d(nHang)</td>
@ <td><a href="./errorlog?y=4/">Hung Backoffice</a></td>
}
if( nXPost>0 ){
@ <tr><td align="right">%d(nXPost)</td>
@ <td><a href="./errorlog?y=8/">POSTs from different origin</a></td>
}
if( nOther>0 ){
@ <tr><td align="right">%d(nHang)</td>
@ <tr><td align="right">%d(nOther)</td>
if( nHang>0 ){
@ <td><a href="./errorlog?y=4/">Hung Backoffice</a></td>
@ <td><a href="./errorlog?y=64/">Other</a></td>
}else{
@ <td>Hung Backoffice</td>
}
if( nHack+nXPost>0 && nNonHack>0 ){
@ <tr><td align="right">%d(nHang)</td>
@ <tr><td align="right">%d(nNonHack)</td>
if( nOther>0 ){
@ <td><a href="./errorlog?y=64/">Other</a></td>
@ <td><a href="%R/errorlog?y=70">Other than hack attempts</a></td>
}else{
@ <td>Other</td>
}
@ <tr><td align="right">%d(nTotal)</td>
if( nTotal>0 ){
@ <td><a href="./errorlog">All Messages</a></td>
}else{
@ <td>All Messages</td>
}
@ </table>
}
style_finish_page();
}
|