From 50e734ac2aec860ad91fb40b536470231585c8c9 Mon Sep 17 00:00:00 2001 From: Metabox Date: Wed, 24 Apr 2019 17:20:18 +1000 Subject: [PATCH] Added remove page table style. --- .vstags | 52 +++++++++++++------ Installation.txt | 6 +-- .../cgisess_46a0fa1e42f2731eddd3025facc36f0b | 1 + .../cgisess_4c84e96b89b816bdfdebc4d767d11f2e | 1 + .../cgisess_71912c3884dcafdddf8f32be1db02ff0 | 1 + .../cgisess_75c1ba723680ab5c079b6e0a63fb45e1 | 1 + .../cgisess_ac5c5da7a235175332d773dbd518bbbb | 1 + .../cgisess_f894200ea978de16fca329c976941e4c | 1 + htdocs/cgi-bin/remove.cgi | 13 ++--- htdocs/cgi-bin/stats.cgi | 2 + htdocs/cgi-bin/tempCodeRunnerFile.cgi | 26 ++++++++++ htdocs/cgi-bin/wsrc/main.css | 14 +++++ htdocs/thttpd.pid | 1 + thttpd.conf | 4 +- 14 files changed, 97 insertions(+), 27 deletions(-) create mode 100644 dbLifeLog/cgisess_46a0fa1e42f2731eddd3025facc36f0b create mode 100644 dbLifeLog/cgisess_4c84e96b89b816bdfdebc4d767d11f2e create mode 100644 dbLifeLog/cgisess_71912c3884dcafdddf8f32be1db02ff0 create mode 100644 dbLifeLog/cgisess_75c1ba723680ab5c079b6e0a63fb45e1 create mode 100644 dbLifeLog/cgisess_ac5c5da7a235175332d773dbd518bbbb create mode 100644 dbLifeLog/cgisess_f894200ea978de16fca329c976941e4c create mode 100644 htdocs/cgi-bin/tempCodeRunnerFile.cgi create mode 100644 htdocs/thttpd.pid diff --git a/.vstags b/.vstags index 065d9bb..12baa8d 100644 --- a/.vstags +++ b/.vstags @@ -4,21 +4,41 @@ !_TAG_PROGRAM_NAME Exuberant Ctags // !_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ !_TAG_PROGRAM_VERSION 5.9~svn20110310 // -ConfirmedDelition htdocs/cgi-bin/remove.cgi 132;" s -DisplayDateDiffs htdocs/cgi-bin/remove.cgi 84;" s -NotConfirmed htdocs/cgi-bin/remove.cgi 152;" s -authenticate htdocs/cgi-bin/main.cgi 522;" s -big_money htdocs/cgi-bin/stats.cgi 105;" s -boldDate htdocs/cgi-bin/remove.cgi 126;" s +ConfirmedDelition htdocs/cgi-bin/remove.cgi 151;" s +DisplayDateDiffs htdocs/cgi-bin/remove.cgi 103;" s +NotConfirmed htdocs/cgi-bin/remove.cgi 171;" s +authenticate htdocs/cgi-bin/main.cgi 526;" s +big_money htdocs/cgi-bin/stats.cgi 126;" s +boldDate htdocs/cgi-bin/remove.cgi 145;" s build htdocs/cgi-bin/search.cgi 85;" s -buildNavigationButtons htdocs/cgi-bin/main.cgi 460;" s -checkCreateTables htdocs/cgi-bin/login_ctr.cgi 109;" s -dateDiff htdocs/cgi-bin/remove.cgi 118;" s -getConfiguration htdocs/cgi-bin/config.cgi 225;" s -getConfiguration htdocs/cgi-bin/main.cgi 504;" s -processSubmit htdocs/cgi-bin/config.cgi 127;" s -processSubmit htdocs/cgi-bin/login_ctr.cgi 85;" s -processSubmit htdocs/cgi-bin/main.cgi 374;" s -selSQLTbl htdocs/cgi-bin/login_ctr.cgi 210;" s -selectSQL htdocs/cgi-bin/stats.cgi 94;" s +buildNavigationButtons htdocs/cgi-bin/main.cgi 482;" s +changeSystemSettings htdocs/cgi-bin/config.cgi 339;" s +checkCreateTables htdocs/cgi-bin/login_ctr.cgi 112;" s +dateDiff htdocs/cgi-bin/remove.cgi 137;" s +exportCategoriesToCSV htdocs/cgi-bin/config.cgi 405;" s +exportLogToCSV htdocs/cgi-bin/config.cgi 375;" s +getConfiguration htdocs/cgi-bin/config.cgi 317;" s +getConfiguration htdocs/cgi-bin/main.cgi 569;" s +getConfiguration htdocs/cgi-bin/remove.cgi 223;" s +importCatCSV htdocs/cgi-bin/config.cgi 437;" s +importLogCSV htdocs/cgi-bin/config.cgi 478;" s +insertDefCats htdocs/cgi-bin/login_ctr.cgi 216;" s +main htdocs/cgi-bin/login_ctr.cgi 6;" p +main::checkCreateTables htdocs/cgi-bin/login_ctr.cgi 112;" s +main::insertDefCats htdocs/cgi-bin/login_ctr.cgi 216;" s +main::populateConfig htdocs/cgi-bin/login_ctr.cgi 231;" s +main::processSubmit htdocs/cgi-bin/login_ctr.cgi 86;" s +main::removeOldSessions htdocs/cgi-bin/login_ctr.cgi 242;" s +main::selSQLTbl htdocs/cgi-bin/login_ctr.cgi 211;" s +parseDate htdocs/cgi-bin/main.cgi 383;" s +populateConfig htdocs/cgi-bin/login_ctr.cgi 231;" s +processSubmit htdocs/cgi-bin/config.cgi 214;" s +processSubmit htdocs/cgi-bin/login_ctr.cgi 86;" s +processSubmit htdocs/cgi-bin/main.cgi 397;" s +removeOldSessions htdocs/cgi-bin/login_ctr.cgi 242;" s +selSQLTbl htdocs/cgi-bin/login_ctr.cgi 211;" s +selectSQL htdocs/cgi-bin/stats.cgi 115;" s +updConfSetting htdocs/cgi-bin/config.cgi 360;" s +updateCATDB htdocs/cgi-bin/config.cgi 451;" s +updateLOGDB htdocs/cgi-bin/config.cgi 494;" s wanted htdocs/cgi-bin/e_vars.pl 211;" s diff --git a/Installation.txt b/Installation.txt index b54f7c7..63d4ef4 100644 --- a/Installation.txt +++ b/Installation.txt @@ -76,7 +76,7 @@ Before installing newer version scripts, perform an data export. cd /home/{user}/thttpd_dev/dbLifeLog sqlite3 -csv data_log.db "select * from LOG;" > current_log.csv -##Install LifeLog Independantly +##Install LifeLog Independently cd /home/{user}/ git clone https://github.com/wbudic/LifeLog mkdir /home/{user}/thttpd_dev/dbLifeLog @@ -87,14 +87,14 @@ if doing development. Copy also the /home/{user}/LifeLog/.git to /home/{user}/th Access the webserver cgi-bin. http://localhost:8080/cgi-bin/main.cgi (this might redirect to login.cgi or config.cgi in the future) -##Install LifeLog Dependatly (not automatic, manual developer way) +##Install LifeLog Dependetly (not automatic, manual developer way) cd /home/{user}/ git clone https://github.com/wbudic/LifeLog run thttpd with: cd LifeLog; ./startDevWebServer.sh ##Import CSV Exported File -This requires all CGI working. As it will creat a brand new database for you. +This requires all CGI working. As it will create a brand new database for you. Once created you must import the from above example current_log.csv cd /home/{user}/thttpd_dev/dbLifeLog see: http://www.sqlitetutorial.net/sqlite-import-csv/ diff --git a/dbLifeLog/cgisess_46a0fa1e42f2731eddd3025facc36f0b b/dbLifeLog/cgisess_46a0fa1e42f2731eddd3025facc36f0b new file mode 100644 index 0000000..71c9101 --- /dev/null +++ b/dbLifeLog/cgisess_46a0fa1e42f2731eddd3025facc36f0b @@ -0,0 +1 @@ +$D = {'_SESSION_CTIME' => 1556077243,'_SESSION_ATIME' => 1556077243,'_SESSION_REMOTE_ADDR' => '127.0.0.1','_SESSION_ID' => '46a0fa1e42f2731eddd3025facc36f0b'};;$D \ No newline at end of file diff --git a/dbLifeLog/cgisess_4c84e96b89b816bdfdebc4d767d11f2e b/dbLifeLog/cgisess_4c84e96b89b816bdfdebc4d767d11f2e new file mode 100644 index 0000000..6640ed3 --- /dev/null +++ b/dbLifeLog/cgisess_4c84e96b89b816bdfdebc4d767d11f2e @@ -0,0 +1 @@ +$D = {'_SESSION_ID' => '4c84e96b89b816bdfdebc4d767d11f2e','_SESSION_ATIME' => 1556063110,'_SESSION_CTIME' => 1556063110,'_SESSION_REMOTE_ADDR' => '127.0.0.1'};;$D \ No newline at end of file diff --git a/dbLifeLog/cgisess_71912c3884dcafdddf8f32be1db02ff0 b/dbLifeLog/cgisess_71912c3884dcafdddf8f32be1db02ff0 new file mode 100644 index 0000000..7df973c --- /dev/null +++ b/dbLifeLog/cgisess_71912c3884dcafdddf8f32be1db02ff0 @@ -0,0 +1 @@ +$D = {'_SESSION_CTIME' => 1556067062,'_SESSION_ATIME' => 1556067062,'_SESSION_REMOTE_ADDR' => '127.0.0.1','_SESSION_ID' => '71912c3884dcafdddf8f32be1db02ff0','_SESSION_ETIME' => 1800};;$D \ No newline at end of file diff --git a/dbLifeLog/cgisess_75c1ba723680ab5c079b6e0a63fb45e1 b/dbLifeLog/cgisess_75c1ba723680ab5c079b6e0a63fb45e1 new file mode 100644 index 0000000..c38e44d --- /dev/null +++ b/dbLifeLog/cgisess_75c1ba723680ab5c079b6e0a63fb45e1 @@ -0,0 +1 @@ +$D = {'_SESSION_REMOTE_ADDR' => '127.0.0.1','_SESSION_CTIME' => 1556086450,'_SESSION_ATIME' => 1556086450,'_SESSION_ID' => '75c1ba723680ab5c079b6e0a63fb45e1'};;$D \ No newline at end of file diff --git a/dbLifeLog/cgisess_ac5c5da7a235175332d773dbd518bbbb b/dbLifeLog/cgisess_ac5c5da7a235175332d773dbd518bbbb new file mode 100644 index 0000000..53bf32a --- /dev/null +++ b/dbLifeLog/cgisess_ac5c5da7a235175332d773dbd518bbbb @@ -0,0 +1 @@ +$D = {'_SESSION_ATIME' => 1556089997,'_SESSION_ID' => 'ac5c5da7a235175332d773dbd518bbbb','_SESSION_CTIME' => 1556086450,'_SESSION_ETIME' => 1200,'_SESSION_REMOTE_ADDR' => '127.0.0.1','alias' => 'admin','passw' => '42FAP5H0JUSZM','database' => 'data_admin_log.db'};;$D \ No newline at end of file diff --git a/dbLifeLog/cgisess_f894200ea978de16fca329c976941e4c b/dbLifeLog/cgisess_f894200ea978de16fca329c976941e4c new file mode 100644 index 0000000..32160c9 --- /dev/null +++ b/dbLifeLog/cgisess_f894200ea978de16fca329c976941e4c @@ -0,0 +1 @@ +$D = {'_SESSION_ID' => 'f894200ea978de16fca329c976941e4c','_SESSION_CTIME' => 1556082147,'_SESSION_ATIME' => 1556082147,'_SESSION_REMOTE_ADDR' => '127.0.0.1'};;$D \ No newline at end of file diff --git a/htdocs/cgi-bin/remove.cgi b/htdocs/cgi-bin/remove.cgi index 3920d92..c6c7a20 100755 --- a/htdocs/cgi-bin/remove.cgi +++ b/htdocs/cgi-bin/remove.cgi @@ -68,8 +68,8 @@ while(my @row = $st->fetchrow_array()) { my $stmS = "SELECT rowid, ID_CAT, DATE, LOG from LOG WHERE"; my $stmE = " ORDER BY DATE DESC, rowid DESC;"; my $tbl = '
- - '; +
DateTimeLogCategory
+ '; my $datediff = $cgi->param("datediff"); @@ -123,7 +123,7 @@ my @prms = $cgi->param('chk'); my $dt = DateTime::Format::SQLite->parse_datetime( $row[0] ); my $dif = dateDiff($dt_prev, $dt); $tbl .= ' - ". + ". ''; $dt_prev = $dt; } @@ -192,9 +192,10 @@ while(my @row = $st->fetchrow_array()) { my $ct = $hshCats{$row[1]}; my $dt = DateTime::Format::SQLite->parse_datetime( $row[2] ); - $tbl = $tbl . '" . - "" . "\n". - "'; + $tbl = $tbl . '" . + '" . + '\n". + ''; $r_cnt++; } my $plural = ""; diff --git a/htdocs/cgi-bin/stats.cgi b/htdocs/cgi-bin/stats.cgi index f52daac..6cba7c8 100755 --- a/htdocs/cgi-bin/stats.cgi +++ b/htdocs/cgi-bin/stats.cgi @@ -80,6 +80,8 @@ my $hardware_status =`inxi -b -c0;uptime -p`; $hardware_status =~ s/\n//g; $hardware_status =~ s/Memory:/Memory:/g; $hardware_status =~ s/Init:/<\/b>Initial:/g; +$hardware_status =~ s/up\s/Server is up: /g; +$hardware_status .= ''; my $prc = 'ps -eo size,pid,user,command --sort -size | awk \'{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }\''; diff --git a/htdocs/cgi-bin/tempCodeRunnerFile.cgi b/htdocs/cgi-bin/tempCodeRunnerFile.cgi new file mode 100644 index 0000000..837e13e --- /dev/null +++ b/htdocs/cgi-bin/tempCodeRunnerFile.cgi @@ -0,0 +1,26 @@ +#!/usr/bin/perl +# +# Programed in vim by: Will Budic +# Open Source License -> https://choosealicense.com/licenses/isc/ +# +use strict; +use warnings; + +our $LOG_PATH = '/home/will/dev/LifeLog/dbLifeLog/'; + +&removeOldSessions; + +sub removeOldSessions{ + opendir(DIR, $LOG_PATH); + my @files = grep(/cgisess_*/,readdir(DIR)); + closedir(DIR); + + my $now = time - (24 * 60 * 60); + + foreach my $file (@files) { + my $mod = (stat("$LOG_PATH/$file"))[9]; + if($mod<$now){ + print "$file\n"; + } + } +} \ No newline at end of file diff --git a/htdocs/cgi-bin/wsrc/main.css b/htdocs/cgi-bin/wsrc/main.css index 6237c91..9d55bdb 100644 --- a/htdocs/cgi-bin/wsrc/main.css +++ b/htdocs/cgi-bin/wsrc/main.css @@ -33,13 +33,27 @@ div { padding-left: 5px; } +.tbl_rem { + border: 1px solid black; + border-right: 1px solid black; + border-bottom: 1px solid black; + padding-top: 5px; + padding-right: 5px; + padding-bottom: 5px; + padding-left: 5px; + text-align: left; +} + .r0 { background-color: #e6ffff; border: 1px solid black; + border-right: 1px solid black; } .r1 { background-color: #ccffff; + border: 1px solid black; + border-right: 1px solid black; } .edit { diff --git a/htdocs/thttpd.pid b/htdocs/thttpd.pid new file mode 100644 index 0000000..ec13183 --- /dev/null +++ b/htdocs/thttpd.pid @@ -0,0 +1 @@ +5885 diff --git a/thttpd.conf b/thttpd.conf index df28136..f8a51e6 100644 --- a/thttpd.conf +++ b/thttpd.conf @@ -1,8 +1,8 @@ # This section overrides defaults -dir=/home/will/dev/LifeLog/htdocs +dir=./htdocs user=will logfile=/home/will/dev/LifeLog/log/thttpd.log -pidfile=/home/will/dev/LifeLog/run/thttpd.pid +pidfile=thttpd.pid # This section _documents_ defaults in effect port=8080 nosymlinkcheck # default = !chroot -- 2.34.1
Date TimeLogCategory
'. $dt->ymd . ''.$row[1]."
'.$row[1]."
'.$dif. '
'. $dt->ymd . "" . $dt->hms . "" . $row[3] . "" . $ct. '
'. $dt->ymd . "' . $dt->hms . "' . $row[3] . "' . $ct. '