#!/usr/bin/perl #------------------------------------------------------------------------------# #use CGI::Carp qw(carpout fatalsToBrowser); use cPanelUserConfig; use DBI; use CGI::Simple; #------------------------------------------------------------------------------# $DBHost="localhost"; $DBName="superdum_SPRDMPS_NET"; $DBUser="superdum_dbu"; $DBPass="r?q2]bs,5U6!-&R^cR"; $DBPort="3306"; #------------------------------------------------------------------------------# &dbconnect($DBName,$BHHost,$DBPort,$DBUser,$DBPass); #------------------------------------------------------------------------------# $cgi = CGI::Simple->new; foreach $key ($cgi->param) { $cgi = CGI::Simple->new; $FORM{$key}=$cgi->param($key); } print $cgi->header(); &hdr; print &bdy; &ftr; #------------------------------------------------------------------------------# sub bdy { my $DAT= "
";
my $QUERY="SELECT DISTINCT scscat,sccat FROM iMP_strongCat WHERE sccat='$n->{sccat}' GROUP BY scscat ORDER BY scscat";
$tth = $dbh->prepare($QUERY);
$tth->execute();
while (my $x = $tth->fetchrow_hashref) {
$DAT.="{sccat},1)."&sc=".enc($x->{scscat},1)."\" class=\"clnk\">$x->{scscat}
";
}
$tth->finish();
if ($SCCAT=~/^Pump/i) {
$DAT.="
";
}
if ($SCCAT=~/^Elec/i) {
$DAT.=" ";
}
$DAT.="
$GR
";
my $QUERY="SELECT DISTINCT scscat,sccat FROM iMP_strongCat WHERE sccat='".enc($FORM{gr},0)."' GROUP BY scscat ORDER BY scscat";
$sth = $dbh->prepare($QUERY);
$sth->execute();
my $i=0; my $j=0;
while (my $n = $sth->fetchrow_hashref) {
$i++;
$DAT.="{sccat},1)."&sc=".enc($n->{scscat},1)."\" class=\"clnk\">$n->{scscat}
";
}
$sth->finish();
$DAT.="
".enc($FORM{sc},0)." PARTS LIST
$n->{spart} | $n->{sdesc} |
"; } $DAT.=" "; return $DAT; } #------------------------------------------------------------------------------# sub enc { my $DAT=shift; my $OPT=shift; if ($OPT==1) { $DAT=~s/\s/+/g; $DAT=~s/\//%2F/g; $DAT=~s/\&\#39;/%27/g; $DAT=~s/\&/%26/g; } else { $DAT=~s/\+/\s/g; $DAT=~s/%2F/\//g; $DAT=~s/%27/\&\#39;/g; $DAT=~s/\'/\&\#39;/g; $DAT=~s/%26/\&/g; } return $DAT; } #------------------------------------------------------------------------------# sub hdr { print <