#!/usr/local/bin/perl5
##############################################################################
##############################################################################
# http://www.ci.rockville-centre.ny.us/cgi-bin/dsb2.pl?account=20606&searchword=000018248E
# Define Variables							     #
#$basedir = '../vhosts/rvc/work';
#-------------------------------------for redirect-------------------------
use CGI ;
use CGI::Carp qw/fatalsToBrowser/; 
use CGI qw(:standard);
#------------------------------------end for redirect----------------------
 $basedir = '/usr/home/poker/usr/local/etc/httpd/vhosts/rvc/work';
$baseurl = 'http://www.ci.rockville-centre.ny.us/work/';
$filetype = "a6789284.csv";
$myheader = "Account #,Meter #,Customer,Service Location,Amount Due,Due Date";
$myfields = "0,3,4,5";
# Done									     #
##############################################################################
#
# you can call using http://yoururl.com/cgi-bin/search_plus.pl?#searchword=whatever
# or using a form
###############################################################################
$ipaddress = $ENV{'REMOTE_ADDR'};
&ReadParse;
$searchword = uc($in{'meterno'});
$account = $in{'account'};
$token = $in{'token'};
	&fileprepare;

$in{'topmessa'} = '<font color="#FF0000">You have entered invalid account information!</font>';
$in{'topmessb'} = '<font color="#FF0000">';

if ( $in{'welcome'} eq "resident" )
{
$in{'topmessa'} = 'Welcome';
$in{'topmessb'} = '<font color="#000000">';
} 
if ($ENV{'HTTP_REFERER'} =~ /http:\/\/www.rvcny.us\/mayor.html/)   { $flagz = 1; }
if ($ENV{'HTTP_REFERER'} =~ /http:\/\/www.rvcny.us\/FAQ.html/)   { $flagz = 1; }
if ($ENV{'HTTP_REFERER'} =~ /http:\/\/www.rvcny.us\/getlink.htm/)   { $flagz = 1; }
if ($ENV{'HTTP_REFERER'} =~ /rvcny.us/)   { $flagz = 1; }
if ($ENV{'HTTP_REFERER'} =~ /rvcny.securesites.com/)   { $flagz = 1; }
if ($flagz != 1) { print redirect('https://rvcny.securesites.com/rvcbilling/billing.html');  }

##--- Time Lock-----------------
####------------------ Get Date --------------------------
#my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;
#$mon++;
#my $yyyy_mm_dd = sprintf( "%4d-%02d-%02d", $year+1900,$mon,$mday );
#my $timex = sprintf( "%02d:%02d:%02d", $hour,$min,$sec );
###=======================================================
#if ( $mon < 06 ) { print redirect('https://rvcny.securesites.com/rvcbilling/billpay.html');  }


##--- End Time Lock-------------

print "Content-type: text/html\n\n";
print "<html>\n";

##$varh = "";
##$varw = "";
##print "<".$varh."img src='../rvc/progress.gif' alt='Please Wait...'".$varw.">\n";
##$varh = "!--";
##$varw = "--";

# &CheckPass;
&GetHeaderMessage;
$countline = 0;
$foundline = 0;
## print "in $in ip address  $ipaddress \n ";


