[- use DBI; -] [- use Socket; -] [- $req = shift; -] [# Lets look for UNIX Metacharacters in the query string from the browser #] [$ if $ENV{'QUERY_STRING'} =~ /([;\*\/'\$!#\(\)\[\]\{\}:'"])/ $] [- Execute ('error.html') -] [- exit -] [$ endif $] [- $HostChoice = $fdat{HostChoice} -] [- chomp $HostChoice; -] [- $LanChoice = $fdat{LanChoice} -] [- chomp $LanChoice; -] [- $Event = $fdat{Event} -] [- chomp $Event; -] [$ if $Event eq "Inbnd" $] [- $TableName = "InBnd" -] [$ elsif $Event eq "Outbnd" $] [- $TableName = "OutBnd" -] [$ endif $] [- ($dsn) = "DBI:mysql:FireWatch"; -] [- $dsn .= ";mysql_read_default_file=./sql.epl"; -] [- $dbh = DBI->connect($dsn); -] [- $sth = $dbh -> prepare ("select distinct HostName from Hosts order by HostName"); -] [- $sth -> execute; -]

Lookup IP's for [+ $HostChoice +] [+ $LanChoice +] [+ $Event +]

[- $sth = $dbh -> prepare ("select distinct SRC_IP from `${HostChoice}_${TableName}_Week$req->{weeknum}` where Lan = '$LanChoice' order by SRC_IP"); -] [- $sth -> execute; -]
[$ if $fdat{IP_List} ne "" $] [- $host = (`dig +short -x $fdat{IP_List}`); -] [- chomp $host; -] [$ if $host ne "" $]

The HostName is [+ $host +]

[$ else $]

[+ $fdat{IP_List} +] Did not Resolve !!!

[$ endif $] [$ endif $]
[- $dbh->disconnect -]