#!/usr/bin/perl
# Copyright Andrew Gavin 2009-2012
#
# This file is part of OpenDLP.
#
# OpenDLP 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 3 of the License, or
# (at your option) any later version.
#
# OpenDLP is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with OpenDLP. If not, see .
use CGI qw/:standard/;
use DBI;
my $version = get_version();
my $db_admin_file = "../etc/db_admin";
my( $db_username, $db_password ) = "";
open( DB, $db_admin_file );
my $db_line = ;
close( DB );
chomp $db_line;
($db_username, $db_password) = split( ":", $db_line );
my $query = CGI->new;
my $old_profile = $query->param('edit');
my( $old_username, $old_domain, $old_exts, $old_ignore_exts, $old_dirs, $old_ignore_dirs ) = "";
my( $old_regex, $old_path, $old_phonehomeurl, $old_phonehomeuser, $old_delaytime ) = "";
my( $old_description, $old_debug, $old_concurrent, $old_creditcards, $old_zipfiles ) = "";
my( $old_memory, $old_mask ) = "";
my( $old_ignore_dbs, $old_dbs, $old_ignore_tables, $old_tables, $old_ignore_columns ) = "";
my( $old_columns, $old_rows, $old_scantype ) = "";
my $old_smbhash = "";
my $old_found = 0;
if( $old_profile ne "" )
{
my $dbh = DBI->connect("DBI:mysql:database=OpenDLP;host=localhost",$db_username,$db_password);
my $string = "SELECT * from profiles where profile=?";
my $sth = $dbh->prepare( $string );
$sth->execute( $old_profile );
$results = $sth->fetchrow_arrayref();
$old_username = $$results[1];
$old_domain = $$results[3];
$old_exts = $$results[4];
$old_ignore_exts = $$results[5];
$old_dirs = $$results[6];
$old_ignore_dirs = $$results[7];
$old_regex = $$results[8];
$old_path = $$results[9];
$old_phonehomeurl = $$results[10];
$old_phonehomeuser = $$results[11];
$old_delaytime = $$results[13];
$old_description = $$results[14];
$old_debug = $$results[15];
$old_concurrent = $$results[17];
$old_creditcards = $$results[18];
$old_zipfiles = $$results[19];
$old_memory = $$results[20];
$old_mask = $$results[21];
$old_smbhash = $$results[22];
$old_ignore_dbs = $$results[23];
$old_dbs = $$results[24];
$old_ignore_tables = $$results[25];
$old_tables = $$results[26];
$old_ignore_columns = $$results[27];
$old_columns = $$results[28];
$old_rows = $$results[29];
$old_scantype = $$results[30];
$sth->finish;
$dbh->disconnect;
if( $$results[0] ne "" )
{
$old_found = 1;
}
}
header();
print qq {
Create a new scan profile