#!/usr/bin/perl
# Copyright 2001-2008 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',
'Import Students' => 'Import Students',
'Export' => 'Export',
'Upload Student CSV file' => 'Upload Student CSV file',
'Error Reading Record' => 'Error Reading Record',
'The file must be a .csv file!' => 'The file must be a .csv file!',
'Maximum File Upload size exceeded!' => 'Maximum File Upload size exceeded!',
'Cannot open file' => 'Cannot open file',
'Continue' => 'Continue',
'Cannot sysopen student number file.' => 'Cannot sysopen student number file.',
);
my $self = 'importCSV.pl';
my $maxbufcount = 500; # 500k max; change as required
my $maxrecorddisplay = 5;
use DBI;
use CGI;
use Text::CSV_XS;
use Fcntl qw(:DEFAULT :flock);
eval require "../../etc/admin.conf";
if ( $@ ) {
print $lex{Error}. " $@
\n";
die $lex{Error}. " $@\n";
}
my $q = new CGI;
print $q->header;
my %arr = $q->Vars;
my $dsn = "DBI:$dbtype:dbname=$dbase";
my $dbh = DBI->connect($dsn,$user,$password);
my $csv = Text::CSV_XS->new( {binary => 1} );
# Print Page Header
print "$doctype\n