foreach $string1 (@strings)
{
$filename = $basedir."/".$string1;
$tempfile = $baseurl.$string1;
open(DATA,"$filename");
@lines = <DATA>;
close(DATA);

       foreach $line (@lines)	{
           @chline = split(/,/,$line); # ORIGINAL 062403
#mis use below------------                   
if (($ipaddress eq "24.185.166.215") and ($chline[0] eq $account)) { $temp1="1"; }
#-------------------------
           if (($chline[0] eq $account) and ($chline[1] eq $searchword) || ($temp1 eq "1") ) {
           
           	                 $countline += 1;	

#               if ($foundfile ne $tempfile){  
#                 # print "<p><pre><b><A HREF=$tempfile>$tempfile</A></b></pre>\n";
#	           $foundfile = $tempfile;
#                 $countline += 1;	
#                                           }	
          if ($countline eq 1) {

##print "searching for $searchword"; 
# $searchword =~tr/A-Z/a-z/;#convert to lower case

###print "Content-type: text/html\n\n";
###print "<html>\n";

print <<STPAGE;

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="encrypted" content="secure.ci.rockville-centre.ny.us">
<title>Billing Inquiry</title>
</head>
<body>
<table border="0" width="100%">
  <tr>
    <td width="11%"><img src="../sealrvc.jpg" width="74" height="62"
    alt="sealrvc.jpg (2146 bytes)"></td>
    <td width="45%"><img src="../rvclogo.jpg" width="367" height="39"
    alt="rvclogo.jpg (5848 bytes)"></td>
    <td width="44%"></td>
  </tr>
</table>
<table height="17">
<td height="13"><img src="../myAccount2.gif">&nbsp;&nbsp;<img src="../online_payment.png">
<td height="13">
</table>

STPAGE

#-----------------center page---------------------------

print "<div align='center'>";
print "  <center>";

#-------------------------------------------------------
                          @cdata = split(/,/,$myheader);
				  @cfields = split(/,/,$myfields);
	

                               } # end countline equal to 1

    if ($countline gt 0)       {
          #print "$line \n";
          $foundline += 1;
                          @cdata = split(/,/,$line);
                       foreach $element (@cfields){
                         $tempa = $cdata[$element];
                                                  } #end foreach
            }
      }

}

                               } # end countline greater than 0
          if ($foundline eq 1) {

#-----------------center page---------------------------
print "<div align='center'>";
print "  <center>";
#-----------------Start Insert--------------------------
if ( index($cdata[1],"W") > 0 ) { 
print "<table border='0' width='100%' bordercolor='#000080'>";
print "  <table border='0' width='100%'>";
print "    <tr>";
print "      <td width='100%' align='center' bgcolor='#ECF2FF' style='border: 1 solid #000080'><font face='MS Sans Serif' size='2'><b>Incorporated Village of Rockville Centre<br>";
print "Water Billing Inquiry - Current Balance<br>";
   } elsif ( index($cdata[1],"E") > 0 ) { 
print "<table border='0' width='100%' bordercolor='#000080'>";
print "  <table border='0' width='100%'>";
print "    <tr>";
print "      <td width='100%' align='center' bgcolor='#CCFFCC' style='border: 1 solid #000080'><font face='MS Sans Serif' size='2'><b>Incorporated Village of Rockville Centre<br>";
print "Electric Billing Inquiry - Current Balance<br>"; 
   } else  { 
print "<table border='0' width='100%' bordercolor='#000080'>";
print "  <table border='0' width='100%'>";
print "    <tr>";
print "      <td width='100%' align='center' bgcolor='#FFFFCC' style='border: 1 solid #000080'><font face='MS Sans Serif' size='2'><b>Incorporated Village of Rockville Centre<br>";
print "   Billing Inquiry - Current Balance<br>"; }

print "$vheader</b></font></td>";
print "    </tr>";
print "  </table>";
print "  <tr>";
print "    <td width='100%'>";
print "      <table border='0' width='100%' height='300'>";
print "        <tr>";
print "          <td width='26%' height='21'></td>";
print "          <td width='74%' height='21'></td>";
print "        </tr>";
print "        <tr>";
print "          <td width='26%' height='21' style='border-left: 1 solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><font face='Arial' size='2' color='#0000FF'><b>Account";
print "            Number</b></font></td>";
print "          <td width='74%' height='21' style='border-right-style: solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><b><font face='Arial' size='2' color='#000000'>$cdata[0]</font></b></td>";
print "        </tr>";
print "        <tr>";
print "          <td width='26%' height='21' style='border-left: 1 solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><font face='Arial' size='2' color='#0000FF'><b>Service";
print "            Location</b></font></td>";
print "          <td width='74%' height='21' style='border-right-style: solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><b><font face='Arial' size='2' color='#000000'>$cdata[3]</font></b></td>";
print "        </tr>";
print "        <tr>";
print "          <td width='26%' height='21' style='border-left: 1 solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><font face='Arial' size='2' color='#0000FF'><b>Account ";
print "Balance</b></font>";
$tempf = $cdata[4] / 100;
$tempa = "\$".sprintf("%6.2f",$tempf);
$tempp = sprintf("%6.2f",$tempf);
print "          <td width='74%' height='21' style='border-right-style: solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><b><font face='Arial' size='2' color='#000000'>$tempa</font></b></td>";
print "        </tr>";
print "        <tr>";
print "          <td width='26%' height='21' style='border-left: 1 solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><font face='Arial' size='2' color='#0000FF'><b>Due";
print "            Date</b></font>";
print "          <td width='74%' height='21' style='border-right-style: solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><b><font face='Arial' size='2' color='#000000'>$cdata[5]</font></b></td>";
print "        </tr>";
#----Leav- out a big space------
#print "        <tr>";
#print "          <td width='26%' height='21'></td>";
#print "          <td width='74%' height='21'></td>";
#print "        </tr>";
#-----EVO Payment------------------

print "        <tr>";
#print "          <td width='26%' height='21'>";
print "<td width='100%' height='21' colspan='2'>";

#--- Break out Last Name and First from billing field----------
my ($a,$b)=split(' ',reverse($cdata[2]),2); # reverse and split.  
$a = reverse($a); # reverse each piece. 
$b = reverse($b);
($a,$b) = ($b,$a); # swap a and b 
#print "$b";
#print "$a";


if ( index($cdata[1],"W") > 0 ) { 
print "<form name='form1' id='form1' action='https://www.xpress-pay.com/api/default.asp' method='post'>";
print "<input type='hidden' name='billtypepk_1' value='2116' />";
   } elsif ( index($cdata[1],"E") > 0 ) { 
print "<form name='form1' id='form1' action='https://www.xpress-pay.com/api/default.asp' method='post'>";
print "<input type='hidden' name='billtypepk_1' value='2117' />";
   } else  { 
print "<form name='form1' id='form1' action='https://www.xpress-pay.com/api/default.asp' method='post'>";
print "<input type='hidden' name='billtypepk_1' value='' />";
          }

print "<input type='hidden' name='locator1_1' value='$cdata[3]' />";
print "<input type='hidden' name='locator2_1' value='Account # $cdata[0]' />";
print "<input type='hidden' name='locator3_1' value='' />";
print "<input type='hidden' name='locator4_1' value='' />";
print "<input type='hidden' name='locator5_1' value='' />";
print "<input type='hidden' name='entityidentifier' value='$cdata[0]' />";
#print "<input type='hidden' name='billamount_1' value='$tempa' />";
print "<input type='hidden' name='interestamount_1' value='0' />";
print "<input type='hidden' name='billdate_1' value='$cdata[5]' />";
print "<input type='hidden' name='firstname' value='$a' />";
print "<input type='hidden' name='lastname' value='$b' />";
print "<input type='hidden' name='address1' value='$cdata[3]' />";
print "<input type='hidden' name='address2' value='' />";
print "<input type='hidden' name='city' value='ROCKVILLE CENTRE' />";
print "<input type='hidden' name='state' value='New York' />";
print "<input type='hidden' name='zip' value='11570' />";
print "<input type='hidden' name='phone' value='' />";
print "<input type='hidden' name='email' value='' />";
print "<input type='hidden' name='posturl' value='http://www.rvcny.us/it/postonline.page' />";
print "<input type='hidden' name='returnurl' value='http://www.rvcny.us/thankyou1.htm' />";
print "<input type='hidden' name='cancelurl' value='http://www.rvcny.us/cancel1.htm' />";
print "<input type='hidden' name='securitycode' value='qq\$678LL\@' />";



#print "          <td width='26%' height='21'><font face='Arial' size='1' color='#0000FF'>&nbsp;NOTE: If your utility service is subject to disconnection or is currently disconnected do not use Online Payment.<br>&nbsp;Please call the billing deaprtment at 516-678-9323.</font></td>";
#print "<font face='Arial' size='1' color='#0000FF'>&nbsp;NOTE: If your utility service is subject to disconnection or is currently disconnected do not use Online Payment.<br>&nbsp;Please call the billing deaprtment at 516-678-9323.</font>";
print "<font face='Arial' size='2'>";
print "To make a payment online, enter the amount you wish to pay here: \$";
print "</font>";
print "<input type='text' name='billamount_1' value='$tempp' size='9' />&nbsp;";


if ( index($cdata[1],"W") > 0 ) { 
		 	print "<input type='submit' value='PAY ONLINE' name='B1'>";
   } elsif ( index($cdata[1],"E") > 0 ) { 
		 	print "<input type='submit' value='PAY ONLINE' name='B1'>";
   } else  { 
		 	print "Note: This bill can not be paid online.";
          }


print "</form>";
print "</td>";
print "        </tr>";
#----------------------------------

#----Leav- out a big space------
#print "        <tr>";
#print "          <td width='26%' height='21'></td>";
#print "          <td width='74%' height='21'></td>";
#print "        </tr>";
if ($cdata[6] gt 0)       {
#   print "<br>";
   $tempf = $cdata[6] / 100;
   $tempa = "\$".sprintf("%6.2f",$tempf);
   print "\n";
   print "        <tr>";
   print "          <td width='26%' height='21' style='border-left: 1 solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><font face='Arial' size='2' color='#0000FF'><b>Last";
   print "            Payment Posted</b></font>";
   print "          <td width='74%' height='21' style='border-right-style: solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><b><font face='Arial' size='2' color='#000000'>$tempa</font></b></td>";
   print "        </tr>";
   print "        <tr>";
   print "          <td width='26%' height='21' style='border-left: 1 solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><font face='Arial' size='2' color='#0000FF'><b>Last";
   print "            Posted Date</b></font>";
   print "          <td width='74%' height='21' style='border-right-style: solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><b><font face='Arial' size='2' color='#000000'>$cdata[7]</font></b></td>";
   print "        </tr>";
                          } #end if cdata[6] gt 0

#-----Online Payments------------------
$kickme = "0";
$CSVFILE = '/usr/home/poker/usr/local/etc/httpd/vhosts/rvc/it/public.csv';

open(CSVFILE) or die("Could not open file.");
##open(DATA,'<',"$csvfile"); # < read only

###unlink($csvfile); # Remove Temp File

while (<CSVFILE>) {
#       foreach $line (<CSVFILE>)	{
					 $line = $_; #Eliminate memory hog
           @chline = split(/\|/,$line); # ORIGINAL 062403
           $searchword=$account;
           $findv = $chline[2];
           $findv =~tr/a-z/A-Z/; #convert to upper case
							if ( $findv eq $searchword )
                                        {
#print "<tr><td><font face='Arial' size='2' color='#0000FF'>Online Payments:</font></tr></td>";
#print "<tr><td>$chline[0]</tr></td>";

if ($kickme eq "0")
{
   print "        <tr>";
   print "          <td width='26%' height='21'><font face='Arial' size='2' color='#0000FF'><b><u><i>Online Payments</i></u>:</b></font></td>";
   print "          <td width='74%' height='21'></td>";
   print "        </tr>";

 print "<table border='0' width='95%'>";
 print "<tr> <td style='border-left: 1 solid; border-right-style: solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><font face='Arial' size='2' color='#0000FF'><b>Date</b></font></td><td style='border-right-style: solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><font face='Arial' size='2' color='#0000FF'><b>Payment Method</b></font></td><td style='border-right-style: solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><font face='Arial' size='2' color='#0000FF'><b>Bill Amount Paid</b></font></td><td style='border-right-style: solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><font face='Arial' size='2' color='#0000FF'><b>Site Fee</b></font></td><td style='border-right-style: solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><font face='Arial' size='2' color='#0000FF'><b>Total Paid</b></font></td> </tr>";
 $kickme = "1";
}
$temp3 = sprintf("%-8.2f\n\n", $chline[3]);
$temp5 = sprintf("%-8.2f\n\n", $chline[5]);
$temp6 = sprintf("%-8.2f\n\n", $chline[6]);

$dispdt1 = substr $chline[0], 5, 2;
$dispdt2 = substr $chline[0], 8, 2;
$dispdt3 = substr $chline[0], 2, 2;
$dispdt4 = substr $chline[0], 11, 8;
$dispf   = $dispdt1."/".$dispdt2;
$dispf = $dispf."/".$dispdt3;
$dispf = $dispf." ".$dispdt4;

print "<tr> <td style='border-left: 1 solid; border-right-style: solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><font face='Arial' size='2' color='#000000'>$dispf</font></td><td style='border-right-style: solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><font face='Arial' size='2' color='#000000'>$chline[1]</font></td><td style='border-right-style: solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><font face='Arial' size='2' color='#000000'>$temp3</font></td><td style='border-right-style: solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><font face='Arial' size='2' color='#000000'>$temp5</font></td><td style='border-right-style: solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1'><font face='Arial' size='2' color='#000000'>$temp6</font></td> </tr>";
                                        }
      chomp($line);
      $line = ();
      }
## BOTTOM TOTAL LINE

close(CSVFILE);
if ($kickme eq "1") { print "</table>"; }
#-----Online Payments END--------------

print "      </table>";
print "    </td>";
print "  </tr>";
print "  <table border='0' width='100%'>";
print "    <tr>";
print "      <td width='100%'><font face='Arial' size='1'>NOTE: Payments that do not clear may be subject to penalties.";
print "       </font></td>";
print "    </tr>";

print "  </table>";
print "</table>";

#-------------------End Insert--------------------------
print "</center>";
print "</div>";

print "</body>";
print "</html>";
#----------------------------------------------------------------------------------
                                } # end foundline eq1
