#!/usr/local/bin/perl5.16 $ocacode=$ENV{'FORM_ocacode'}; if ($ocacode eq "") { $ocacode="*"; } $ryear=$ENV{'FORM_ryear'}; $rbeds=$ENV{'FORM_rbeds'}; $rbaths=$ENV{'FORM_rbaths'}; $rperiod=$ENV{'FORM_rperiod'}; $rweeks=$ENV{'FORM_rweeks'}; $rprice=$ENV{'FORM_rprice'}; $rsort=$ENV{'FORM_rsort'}; $rday=$ENV{'FORM_rday'}; $uaddrno=$ENV{'FORM_uaddrno'}; $tab="yes"; $pid=$ENV{'PID'}; $sleeptime=$ENV{'SLEEPTIME'}; $id=$ENV{'FORM_id'}; $ipid=$ENV{'FORM_ipid'}; $output=$ENV{'FORM_output'}; $douni=$ENV{'FORM_douni'}; $newformat="no"; if ($output == "6") { $output=2; $newformat="yes"; } $newformat2="no"; if ($output == "7") { $output=2; $newformat="yes"; $newformat2="yes"; } if ($output == "8") { $newformat="yes"; $newformat2="yes"; } if ($output == "9") { $newformat="yes"; $newformat2="yes"; } $savefile=$ENV{'FORM_savefile'}; $unit=$ENV{'FORM_unit'}; $remloc=$ENV{'FORM_remloc'}; $total_fld_count=17; if ($douni == "yes") { $do_uni_cnt=1; } else { $do_uni_cnt=0; } @longtitles = ( 'Photo', 'Office', 'Property', 'Floor/Unit', 'City', 'Type', 'Limit', 'Bedrooms', 'Baths', 'Square Feet', 'Key #', 'Checkin Day', 'Checkin Date', 'Checkout Date', 'Price', 'Year'); @longpositions = (20,31,3,4,5,10,9,7,8,25,18,28,11,12,13,2); require "http-lib.pl"; $brokers=$ENV{'FORM_brokers'}; local($startTime); $startTime = time; @brokerfiles=("oc","si","av","br"); %brokernamehash=(); %brokerphonehash=(); for($i=0; $i<=3;++$i) { open(BFL,@brokerfiles[$i]); while () { chop; @BS=split('\|',$_); $brokernamehash{@BS[0]}=@BS[1]; $brokerphonehash{@BS[0]}=@BS[2]; # print $brokernamehash{@BS[0]}."-".$brokerphonehash{@BS[0]}."
"; } close(BFL); } %brokertypehash=(); %brokeroddhash=(); %brokerchathash=(); %brokernearhash=(); %nopayhash=(); open(BFL,"includes/brokers"); while () { chop; @BS=split('\|',$_); $brokertypehash{@BS[0]}=@BS[1]; $brokeroddhash{@BS[0]}=@BS[2]; $brokernearhash{@BS[0]}=@BS[3]; $brokerchathash{@BS[0]}=@BS[4]; $nopayhash{@BS[0]}=@BS[5]; if (@BS[4] eq "1") { open(CHATFILE,"includes/@BS[0].chat"); while () { chop; $brokerchatcmd{@BS[0]}=$_; } close(CHATFILE); } } close(BFL); $count=0; if ($savefile eq "") { open(FLPTR2,$brokers) || die "Can't open '$brokers'.\n" ; $fnames=0; while () { chop; @FN[$fnames]="$_"; ++$fnames; } close(FLPTR2); for ($f=0; $f < $fnames; ++$f) { # print "Doing @FN[$f] ...($sleeptime)
"; $fbroker=sprintf("tmp/%s.%d",$pid,($f+1)); # print "Doing @FN[$f] ($fbroker) ...
"; open(FLPTR3,$fbroker); $bcount=0; while() { chop; @S=split('\t',$_); if ($#S >= ($total_fld_count-1)) { ++$bcount; if ($rsort <= 1) { $price=@S[14]; $price=~s/\.00//; $address="@S[3]@S[4]"; $address=~s/[ ,-\.'\&]//g; $tmp=sprintf("%06d%s\t%d",$price,$address,$count); } else { $price=@S[14]; $price=~s/\.00//; $address="\L@S[3]"; @ADD=split(' ',$address); $number=sprintf("%06d",@ADD[0]); $tmpaddress="@ADD[1]"; $tmpaddress=~s/[ ,-\.'\&]//g; $tmpaddress=substr($tmpaddress,0,8); $floor="\L@S[4]"; $floor=~s/[ ,-\.'\&#]//g; $floor=substr($floor,0,1); $city="\L@S[5]"; $city=~s/[ ,-\.'\&]//g; $city=substr($city,0,8); $tmp=sprintf("%-8s%-8s%s%s%06d\t%d", $city, $tmpaddress,$number, $floor,$price, $count); } @SK[$count]="\L$tmp"; # unique properties ########################################### $address="\L@S[3]"; $address=~s/[ ,-\.'\&#]//g; $address=substr($address,0,8); $floor="\L@S[4]"; $floor=~s/[ ,-\.'\&#]//g; $floor=substr($floor,0,1); $city="\L@S[5]"; $city=~s/[ ,-\.'\&]//g; $city=substr($city,0,8); $last="\L@S[15]"; $last=~s/[ ,-\.'\&]//g; $last=substr($last,0,8); # $zip=substr(@S[16],0,5); $tmp=sprintf("%s%s%s%s",$address,$floor,$city,$last); $UNI[$count] = $tmp; # end uni ############################################ # @BIGF[$count] = "$_\t@FN[$f]"; $oneplus=$count+1; @BIGF[$count] = "$_\t$oneplus\t@FN[$f]"; ++$count; # print $count, "(", $#S, ")", " - $_
\n"; # end of total_fld_count } # end of while } @FB[$f]=$bcount; close(FLPTR3); # end of for } $saveout="> tmp/save.$pid"; open(SAVEOUT,"> tmp/save.$pid"); for ($i = 0; $i <= $#BIGF; ++$i) { print SAVEOUT @BIGF[$i], "\n"; } close(SAVEOUT); } # if savefile else { @UNIT=split(',',$unit); open(FLPTR2,$savefile) || die "Can't open '$savefile'.\n" ; $scount=0; while () { chop; @FN[$scount]=$_; ++$scount; } close(FLPTR2); $endk=$#UNIT; for ($k = 0; $k <= $endk; ++$k) { @BIGF[$count]= @FN[(@UNIT[$k]-1)]; @S=split('\t',@FN[(@UNIT[$k]-1)]); ####### - sort ++$bcount; if ($rsort <= 1) { $price=@S[14]; $price=~s/\.00//; $address="@S[3]@S[4]"; $address=~s/[ ,-\.'\&]//g; $tmp=sprintf("%06d%s\t%d",$price,$address,$count); } else { $price=@S[14]; $price=~s/\.00//; $address="\L@S[3]"; @ADD=split(' ',$address); $number=sprintf("%06d",@ADD[0]); $tmpaddress="@ADD[1]"; $tmpaddress=~s/[ ,-\.'\&]//g; $tmpaddress=substr($tmpaddress,0,8); $floor="\L@S[4]"; $floor=~s/[ ,-\.'\&#]//g; $floor=substr($floor,0,1); $city="\L@S[5]"; $city=~s/[ ,-\.'\&]//g; $city=substr($city,0,8); $tmp=sprintf("%-8s%-8s%s%s%06d\t%d", $city, $tmpaddress,$number, $floor,$price, $count); } @SK[$count]="\L$tmp"; ####### - end sort ++$count; } # for k } # else if ($rsort >= 2) { $rsort -= 2; } if ($count > 0) { # - saveout @SF=sort (@SK); # for ($i = 0; $i <= $#BIGF; ++$i) # { # print "
",@SF[$i],"
"; # } $checkimg=" "; if ($output < 3 && $newformat eq "no") { $checkimg="(\"Toggle check desired listings)"; } $bigfcount = $#BIGF + 1; if ($output == 5) { print "
Found $bigfcount records $checkimg.
Reference #: $ipid
Please click on the address for more details
.
\n"; } else { if ($output != 8 && $output != 9) { print "
Found $bigfcount records $checkimg.
Reference #: $ipid
Please click on the address for more details. NOTE!
(property links open in new window)
\n"; } if ($output == 9) { # print "Found $bigfcount records:\n"; print "Found $bigfcount records:\n"; } if ($newformat ne "yes") { open(FLL,'legendtop.html'); while () { print $_; } close(FLL); } } # rental property section #print " # # # # #
\n"; ################################# if ($output < 3 && $newformat eq "no") { print "
\n"; } if ($output == 3) { print "
\n"; if ($rsort == 1) { for ($i = $#BIGF; $i >= 0; --$i) { do unit(); } } else { for ($i = 0; $i <= $#BIGF; ++$i) { do unit(); } } print "
PropertyUnitCityTypeSleepsBedroomsBathsCheck-InCheck-outPrice

\n"; } elsif ($output == 4) { do table(); } elsif ($output == 8) { print "\n"; print "\n"; $ti=0; if ($rsort == 1) { for ($i = $#BIGF; $i >= 0; --$i) { if ($ti % 4 == 0) { print "\n"; } do unit(); if ($ti % 4 == 3) { print "\n"; } ++$ti; } } else { for ($i = 0; $i <= $#BIGF; ++$i) { if ($ti % 4 == 0) { print "\n"; } do unit(); if ($ti % 4 == 3) { print "\n"; } ++$ti; } } if ($ti % 4 != 0) { for ($i=$ti; ($i%4 != 0); ++$i) { print "\n"; } print "\n"; } print "
\n"; } elsif ($output == 9) { $ti=0; if ($rsort == 1) { for ($i = $#BIGF; $i >= 0; --$i) { if ($ti % 4 == 0) { print "
\n"; } do unit(); if ($ti % 4 == 3) { print "
\n"; } ++$ti; } } else { for ($i = 0; $i <= $#BIGF; ++$i) { if ($ti % 4 == 0) { print "
\n"; } do unit(); if ($ti % 4 == 3) { print "
\n"; } ++$ti; } } if ($ti % 4 != 0) { for ($i=$ti; ($i%4 != 0); ++$i) { print "
\n"; } print "\n"; } } elsif ($output == 5) { print "
\n"; $i_count=1; if ($rsort == 1) { for ($i = $#BIGF; $i >= 0; --$i) { if ($i_count < 10) { print "\ "; } if ($i_count < 100) { print "\ "; } print "$i_count. "; do unit(); ++$i_count; } } else { for ($i = 0; $i <= $#BIGF; ++$i) { print "$i_count. \n"; do unit(); ++$i_count; } } print "
\n"; } else { print "
    \n"; if ($rsort == 1) { for ($i = $#BIGF; $i >= 0; --$i) { do unit(); } } else { for ($i = 0; $i <= $#BIGF; ++$i) { do unit(); } } print "
