#!/usr/bin/perl
# Copyright 2001-2020 Leslie Richardson
# This file is part of Open Admin for Schools.
# Open Admin for Schools is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
my %lex = ('Main' => 'Main',
'Error' => 'Error',
'Add' => 'Add',
'Scores' => 'Scores',
'Common Math Assessment' => 'Common Math Assessment',
'Student' => 'Student',
'Continue' => 'Continue',
'Save' => 'Save',
'Date' => 'Date',
'No User Id' => 'No User Id',
'No Password' => 'No Password',
'Please Log In' => 'Please Log In',
'Grade' => 'Grade',
'Homeroom' => 'Homeroom',
'Select' => 'Select',
'Record' => 'Record',
'Skipping' => 'Skipping',
'Students' => 'Students',
'Test' => 'Test',
'Missing Value' => 'Missing Value',
'Score' => 'Score',
'Record Exists' => 'Record Exists',
'Added' => 'Added',
'Select by' => 'Select by',
'Or' => 'Or',
'Updated' => 'Updated',
'Check' => 'Check',
'Next Page' => 'Next Page',
);
use DBI;
use CGI;
use CGI::Session;
use Time::JulianDay;
my %exceptions = ( 'moved' => 'Moved', 'attendance' => 'Persistent Absences',
'altprog' => 'Alternate Program', 'other' => 'Other' );
my @exceptions = ( 'moved', 'attendance', 'altprog', 'other');
my $self = 'ilangAdd.pl';
my $q = new CGI;
my %arr = $q->Vars;
my @time = localtime(time);
my $year = $time[5] + 1900;
my $month = $time[4] + 1;
my $day = $time[3];
if ( length $month == 1 ) { $month = '0'. $month; }
if ( length $day == 1 ) { $day = '0'. $day; }
my $currdate = "$year-$month-$day";
eval require "../../etc/admin.conf";
if ( $@ ) {
print $lex{Error}. " $self: $@
\n";
die $lex{Error}. "$self: $@\n";
}
my $dsn = "DBI:$dbtype:dbname=$dbase";
my $dbh = DBI->connect($dsn,$user,$password);
# Session Setup Here
my $session = new CGI::Session("driver:mysql;serializer:FreezeThaw",
undef,{Handle => $dbh}) or die CGI::Session->errstr;
# Get/Set Session Values (a defined userid means it was passed)
if ( $arr{userid} ){ # we want to login, passed userid/password pair.
# Check password/userid against database (-1 no user, -2 wrong password);
my $error = checkPassword($arr{userid}, $arr{password});
if ($error == -1){ print $q->header( -charset, $charset ); print qq{