#!/usr/bin/perl # req-quote.cgi - handles online service requests $0="dsl-req.cgi"; $next="dsl-req2.cgi"; # host, urlpath, auth or subroutine, extra info regex, speeds, postdata, # hash of regexs by service, hash of substitutions, hash of adsl up speeds %PROVIDER=( 'Netrail/C' => ['dslqual.zyan.com', # prequal script location '/netrail/dsl.cgi', # authorization string 'bmV0cmFpbDpld2FtNDg1OA==', # extra information the provider gives us { 'Covad Wire Distance' => '([0-9.]+ miles \([0-9]+ feet\))', }, # available speeds (in case they just give us the maximum) '', # query string (GET type begins with '?') '?phone=%s%s%s&street=%s&city=%s&state=%s&zip=%s&&map=No&telco=Covad', # foreach service regex should return speed, type {'Business' => 'TeleSpeed ([0-9.]+)(\<)', 'Residential' => 'Tele(Surfer|Surfer Pro|Speed) (ADSL|144)', }, # fixup regex's for dsl types { '\<' => 'SDSL', '144' => 'IDSL', }, # maps adsl downspeeds to upspeeds {'608' => '128', '1500' => '384'}, # fixup regex's for dsl speeds { 'Surfer Pro' => '1500', 'Surfer' => '608', 'Speed' => '144', } ], 'Netrail/N' => ['dslqual.zyan.com', # prequal script location '/netrail/dsl.cgi', # authorization string 'bmV0cmFpbDpld2FtNDg1OA==', # extra information the provider gives us { 'NorthPoint Wire Distance' => '([0-9.]+ miles \([0-9]+ feet\))', }, # available speeds (in case they just give us the maximum) '', # query string (GET type begins with '?') '?phone=%s%s%s&street=%s&city=%s&state=%s&zip=%s&&map=No&telco=Covad', # foreach service regex should return speed, type {'Business' => '\([0-9.]+)(\<)', }, # fixup regex's for dsl types { '\<' => 'SDSL', }, # maps adsl downspeeds to upspeeds {}, # fixup regex's for dsl speeds {} ], ); # the following providers are excluded from the list foreach('Netrail/N') { delete $PROVIDER{$_}; } # This line prepares the server to parse HTML style output print "Content-type: text/html\n\n"; print ""; print join('',`cat $ENV{'DOCUMENT_ROOT'}/stdhdr.html`)."
";
# Get input from the form
if($ENV{'REQUEST_METHOD'} eq 'POST') {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
} else {
$buffer=$ENV{'QUERY_STRING'};
}
$buffer =~ s/\000//g;
# Split the buffer into name-value pairs
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
#if($FORM{'Service'} ne "" and !exists($PRICE{$FORM{'Service'}})) {
# print <
#EOF
# print join('',`cat $ENV{'DOCUMENT_ROOT'}/stdftr.html`);
# print "";
# exit;
#}
if(scalar keys %FORM < 2) {
print <
To determine if your location qualifies for $FORM{Service} DSL service and if so what levels of that service, please complete the following web-based form.
Note: Exact information is needed. If the phone number does not correspond to the street address provided, you will not get the proper results.
EOF
print join('',`cat $ENV{'DOCUMENT_ROOT'}/stdftr.html`);
print "$FORM{Service} DSL Pre-Qualification Form: