[-
#
# view client's data
#
# pass $fdat{u} = username to view
#
BEGIN {
unshift(@INC, $ENV{SW_PERLDIR});
}
use HTML::Table;
use SW::Site::rcm;
use SW::DB::rcm;
use Data::Dumper;
# break any cache
$http_headers_out{'Expires'} = "Fri, 30 Oct 1998 14:19:41 GMT";
$http_headers_out{'Cache-Control'} = "max-age=1, must-revalidate";
#
# create site object and connect to db
#
my $site = SW::Site::rcm->new( $ENV{SW_CONFIG} );
$site->{show_top} = 0;
my $db = SW::DB::rcm->new( $ENV{SW_CONFIG} );
if ( $db->connect() ) {
} else {
print OUT $site->showContent( "sorry can't connect to db" );
exit;
}
$site->{db} = $db;
$site->{extra_head} = $site->readFile( $site->includeFile( 'htmlarea' ));
# get login_id from md5 cookie
my %cookies = $site->getCookies();
my $login_id = $db->md52login( $cookies{lid} );
my $login_ref = $db->getLoginAccount( $login_id );
my $login_id = $login_ref->{login_id};
#
my $access_level = $db->getAccessLevel( $login_id );
my $manual_id = $db->login2manual( $login_id );
$db->lastAccessManual( $manual_id );
if ( ! $login_id ) {
print OUT $site->showContent( $cookies{lid}.'Invalid session id. Please login again.' );
exit;
}
#
# save changes
#
if ( defined($fdat{save}) ) {
my $msg = "";
if ( $db->saveSectionClient( $fdat{s}, $fdat{clientwording} ) ) {
$msg = "Changes saved";
} else {
$msg = "Couldn't save changes";
}
$txtIntro .= "$msg";
}
my $adds = "";
if ( defined( $fdat{s} ) ) {
# $adds = "[Add Schedule]";
}
my $txtIntro = HTML::Table->new(-width=>'100%');
$txtIntro->addRow( #'[Table of Contents]',
$adds,
# "You are logged in as: $login_ref->{username}
'