if ($foundline ne 1) {
#---------------Start Billing Error Page-------------------------------------------
print <<STPAGE2;

<head>
<title>Village of Rockville Centre Billing Inquiry</title>
<script>
function checkKP() {
if ((event.keyCode == 17) || (event.keyCode == 122) || (event.keyCode == 78))
   {  event.returnValue = false;
      event.keyCode=0;
   }
}
</script>
<script language="JavaScript">
<!--
defaultStatus = ""
browserName = navigator.appName
browserVer = parseInt(navigator.appVersion)
flag = 0;
if (((browserName=="Netscape") && (browserVer >= 3)) || ((browserName=="Microsoft Internet Explorer") && (browserVer >= 4)))
flag=1;
function newWin() {
myWindow=window.open("https://rvcny.securesites.com/rvcbilling/billing_info.htm",null,"width=635,height=280") //550 410
}
// -->
</script>
<STYLE>FORM {
	MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
.title {
	FONT-WEIGHT: bold; FONT-SIZE: 15px; COLOR: #ffaa00; LINE-HEIGHT: 17px; FONT-FAMILY: verdana, arial, helvetica
}
TD {
	FONT-SIZE: 8pt; FONT-FAMILY: Verdana, arial, helvetica; fontSize: 8pt
}
BODY {
	MARGIN-LEFT: 12px; MARGIN-RIGHT: 0px
}
.services {
	FONT-SIZE: xx-small; COLOR: #201460; FONT-FAMILY: Verdana, arial, helvetica; TEXT-DECORATION: none; fontSize: 8pt
}
.leftnav {
	FONT-SIZE: xx-small; COLOR: #201460; FONT-FAMILY: Verdana, arial, helvetica; TEXT-DECORATION: none; fontSize: 8pt
}
.rightnav {
	FONT-SIZE: xx-small; COLOR: #201460; FONT-FAMILY: Verdana, arial, helvetica; TEXT-DECORATION: none; fontSize: 8pt
}
.footer {
	FONT-SIZE: xx-small; COLOR: #201460; FONT-FAMILY: Verdana, arial, helvetica; TEXT-DECORATION: none; fontSize: 8pt
}
.searchbar {
	FONT-SIZE: x-small; COLOR: #9b0000; FONT-FAMILY: Verdana, arial, helvetica; fontSize: 10pt
}
.searchbarlinks {
	FONT-WEIGHT: bold; FONT-SIZE: xx-small; COLOR: #201460; FONT-FAMILY: Verdana, arial, helvetica; TEXT-DECORATION: none; fontSize: 8pt
}
.channels {
	FONT-SIZE: xx-small; COLOR: #ffffff; FONT-FAMILY: Verdana, arial, helvetica; TEXT-DECORATION: none; fontSize: 8pt
}
.leftnavtitle {
	FONT-WEIGHT: bold; FONT-SIZE: xx-small; COLOR: #ffffff; FONT-FAMILY: Verdana, arial, helvetica; TEXT-DECORATION: none; fontSize: 8pt
}
.subchanneltitle {
	FONT-WEIGHT: bold; FONT-SIZE: xx-small; COLOR: #ffffff; FONT-FAMILY: Verdana, arial, helvetica; TEXT-DECORATION: none; fontSize: 8pt
}
.rightnavtitle {
	FONT-WEIGHT: bold; FONT-SIZE: xx-small; COLOR: #ffffff; FONT-FAMILY: Verdana, arial, helvetica; TEXT-DECORATION: none; fontSize: 8pt
}
.footertitle {
	FONT-WEIGHT: bold; FONT-SIZE: xx-small; COLOR: #ffffff; FONT-FAMILY: Verdana, arial, helvetica; TEXT-DECORATION: none; fontSize: 8pt
}
.baselight {
	BACKGROUND-COLOR: #ebe2f7; TEXT-DECORATION: none; backgroundColor: #EBE2F7
}
.baselightflat {
	BACKGROUND-COLOR: #ebe2f7
}
.basedark {
	BACKGROUND-COLOR: #612b83; TEXT-DECORATION: none
}
.basemid {
	BACKGROUND-COLOR: #612b83; TEXT-DECORATION: none
}
.tendark {
	BACKGROUND-COLOR: #dfd7ef; backgroundColor: #DFD7EF
}
.navtendark {
	BACKGROUND-COLOR: #dfd7ef; backgroundColor: #DFD7EF
}
.tenlight {
	BACKGROUND-COLOR: #b7a2d0; backgroundColor: #B7A2D0
}
.navtenlight {
	BACKGROUND-COLOR: #b7a2d0; backgroundColor: #B7A2D0
}
.rightnavbar {
	PADDING-RIGHT: 6px; BORDER-TOP: #9a9999 2px solid; PADDING-LEFT: 6px; PADDING-BOTTOM: 6px; PADDING-TOP: 6px; BORDER-BOTTOM: #9a9999 2px solid; BACKGROUND-COLOR: #dedede; backgroundcolor: #DEDEDE
}
.detailsbox {
	PADDING-RIGHT: 4px; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; PADDING-TOP: 4px; BACKGROUND-COLOR: #ecf2ff; backgroundcolor: #ECF2FF
}
.titlebox {
	PADDING-RIGHT: 4px; PADDING-LEFT: 4px; PADDING-BOTTOM: 4px; PADDING-TOP: 4px; BACKGROUND-COLOR: #ffcc66; backgroundcolor: #FFCC66
}
.helplnk {
	FONT-SIZE: 7pt; COLOR: #0033cc; TEXT-DECORATION: none
}
.helplnks {
	LINE-HEIGHT: 20px
}
.red {
	COLOR: #ff0000
}
.purp {
	COLOR: #663399
}
.small {
	FONT-SIZE: 7pt
}
.leftnavhd {
	FONT-SIZE: xx-small; COLOR: #632984; TEXT-DECORATION: none
}
.leftnavlrg {
	FONT-SIZE: 8pt; COLOR: #201460; FONT-FAMILY: Verdana, arial, helvetica; TEXT-DECORATION: none; fontSize: 8pt
}
.leftlink {
	FONT-WEIGHT: bold; FONT-SIZE: xx-small; COLOR: #211563; FONT-FAMILY: Verdana, arial, helvetica; TEXT-DECORATION: none; fontSize: 8pt
}
.btendark {
	BACKGROUND-COLOR: #632a84; TEXT-DECORATION: none
}
.footerCopy {
	FONT-WEIGHT: bold; COLOR: #000000; FONT-FAMILY: Verdana, arial, helvetica; TEXT-DECORATION: none; fontSize: 8pt
}
.nvhd A {
	PADDING-RIGHT: 0px; DISPLAY: block; PADDING-LEFT: 0px; PADDING-BOTTOM: 3px; COLOR: #632984; PADDING-TOP: 3px
}
.nvhd A:visited {
	PADDING-RIGHT: 0px; DISPLAY: block; PADDING-LEFT: 0px; PADDING-BOTTOM: 3px; COLOR: #632984; PADDING-TOP: 3px
}
.nvhd A:hover {
	COLOR: #ff0000
}
.nvlight A {
	PADDING-RIGHT: 0px; DISPLAY: block; PADDING-LEFT: 0px; PADDING-BOTTOM: 3px; COLOR: #632984; PADDING-TOP: 3px; BACKGROUND-COLOR: #b7a2d0
}
.nvlight A:visited {
	PADDING-RIGHT: 0px; DISPLAY: block; PADDING-LEFT: 0px; PADDING-BOTTOM: 3px; COLOR: #632984; PADDING-TOP: 3px; BACKGROUND-COLOR: #b7a2d0
}
.nvlight A:hover {
	COLOR: #ff0000
}
.nvdark {
	BACKGROUND-COLOR: #dfd7ef
}
.nvdark2 {
	BACKGROUND-COLOR: #dfd7ef
}
.nvdark A {
	PADDING-RIGHT: 0px; DISPLAY: block; PADDING-LEFT: 0px; PADDING-BOTTOM: 3px; COLOR: #211563; PADDING-TOP: 3px
}
.nvdark A:visited {
	PADDING-RIGHT: 0px; DISPLAY: block; PADDING-LEFT: 0px; PADDING-BOTTOM: 3px; COLOR: #211563; PADDING-TOP: 3px
}
.nvdark2 A {
	PADDING-RIGHT: 0px; DISPLAY: block; PADDING-LEFT: 0px; PADDING-BOTTOM: 3px; COLOR: #211563; PADDING-TOP: 3px
}
.nvdark2 A:visited {
	PADDING-RIGHT: 0px; DISPLAY: block; PADDING-LEFT: 0px; PADDING-BOTTOM: 3px; COLOR: #211563; PADDING-TOP: 3px
}
.nvdark A:hover {
	COLOR: #ff0000; BACKGROUND-COLOR: #b7a2d0
}
.nvdark2 A:hover {
	COLOR: #ff0000; BACKGROUND-COLOR: #b7a2d0
}
.nvtext {
	PADDING-LEFT: 2px; FONT-WEIGHT: bold; FONT-SIZE: 10px
}
.nvicon {
	VERTICAL-ALIGN: middle
}
.nvwrapper A {
	WIDTH: 100%; TEXT-DECORATION: none
}
</STYLE>


</head>


<body onkeydown="checkKP()">
<script language="JavaScript">
//if ((document.body.offsetWidth != 939) || (document.body.offsetHeight != 614))
<!--
if (document.referrer.indexOf('ny.us') > -1)
    flag2 = 1;
//else
//    window.location="index.html";
//-->
</script>
<!-- Start Code-->
<style>
<!--
.hide { position:absolute; visibility:hidden; }
.show { position:absolute; visibility:visible; }
-->
</style>

<SCRIPT LANGUAGE="JavaScript">

var duration=3 // Specify duration of progress bar in seconds
var _progressWidth = 50;	// Display width of progress bar

//var _progressBar = new String("");
var _progressBar = new String("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
var _progressEnd = 10;
var _progressAt = 0;


// Create and display the progress dialog.
// end: The number of steps to completion
function ProgressCreate(end) {
	// Initialize state variables
	_progressEnd = end;
	_progressAt = 0;

	// Move layer to center of window to show
	if (document.all) {	// Internet Explorer
		progress.className = 'show';
		progress.style.left = (document.body.clientWidth/2) - (progress.offsetWidth/2);
		progress.style.top = document.body.scrollTop+(document.body.clientHeight/2) - (progress.offsetHeight/2);
	} else if (document.layers) {	// Netscape
		document.progress.visibility = true;
		document.progress.left = (window.innerWidth/2) - 100;
		document.progress.top = pageYOffset+(window.innerHeight/2) - 40;
	} else if (document.getElementById) {	// Netscape 6+
		document.getElementById("progress").className = 'show';
		document.getElementById("progress").style.left = (window.innerWidth/2)- 100;
		document.getElementById("progress").style.top = pageYOffset+(window.innerHeight/2) - 40;
	}

	ProgressUpdate();	// Initialize bar
}

// Hide the progress layer
function ProgressDestroy() {
	// Move off screen to hide
	if (document.all) {	// Internet Explorer
		progress.className = 'hide';
	} else if (document.layers) {	// Netscape
		document.progress.visibility = false;
	} else if (document.getElementById) {	// Netscape 6+
		document.getElementById("progress").className = 'hide';
	}
}

// Increment the progress dialog one step
function ProgressStepIt() {
	_progressAt++;
	if(_progressAt > _progressEnd) _progressAt = _progressAt % _progressEnd;
	ProgressUpdate();
}

// Update the progress dialog with the current state
function ProgressUpdate() {
	var n = (_progressWidth / _progressEnd) * _progressAt;
	if (document.all) {	// Internet Explorer
		var bar = dialog.bar;
 	} else if (document.layers) {	// Netscape
		var bar = document.layers["progress"].document.forms["dialog"].bar;
		n = n * 0.55;	// characters are larger
	} else if (document.getElementById){
                var bar=document.dialog.bar
        }
	var temp = _progressBar.substring(0, n);
	bar.value = temp;
}

// Demonstrate a use of the progress dialog.
function Demo() {
	ProgressCreate(10);
	window.setTimeout("Click()", 100);
}

function Click() {
	if(_progressAt >= _progressEnd) {
		ProgressDestroy();
		return;
	}
	ProgressStepIt();
	window.setTimeout("Click()", (duration-1)*1000/10);
}

function CallJS(jsStr) { //v2.0

	if(document.forms[1].elements["account"].value == "") {
		alert('You must enter a valid account number!');
		return false;
	}
//	if(document.forms[1].elements["meterno"].value == "") {
//		alert('You must enter a valid meter number!');
//		return false;
//	}

  return eval(jsStr)
}

</script>

<SCRIPT LANGUAGE="JavaScript">

// Create layer for progress dialog
document.write('<span id=\"progress\" class=\"hide\">');
	document.write("<FORM name=dialog>");
	document.write('<TABLE border=2  bgcolor=\"#ECF2FF\">');
	document.write('<TR><TD ALIGN=\"center\">');
	document.write("Please Wait...<BR>");
	document.write('<input type=text name=\"bar\" size=\"" + _progressWidth/2 + "\" style=\"color: #3399FF; font-family: Wingdings\"');
	if(document.all||document.getElementById) 	// Microsoft, NS6
		document.write(' bar.style=\"color:navy;\">');
	else	// Netscape
		document.write(">");
	document.write("</TD></TR>");
	document.write("</TABLE>");
	document.write("</FORM>");
document.write("</span>");
ProgressDestroy();	// Hides

</script>
<!-- End Code-->
<script language=JavaScript>
<!--
var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
// --> 
</script>
<table border="0" width="100%">
  <tr>
    <td width="11%"><img src="../sealrvc.jpg" width="74" height="62"
    alt="xsealrvc.jpg (2146 bytes)"></td>
    <td width="45%"><img src="../rvclogob.gif" width="367" height="39"
    alt="rvc logo"></td>
    <td width="44%"></td>
  </tr>
</table>
<table height="17" width="755">
<td height="13" width="348"><img src="../myAccount2.gif">&nbsp;&nbsp;<img src="../online_payment.png">
<td height="13" width="593" align="right">
<font face="arial, helvetica" color="#c41627" size="2"><b><u>Payment Information</u></b></font>
</table>
<div align="left">

<table width="870">
<td width="497">
<TABLE cellSpacing=0 cellPadding=0 width=497 border=0 height="644">
  <TR>
    <TD class=contentcol vAlign=top width=173 rowSpan=2 height="644">
      <TABLE class=detailsbox cellSpacing=0 cellPadding=0 width="460" 
        border=1><TBODY>
        <TR>
          <TD vAlign=top width="458"><B>$in{'topmessa'} - <font color="#FF0000">SUPERVISOR MODE</font></B><BR><BR>
            The "Online Bill Pay" area gives you the ability to make an electric or water bill payment online or view your Electric or
            Water Billing accounts. <BR>

<table border="0" cellSpacing=0 cellPadding=0>
	<tr>
		<td>Pay your electric or water bill online using a credit card or checking account.
		</td>
	</tr>
</table>


            <BR><SPAN class=small><b>Your
            Account Number:</b><BR>$in{'topmessb'}Only electric or water customers with service provided by the
            Incorporated Village of Rockville Centre may view their
            current balance</font>. Each account has a unique Account Number.&nbsp;</SPAN> <BR><SPAN class=small><B><br>
            Your Meter Serial Number:</B> <BR>This is 10 characters long and
            should start with a NUMBER and END with a LETTER. It only contains
            numbers and letters (0-9 A-Z).&nbsp;<a href="javascript:newWin()">Where
            is my Meter Serial Number</a>? <BR></SPAN><BR>
          </TD></TR>
        <TR>
          <TD vAlign=top width="458"><font face=verdana size=2>
<form ONSUBMIT="return CallJS('Demo()')" action='https://rvcny.securesites.com/billing/online3' method=post>
<p>Enter Account Number</font><font face="verdana" size="1">&nbsp;&nbsp; </font><font face=verdana size=2><input type="text" name="account" size="20"><br>
Enter Meter Number&nbsp;&nbsp;&nbsp; &nbsp;</font><font face="verdana" size="1">&nbsp;</font><font face=verdana size=2><input type="password" name="meterno" size="20">
<input type="submit" value="Submit" name="B1" style="font-weight: bold">
<input type="reset" value="Reset" name="B2">
<br>
&nbsp;
<input type='hidden' value='ssh' name='cypher'>
</p></form>

</font></TD></TR></TBODY></TABLE>
    </TD>
  </TR>
</TABLE>
<td width="359" valign="top"> <font face="arial, helvetica" color="#c41627" size="2"><b>Terms
  for payment</b></font><br>
  <font face="arial, helvetica" color="#000088" size="2">In order for the
  Village to continue to provide its customers with the lowest possible rates,
  we seek your cooperation in remitting payments within 15 days after you receive
  your bill. <i>Failure to make payment by the Due Date will place your account
  in arrears and subject to further action</i>.<br>
Questions - Call the Billing Department (516) 678-9323 between the hours of 8:00 A.M. - 3:30 P.M. Monday through Friday.
  <br>
  <br>
  </font>
  <b><font face="arial, helvetica" color="#c41627" size="2">Pay Online</font></b><font face="arial, helvetica" color="#000088" size="2">
  <br>
  Please fill in your account number and meter number in the appropriate fields and follow the directions provided.
  <br>If you do not wish to pay online, you may continue to pay by mail or in person.
  </font>
  <br><br>
  <b><font face="arial, helvetica" color="#c41627" size="2">Pay By Mail</font></b><font face="arial, helvetica" color="#000088" size="2"><br>
  Please write your account number on your check. Make your check payable to:
  Incorporated Village of Rockville Centre.&nbsp; Mail the top portion of your
  bill and check in the window envelope that came with your bill. (Do not mail
  cash.)&nbsp;<br>
  Mail payments to:
  <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Inc.
  Village of Rockville Centre<br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Att:
  Cashiers Office<br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;P.O.
  Box 950<br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rockville
  Centre, NY 11571-0950
  <p>When mailing your bill stub and check, use the courtesy reply envelope
  provided with your bill.
  <p></font><b><font face="arial, helvetica" color="#c41627" size="2">Pay In
  Person</font></b><font face="arial, helvetica" color="#000088" size="2"><font face="arial, helvetica" color="#c41627" size="2"><br>
  </font></font><font face="Arial, Helvetica" color="#000088" size="2">Please
  bring in your entire bill with you. You may pay your bill at:&nbsp; Customer
  Service Counter, Municipal Building, 1 College Place, Rockville Centre, N.Y.
  between the hours of 8:00 A.M. - 3:00 P.M. Monday through Friday. After 3:00
  P.M. use the mail slot by Customer Service Counter or Village Hall mail drop
  located near front door of Municipal Building (24 hours a day).</font><font face="arial, helvetica" color="#000088" size="2">
  <p>&nbsp;</p>
  </font>
  <p>&nbsp;
</table>
</div>
<p><br>
&nbsp;
</body></html>

STPAGE2
#---------------End Billing Error Page---------------------------------------------
#  $replyurl="printenv";
#  print "Location:$replyurl\n\n";

####print redirect('onlinena');
###print redirect('https://poker.securesites.com/rvc/billingerror.html');
##  print "Content-type: text/html\n\n";
##  print "<html>$replyurl</html>\n";


exit( 0 ); 
                     }



sub fileprepare{
chdir($basedir);
$pwd=`pwd`;
$filedir = `ls $filetype`;
@strings = split(" ",$filedir);

}

### Read all the form data into the associative array %in
### Return true if form data was present, 0 if not
sub ReadParse {
  local (*in) = @_ if @_;
  local ($i, $key, $val);

  if ( $ENV{'REQUEST_METHOD'} eq "GET" ) { # replaced his MethGet function
    $in = $ENV{'QUERY_STRING'};
  } elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
    read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
  }

  @in = split(/&/,$in);

  foreach $i (0 .. $#in) {
    # Convert plus's to spaces
    $in[$i] =~ s/\+/ /g;

    # Split into key and value.
    ($key, $val) = split(/=/,$in[$i],2); # splits on the first =.

    # Convert %XX from hex numbers to alphanumeric
    $key =~ s/%(..)/pack("c",hex($1))/ge;       
    $val =~ s/%(..)/pack("c",hex($1))/ge;

    # Associate key and value
    $in{$key} .= "\0" if (defined($in{$key})); # \0 is the multiple separator
    $in{$key} .= $val;
  }
  return length($in);
}   
sub CheckPass {

$filename2 = $basedir."/test1.pwd";
open(DATA,$filename2);   
@lines = <DATA>;
close(DATA);
$xx="bad";
       foreach $line (@lines)                {
           @chline = split(/,/,$line);
          # $xx=$chline[1];
          $xx=$token;
           if (($chline[0] eq $account) and ($chline[1] eq $token)) {
                   $xx="good";

          #print "$line \n";
          $foundline += 1;
                          @cdata = split(/,/,$line);
            }
                                             }           
return $xx;
}
sub GetHeaderMessage {

$filename3 = $basedir."/header.txt";
open(DATA,$filename3);   
@lines = <DATA>;
close(DATA);
$vheader="Data does NOT reflect current information at this time.";
       foreach $line (@lines)                {
           @chline = split(/,/,$line);
          # $xx=$chline[1];
          $vheader="Reflects entries as of ".$chline[0];
          $foundline += 1;
                                             }           
return $vheader;
}

</pre>


