| ︙ | | |
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
|
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
|
+
-
+
+
|
** 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=0x10 Show SQLITE_AUTH and similar
** 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 = 0x4f;
static const int eAllTypes = 0x5f;
long eType = 0;
int bOutput = 0;
int prevWasTime = 0;
int nHack = 0;
int nPanic = 0;
int nOther = 0;
int nHang = 0;
int nXPost = 0;
int nAuth = 0;
char z[10000];
char zTime[10000];
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
|
| ︙ | | |
904
905
906
907
908
909
910
911
912
913
914
915
916
917
|
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
|
+
+
+
|
}
if( eType & 0x04 ){
@ <li>Hung backoffice processes
}
if( eType & 0x08 ){
@ <li>POST requests from different origin
}
if( eType & 0x10 ){
@ <li>SQLITE_AUTH and similar errors
}
if( eType & 0x40 ){
@ <li>Other uncategorized messages
}
@ </ul>
}
@ <hr>
if( eType ){
|
| ︙ | | |
931
932
933
934
935
936
937
938
939
940
941
942
943
944
|
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
|
+
+
+
+
+
+
|
bOutput = (eType & 0x04)!=0;
nHang++;
}else
if( sqlite3_strglob("warning: POST from different origin*",z)==0 ){
bOutput = (eType & 0x08)!=0;
nXPost++;
}else
if( sqlite3_strglob("SECURITY: authorizer blocks*",z)==0
|| sqlite3_strglob("warning: SQLITE_AUTH*",z)==0
){
bOutput = (eType & 0x10)!=0;
nAuth++;
}else
{
bOutput = (eType & 0x40)!=0;
nOther++;
}
if( bOutput ){
@ %h(zTime)\
}
|
| ︙ | | |
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
|
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
|
-
+
-
+
-
+
+
+
+
+
-
+
-
-
-
-
|
}
}
fclose(in);
if( eType ){
@ </pre>
}
if( eType==0 ){
int nNonHack = nPanic + nHang + nOther;
int nNonHack = nPanic + nHang + nAuth + nOther;
int nTotal = nNonHack + nHack + nXPost;
@ <p><table border="a" cellspacing="0" cellpadding="5">
if( nPanic>0 ){
@ <tr><td align="right">%d(nPanic)</td>
@ <td><a href="./errorlog?y=2">Panics</a></td>
}
if( nHack>0 ){
@ <tr><td align="right">%d(nHack)</td>
@ <td><a href="./errorlog?y=1">Hack Attempts</a></td>
}
if( nHang>0 ){
@ <tr><td align="right">%d(nHang)</td>
@ <td><a href="./errorlog?y=4/">Hung Backoffice</a></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>
@ <td><a href="./errorlog?y=8">POSTs from different origin</a></td>
}
if( nAuth>0 ){
@ <tr><td align="right">%d(nAuth)</td>
@ <td><a href="./errorlog?y=16">SQLITE_AUTH and similar</a></td>
}
if( nOther>0 ){
@ <tr><td align="right">%d(nOther)</td>
@ <td><a href="./errorlog?y=64/">Other</a></td>
@ <td><a href="./errorlog?y=64">Other</a></td>
}
if( nHack+nXPost>0 && nNonHack>0 ){
@ <tr><td align="right">%d(nNonHack)</td>
@ <td><a href="%R/errorlog?y=70">Other than hack attempts</a></td>
}
@ <tr><td align="right">%d(nTotal)</td>
if( nTotal>0 ){
@ <td><a href="./errorlog?y=255">All Messages</a></td>
}else{
@ <td>All Messages</td>
}
@ </table>
}
style_finish_page();
}
|