summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarDoug Freed <dwfreed@mtu.edu>2015-12-18 12:13:16 +0400
committerLibravatarDoug Freed <dwfreed@mtu.edu>2015-12-18 12:13:16 +0400
commit71c6714f447542ad2e765be3458e3aa3b3e456bb (patch)
tree4e5715d1e3fe1bd52f02b04fc1af6af3534f1cdc
parent0c1b6cc2808b4fd45779cce4835a6a80eae48265 (diff)
Make web scripts load DB configuration from ASM
-rwxr-xr-xcgi-bin/query.pl8
-rwxr-xr-xcgi-bin/secret/investigate.pl9
2 files changed, 14 insertions, 3 deletions
diff --git a/cgi-bin/query.pl b/cgi-bin/query.pl
index 4a9ed26..35c2455 100755
--- a/cgi-bin/query.pl
+++ b/cgi-bin/query.pl
@@ -7,7 +7,13 @@ use DBI;
use CGI_Lite;
-my $dbh = DBI->connect("DBI:mysql:database=asm_main;host=localhost;port=3306", 'USER', 'PASSWORD');
+use XML::Simple qw(:strict);
+my $xs1 = XML::Simple->new( KeyAttr => ['id'], Cache => [ qw/memcopy/ ]);
+my $sqlconf = $xs1->XMLin( "/home/icxcnika/AntiSpamMeta/config-main/mysql.xml",
+ ForceArray => ['ident', 'geco'],
+ 'GroupTags' => { ignoredidents => 'ident', ignoredgecos => 'geco' });
+
+my $dbh = DBI->connect("DBI:mysql:database=" . $sqlconf->{db} . ";host=" . $sqlconf->{host} . ";port=" . $sqlconf->{port}, $sqlconf->{user}, $sqlconf->{pass});
my $debug = 0;
diff --git a/cgi-bin/secret/investigate.pl b/cgi-bin/secret/investigate.pl
index 0716480..23a5945 100755
--- a/cgi-bin/secret/investigate.pl
+++ b/cgi-bin/secret/investigate.pl
@@ -6,8 +6,13 @@ use strict;
use DBI;
use CGI_Lite;
+use XML::Simple qw(:strict);
+my $xs1 = XML::Simple->new( KeyAttr => ['id'], Cache => [ qw/memcopy/ ]);
+my $sqlconf = $xs1->XMLin( "/home/icxcnika/AntiSpamMeta/config-main/mysql.xml",
+ ForceArray => ['ident', 'geco'],
+ 'GroupTags' => { ignoredidents => 'ident', ignoredgecos => 'geco' });
-my $dbh = DBI->connect("DBI:mysql:database=asm_main;host=localhost;port=3306", 'USER', 'PASSWORD');
+my $dbh = DBI->connect("DBI:mysql:database=" . $sqlconf->{db} . ";host=" . $sqlconf->{host} . ";port=" . $sqlconf->{port}, $sqlconf->{user}, $sqlconf->{pass});
my $debug = 0;
@@ -99,7 +104,7 @@ HTML
##Queryable items:
## nick, user, host, realip, gecos, account
-my $qry = 'SELECT * FROM actionlog WHERE ';
+my $qry = 'SELECT * FROM ' . $sqlconf->{actiontable} . ' WHERE ';
if (defined($data{nick}) && ($data{nick} ne "*") && ($data{nick} ne "")) {
$qry .= " nick like " . esc($data{nick}) . ' or ';