\n"; } if ($output < 3 && $newformat eq "no") { print <<"HTML code"; Output as :


HTML code } } else { print "

Sorry no matches.

\n"; } if ($output != 5 && $output != 6 && $output != 8 && $output != 9 && $newformat eq "no") { open(LEGEND,"legend.html"); while() { print $_; } close(LEGEND); } local($totalTime) = (time - $startTime) + $sleeptime; if ($savefile eq "") { if ($output != 5 && $newformat2 eq "no") { if ($fnames == 1) { print "Searched \& compiled $fnames site in $totalTime seconds:
    \n"; } else { print "Searched \& compiled these $fnames sites in $totalTime seconds:
      \n"; } for ($fb=0; $fb < $fnames; ++$fb) { # this next line gives totals by office # print "
    1. @FN[$fb] (@FB[$fb])
      "; print "
    2. @FN[$fb]
      "; } print "
    \n"; } # advertising section #print "
#Advertise Here!"; #print "\n"; #for ($ai = 0; $ai <= 14; ++$ai) # { # print ""; # } #print "
"; # print "
\n"; # print "
\n"; #print "
\n" } # savefile not here sub table { $cellwidth=150; $width=$count * $cellwidth; print "
\n"; for ($kk= 0; $kk <= $#longtitles; ++$kk) { $vspacer=" "; if ($kk == 0) { $vspacer=""; } print "\n"; for ($jj = 0; $jj < $count; ++$jj) { @FLDS=split('\t',@BIGF[$jj]); $address="@FLDS[3]"; $address=~s/[ ,-\.'\&#]/+/g; $floor="@FLDS[4]"; $floor=~s/[ ,-\.'\&#]/+/g; $picurl="@FLDS[20]"; if (substr(@FLDS[20],0,4) ne "http") { $picurl="http://@FLDS[$#FLDS]@FLDS[20]"; } if ($kk == 0) { $image="@FLDS[@longpositions[$kk]]"; if (substr($image,0,5) ne "http:") { $image="http://@FLDS[@longpositions[1]]$image"; } print ""; } elsif ($kk == 1) { print ""; } elsif ($kk == 11) { $offset=@FLDS[@longpositions[$kk]]; if ($offset == 0) { $day="Saturday"; } elsif ($offset == 1) { $day="Sunday"; } elsif ($offset == -1) { $day="Friday"; } print ""; } else { print ""; } } print "\n"; } print "
@longtitles[$kk]$vspacer$vspacer
", "
@FLDS[@longpositions[$kk]]", $day, "", @FLDS[@longpositions[$kk]], "

\n"; } sub unit { @ST=split('\t',@SF[$i]); @FLDS=split('\t',@BIGF[@ST[1]]); $address="@FLDS[3]"; $address=~s/[ ,-\.'\&#]/+/g; $floor="@FLDS[4]"; $floor=~s/[ ,-\.'\&#]/+/g; $pic=" "; $picurl="@FLDS[20]"; $UUCODE="@FLDS[1]"; if (@FLDS[0] == "2190") { $UUCODE="@FLDS[18]"; } #print "\n$picurl\n========================================\n"; if (substr(@FLDS[20],0,5) ne "http:" && substr(@FLDS[20],0,6) ne "https:") { $picurl="http://@FLDS[$#FLDS]@FLDS[20]"; } #print "\n$picurl\n========================================\n"; $map=" "; $unitcheck=" "; if ($savefile ne "") { $unitcheck="CHECKED"; } # if (@FLDS[23] ne "") # { # $mapurl="@FLDS[23]"; # if (substr(@FLDS[23],0,5) ne "http:") # { # $mapurl="http://@FLDS[$#FLDS]@FLDS[23]"; # } # $map="\"user"; # } $padphoto=" "; if (@FLDS[21] > 0 && $newformat eq "no" ) { $padphoto="+(@FLDS[21])\n"; # $padphoto="+(@FLDS[21])"; } $beachtour=" "; if (@FLDS[22] ne "") { $beachtour="\"beach"; } $datebegin=@FLDS[11]; $events=" "; if ($datebegin ne "**/**/****") { $events="\"events"; } $property="@FLDS[3] @FLDS[4]-(@FLDS[18])-@FLDS[11]-@FLDS[12]-\$@FLDS[13]"; $property=~s/ / /g; $property=~s/[\.'\&#]//g; $property=~s/ /+/g; if ($output == 3) { print " @FLDS[3]\n"; print "@FLDS[4]  @FLDS[5]  @FLDS[10]  \n"; print "@FLDS[9]@FLDS[7]@FLDS[8]"; print "@FLDS[11]@FLDS[12]\$@FLDS[13]"; } elsif ($output == 8) { print "
\"$FLDS[3]\n
@FLDS[7]/@FLDS[8] - \$@FLDS[13]
\n"; } elsif ($output == 9) { $plus1=$ti+1; $oddeven="odd"; if ($plus1 % 2 == 0) { $oddeven="even"; } print "

$FLDS[3]

Key #: @FLDS[1] is \$@FLDS[13]
Sleeps @FLDS[9] with @FLDS[7] bedrooms and @FLDS[8] baths.
"; print "#$plus1 of $bigfcount"."
".$brokernamehash{@FLDS[$#FLDS]}." $ag_name ".$ag_phone."
\n"; print "
\"$FLDS[3]\"
\n"; } elsif ($output == 5) { $TMP_price=@FLDS[13]; $TMP_address=@FLDS[3]; if (length($TMP_address) > 20) { $TMP_address=substr($TMP_address,0,20); } print "\ \$$TMP_price - $TMP_address
\n"; } elsif ($output == 2) { if (substr(@FLDS[20],0,3) eq "htt") { $pic="\"@FLDS[3]"; } else { $pic="\"@FLDS[3]"; # $picurl="http://@FLDS[$#FLDS]@FLDS[20]"; } print "
  • \n"; # print "
    $pic \n"; print ""; if ($newformat ne "yes") { print " \n"; } print " @FLDS[3] @FLDS[4], @FLDS[5] is a @FLDS[10].
    \n"; # print " @FLDS[3] @FLDS[4], @FLDS[5] is a @FLDS[10].
    \n"; print "It sleeps @FLDS[9] with @FLDS[7] bedrooms and @FLDS[8] baths.
    \n"; print "Your request of @FLDS[11] to @FLDS[12] is \$@FLDS[13].
    \n"; print "\"photos\" $padphoto\n"; if ($newformat eq "no") { print $beachtour, $map, $events, "\n"; } # print "GOogle Map\n"; @AD=split(',',@FLDS[3]); $mapaddress=@AD[0].", ".@FLDS[5]." ".@FLDS[6]; $mapaddress=~s/ /+/g; $mapaddress=~s/[\.'\&#]//g; if ($newformat eq "no") { print "\"google\n"; print "\"walk\n"; if ($brokerchathash{"@FLDS[$#FLDS]"} eq "1" && $newformat eq "no") { # print "\"live\n"; $chatcmd=$brokerchatcmd{"@FLDS[$#FLDS]"}; print "\"live\n"; } } # deleted for monihan # print "\n"; if ($newformat eq "no") { print "\"contact\n"; } print "(@FLDS[$#FLDS]) \n"; if ($do_uni_cnt == 1) { do uni(); } if (@FLDS[32] ne "") { $ag_phone=@FLDS[32]; } else { $ag_phone=$brokerphonehash{@FLDS[$#FLDS]}; if ($brokerphonehash{@FLDS[$#FLDS]} eq "(800) 255-0998" && substr(@FLDS[1],0,1) eq "n") { $ag_phone="(800) 255-1311"; } } if ($#FLDS > 31) { $ag_name=@FLDS[31]; $ag_name=" - $ag_name"; } else { $ag_name=""; } print "
    \n Call - "; print $brokernamehash{@FLDS[$#FLDS]}." $ag_name @ ".$ag_phone."
    (Key #: ".@FLDS[1].")\n"; print "
    \n"; if ($newformat eq "no") { print "\n\n"; print "\n\n"; print "\n\n"; print "\n\n"; print "\n\n"; print "\n\n"; print "\n\n"; } } else { $feature_border=""; $feature_image=""; # if (-e "includes/@FLDS[$#FLDS]") if ($brokertypehash{"@FLDS[$#FLDS]"} eq "1") { # $feature_image=" $padphoto"; # $feature_image=" $padphoto"; $feature_image=" $padphoto"; } # print "
  • $pic \n"; if ($i%2 == 1) { $bgcolor="bbc2c4"; $bgcolor="cfcfcf"; } else { $bgcolor="e7e7e7"; } $item=$bigfcount-$i; # print "


  • \n
    \n"; print "

    \n\n"; print "\n"; #print "\n"; print "\n
    $item.\n"; print " \n"; # print "(here)"; if ($nopayhash{"@FLDS[$#FLDS]"} eq "1" && "jim" eq "ginn") { print "@FLDS[3] @FLDS[4], @FLDS[5] is a @FLDS[10].
    \n"; } else { $property="@FLDS[3] @FLDS[4]-(@FLDS[18])-@FLDS[11]-@FLDS[12]-\$@FLDS[13]"; $property=~s/ / /g; $property=~s/[\.'\&#]//g; $property=~s/ /+/g; $email_to=""; if (@FLDS[17] ne "") { if (index(@FLDS[12],"@") > 0) { $email_to=@FLDS[17]; } else { $split_url=@FLDS[$#FLDS]; @DOMAIN=split('\.',$split_url); if ($#DOMAIN == 1) { $email_to="@FLDS[17]\@$split_url"; } else { $email_to="@FLDS[17]\@@DOMAIN[1].@DOMAIN[2]"; } } } if ($#FLDS > 31) { $display_add=@FLDS[30]; } else { $display_add=@FLDS[3]; } # $URL="http://WeeklyRentals.com/dorunit.cgi?url=@FLDS[$#FLDS]&uokey=@FLDS[0]&uucode=@FLDS[1]&ryear=@FLDS[2]&dtbegin=@FLDS[11]&dtend=@FLDS[12]&price=@FLDS[13]&uakey=@FLDS[17]&uaddr=$address&ufloor=$floor&id=$id&uniqcode=@FLDS[18]&email=$email_to&ocacode=$ocacode"; $URL="http://WeeklyRentals.com/dorunit.cgi?url=@FLDS[$#FLDS]&uokey=@FLDS[0]&uucode=$UUCODE&ryear=@FLDS[2]&dtbegin=@FLDS[11]&dtend=@FLDS[12]&price=@FLDS[13]&uakey=@FLDS[17]&uaddr=$address&ufloor=$floor&id=$id&uniqcode=@FLDS[18]&email=$email_to&ocacode=$ocacode"; $TITLE="$display_add, @FLDS[5] @FLDS[6]"; $URL=~s/["']//g; $TITLE=~s/["']//g; # print " $display_add @FLDS[4]
    @FLDS[5], @FLDS[6]\n"; print " $display_add @FLDS[4]
    @FLDS[5], @FLDS[6]\n"; if (@FLDS[10] ne "") { print " is a @FLDS[10]."; } print "
    \n"; } print "It sleeps @FLDS[9] with @FLDS[7] bedrooms and @FLDS[8] baths.
    \n"; print "Your request of @FLDS[11] to @FLDS[12] is \$@FLDS[13].
    \n"; print "\"photos\" $padphoto\n"; print $beachtour, $map, $events, "\n"; @AD=split(',',@FLDS[3]); $mapaddress=@AD[0].", ".@FLDS[5]." ".@FLDS[6]; $mapaddress=~s/ /+/g; $mapaddress=~s/[\.'\&#]//g; # print "($mapaddress)"; print "\"google\n"; print "\"walk\n"; if ($brokernearhash{"@FLDS[$#FLDS]"} gt "1") { $tenantid=$brokernearhash{"@FLDS[$#FLDS]"}; print "\"nearby\n"; } # if ($brokertypehash{"@FLDS[$#FLDS]"} eq "1") { print "\"contact\n"; } # if ($brokeroddhash{"@FLDS[$#FLDS]"} eq "1" && "@FLDS[18]" ne "") # { # print "\"tell\n"; # } if ($brokerchathash{"@FLDS[$#FLDS]"} eq "1") { # print "\"live\n"; $chatcmd=$brokerchatcmd{"@FLDS[$#FLDS]"}; print "\"live\n"; } print "\n"; # print " \"Bookmark"; # print " \"TwitThis\""; print "(@FLDS[$#FLDS] - @FLDS[18]) "; if ($do_uni_cnt == 1) { do uni(); } print "
    $feature_image 

    \n"; print "\n\n"; print "\n\n"; print "\n\n"; print "\n\n"; print "\n\n"; print "\n\n"; print "\n\n"; #print "

    \n"; print "\n"; } } # unique properties ########################################### sub uni { $address="\L@FLDS[3]"; $address=~s/[ ,-\.'\&#]//g; $address=substr($address,0,8); $floor="\L@FLDS[4]"; $floor=~s/[ ,-\.'\&#]//g; $floor=substr($floor,0,1); $city="\L@FLDS[5]"; $city=~s/[ ,-\.'\&]//g; $city=substr($city,0,8); $last="\L@FLDS[15]"; $last=~s/[ ,-\.'\&]//g; $last=substr($last,0,8); # $zip=substr(@FLDS[16],0,5); $tmp=sprintf("%s%s%s%s",$address,$floor,$city,$last); $ucount=0; $unistring=""; for ($ui=0; $ui < $count; ++$ui) { if (@UNI[$ui] eq $tmp) { $otherunit=$ui + 1; $unistring="$unistring $otherunit"; ++$ucount; } } # $unistring=~s/ //; # $unistring=~s/ /,/g; $unistring=~s/ //; $unistring=~s/ /\&unit=/g; # @FLDS[$#FLDS-1] if ($ucount > 0) { # print "($ucount) \n"; print "($ucount) \n"; } } # end of uni #############################################################