From 69a91b8188bccf5da49ff9340e127a0e12d9309a Mon Sep 17 00:00:00 2001 From: wbudic Date: Sun, 26 Aug 2018 06:32:42 +1000 Subject: [PATCH] Finished remove.cgi the record delete operation --- htdocs/cgi-bin/remove.cgi | 44 ++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/htdocs/cgi-bin/remove.cgi b/htdocs/cgi-bin/remove.cgi index a68612b..f56a126 100755 --- a/htdocs/cgi-bin/remove.cgi +++ b/htdocs/cgi-bin/remove.cgi @@ -21,13 +21,7 @@ my $dbh = DBI->connect($dsn, $userid, $password, { RaiseError => 1 }) -print $q->header(-expires=>"+6os"); -print $q->start_html(-title => "Personal Log Record Removal", - -script=>{-type => 'text/javascript', -src => 'wsrc/main.js'}, - -style =>{-type => 'text/css', -src => 'wsrc/main.css'} - - ); my $today = DateTime->now; @@ -52,19 +46,44 @@ my $stmE = " ORDER BY rowid DESC, DATE DESC;"; my $tbl = '
'; my $confirmed = $q->param('confirmed'); if (!$confirmed){ - &NotConfirmed; + print $q->header(-expires=>"+6os"); + print $q->start_html(-title => "Personal Log Record Removal", + -script=>{-type => 'text/javascript', -src => 'wsrc/main.js'}, + -style =>{-type => 'text/css', -src => 'wsrc/main.css'} + + ); + + &NotConfirmed; + print $q->end_html; } else{ &ConfirmedDelition; } -print $q->end_html; $dbh->disconnect(); + +sub ConfirmedDelition{ + + my $stm; + my $stmS = 'DELETE FROM LOG WHERE '; + + foreach my $prm ($q->param('chk')){ + $stm = $stmS . "rowid = '" . $prm ."';"; + $sth = $dbh->prepare( $stm ); + $rv = $sth->execute() or die or die "

Error->"& $DBI::errstri &"

"; + if($rv < 0) { + print "

Error->"& $DBI::errstri &"

"; + } + } + + + print $q->redirect('main.cgi'); + +} + sub NotConfirmed{ #Get prms and build confirm table and check - -### TODO my $stm = $stmS ." "; foreach my $prm ($q->param('chk')){ $stm = $stm . "rowid = '" . $prm . "' OR "; @@ -108,8 +127,3 @@ if($rv < 0) { print "
\n" . $tbl ."
"; } - -sub ConfirmedDelition{ -#### TODO -} - -- 2.34.1
DateTimeLogCategory