#!/usr/bin/perl -w #!C:/cygwin/bin/perl.exe -w #***************************************************************************** # # Filename: WorkoutTracker.pl # # CVS Revision: BS::Revision: 1427 $ # # Description: This perl CGI script reads the EXERCISE logs databases. # It is secured by using the REMOTE_USER environment variable. # #***************************************************************************** # QUICK! send browser something always and define custom message use CGI::Carp qw(fatalsToBrowser set_message); BEGIN { sub handle_errors { my $error = shift; print "
$error
ACCEPTANCE OF TERMS
Welcome to Carl's Workout Tracker.
This tool was written to replace an spreadsheet that contained my exercise records.
It's not the best tool in the world, but it's free, has no pop-ups, and is usually available via the Intranet, as long as my children do not turn off my computer.
I would like to move it to a server-site, but until I get more users it will stay at home.
Anyway, I would never give away anyone's email address or use the address for any non-system related messages.
Currently, the password is stored in using 64-bit DES encryption, but is sent 'in the clear' to the server.
Of course I will try to keep the system and your data available, but if my hard disk dies, we will lose the data.
I backup to a network drive every so often, but the PC is pretty new and I've been lulled into a false sense of security.
"; #***************************************************************************** # # Routine: read_blog # #***************************************************************************** sub read_blog { my $here = $API::program.'::read_blog'; my $lines = shift(@_); my $usr = $ENV{REMOTE_USER}; if ($API::diag > 2) { print STDERR "$here: lines=$lines usr=$usr\n"; } if ($www::My_Prefs{elogsBlog} < 0) { $www::HTML{Foot} = "
\n"; $www::HTML{Foot} = " \n"; return; } my $sth = $API::dbh->prepare("SELECT MAX(ID) AS MAX FROM $www::db_logs_table;"); $API::queries++; $sth->execute(); my $ref = $sth->fetchrow_hashref(); my $max = $ref->{MAX} - $lines + 1; $API::sql = "SELECT *\n"; # select the pseudo columns foreach my $key (keys %www::SQL) { unless ($key =~ /METS/) { $API::sql .= ", $www::SQL{$key} AS $key\n"; } } $API::sql .= "FROM $www::db_logs_table WHERE ID >= ? OR TO_DAYS(NOW()) - TO_DAYS(Date) = 0 ORDER BY ID DESC;"; $sth = $API::dbh->prepare($API::sql); $API::queries++; $sth->execute($max); my $th = ''; $th = '
| \n";
# add the new table to the output buffer
$out .= $list_table;
}
$out .= "