-
Notifications
You must be signed in to change notification settings - Fork 0
/
save_history.cgi
36 lines (25 loc) · 1.12 KB
/
save_history.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/perl -w
use strict;
use CGI;
use HTML::Template;
use DBI;
my $cgi = new CGI;
my $template = HTML::Template->new(filename => '/var/www/bmouler/final/tmpl/save_history.tmpl');
my $filename = $cgi->param("filename");
my $search_id = $cgi->param("search_id");
############################################################
##########Save Glimmer results to MySQL database
############################################################
my $dsn = 'DBI:mysql:database=bmouler;host=localhost';
my $opts = { RaiseError => 1, PrintError => 1 };
my $dbh = DBI->connect($dsn, 'bmouler', '4rmonattygy6', $opts);
$dbh->do("LOAD DATA LOCAL INFILE '/var/www/bmouler/final/uploads/$filename.txt' REPLACE INTO TABLE glimmer_history");
$dbh->disconnect();
############################################################
############################################################
##########Push results to HTML template
############################################################
$template->param(SEARCHID => "$search_id");
print $cgi -> header('text/html');
print $template->output;
############################################################