Changeset 80 for trunk/uribl/uridb.cgi


Ignore:
Timestamp:
09/11/25 16:28:23 (4 days ago)
Author:
Kris Deugau
Message:

/trunk/uribl

Convert module to more proper object with embedded DB bits
Add module-finding blurb

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/uribl/uridb.cgi

    r62 r80  
    33##
    44# $Id$
    5 # Copyright 2010 Kris Deugau <kdeugau@deepnet.cx>
     5# Copyright 2010,2025 Kris Deugau <kdeugau@deepnet.cx>
    66#
    77#    This program is free software: you can redistribute it and/or modify
     
    2222use warnings;
    2323no warnings qw(uninitialized);
     24
    2425use CGI::Carp qw (fatalsToBrowser);
    2526use CGI::Simple;
     
    2728use Encode;
    2829
    29 use URIdb;
     30# push "the directory the script is in" into @INC
     31use FindBin;
     32use lib "$FindBin::RealBin/";
     33
     34use URIdb 2.0;
    3035
    3136# Set up the CGI object...
     
    4045}
    4146
    42 my $uridb = new URIdb;
    43 
    4447print $q->header(-charset=>'utf8');
    45 
    46 # default DB info - all other settings should be loaded from the DB.
    47 my $dbhost = "localhost";
    48 my $dbname = "uridb";
    49 my $dbuser = "uridb";
    50 my $dbpass = "spambgone";
    5148
    5249#my %status = (0 => "Don't list",
     
    6461$cfgname =~ s|_uridb_cgi.*||;
    6562$cfgname =~ s|_$||;
    66 if (-e "/etc/uridb/$cfgname.conf") {
    67   my $cfg = `cat /etc/uridb/$cfgname.conf`;
    68   ($cfg) = ($cfg =~ /^(.+)$/s);         # avoid warnings, failures, and general nastiness with taint mode
    69   eval $cfg;
    70 }
    7163
    72 my $dbh = $uridb->connect($dbhost, $dbname, $dbuser, $dbpass);
     64my $uridb = new URIdb (configfile => "/etc/uridb/$cfgname.conf");
    7365
    7466my $page;
Note: See TracChangeset for help on using the changeset viewer.