#!/bin/sh
SLEEPTIME=10
export SLEEPTIME
CGI=/opt/cern_httpd/bin/cgiparse
# $CGI -init
$CGI -form > /tmp/es.$$
. /tmp/es.$$
rm /tmp/es.$$
echo "Set-Cookie:BROKER=$FORM_broker;domain=.$SERVER_NAME"
echo "Set-Cookie:RPERIOD=$FORM_rperiod;domain=.$SERVER_NAME"
echo "Set-Cookie:RPRICE=$FORM_rprice;domain=.$SERVER_NAME"
echo "Set-Cookie:RWEEKS=$FORM_rweeks;domain=.$SERVER_NAME"
echo "Set-Cookie:RBEDS=$FORM_rbeds;domain=.$SERVER_NAME"
echo "Set-Cookie:RBATHS=$FORM_rbaths;domain=.$SERVER_NAME"
if test "$FORM_reset"
then
echo "Set-Cookie:BROKER=;domain=.$SERVER_NAME"
echo "Content-type: text/html
Location: http://$SERVER_NAME/doform.cgi
"
exit
fi
umask 0
# exec > /tmp/rentlog 2>&1; set -x
. /etc/profile.real
ATBACCOUNT="a6000034"
export ATBACCOUNT
if test "$FORM_sponsor"
then rand=$FORM_sponsor
else
rand=`random 5`
fi
export REMOTE_ADDR REMOTE_HOST
today=`date +%Y%m%d`
if test ! -d "logs/$today"
then mkdir "logs/$today"
fi
echo "$today|`date +%H:%M`|$REMOTE_ADDR|$REMOTE_HOST|$QUERY_STRING|$rand|$SERVER_NAME" >> logs/$today/s.txt
echo "Content-type: text/html
"
if test "$FORM_sleeptime"
then SLEEPTIME=$FORM_sleeptime
fi
export FORM_ryear
export FORM_rbeds
export FORM_rbaths
export FORM_rperiod
export FORM_rday
export FORM_rprice
export FORM_rsort
export FORM_rweeks
export FORM_uaddrno
export FORM_id
export FORM_output
export FORM_unit
export FORM_savefile
export FORM_remloc
export FORM_pid
if test "$FORM_pid"
then PID="$FORM_pid"
export PID
fi
if test "$FORM_rperiod" = "pick"
then FORM_rperiod="none"
fi
if test "$FORM_rprice" = "pick"
then FORM_rprice="all"
fi
FORM_uaddrno="`echo $FORM_uaddrno | sed -e 's/ /+/g'`"
RYEAR=$FORM_ryear
ID=$FORM_id
export RYEAR ID
ATBACCOUNT="a6000247"
ATBAREA="cmnj"
export ATBACCOUNT ATBAREA
ginnmerge -t ./head
if test "$FORM_savefile"
then
echo "Compiling all request...
"
./perl.all
ginnmerge -t ./foot
exit
fi
echo "$FORM_broker" | perl.comma > /tmp/broker.$$
FORM_brokers=/tmp/broker.$$
export FORM_brokers
RWEEKS="$FORM_rweeks"
RPERIOD="$FORM_rperiod"
export RWEEKS RPERIOD
line=1
count=`cat /tmp/broker.$$ | wc -l`
if test "$FORM_output" != "5"
then
echo "Making $count site requests ... "
echo "Waiting $SLEEPTIME seconds for results ... "
fi
while test $line -le $count
do
broker=`sed -n -e ${line}p /tmp/broker.$$`
export broker
# echo "($broker) ..."
# ./perl.get1 > tmp/$$.$line & 2> /dev/null
# ./perl.get1 > tmp/$$.$line 2> /dev/null &
# added for brokers who no telnet access
########################################
BEACH="$FORM_beach"
if test -r "includes/beach/$broker" -a "$FORM_beach" = "yes"
then
BEACH="`cat includes/beach/$broker`"
fi
curl "http://$broker/cgi-bin/RENTSEARCH?ryear=$FORM_ryear&beach=$BEACH&broker=$broker&rprice=$FORM_rprice&rbeds=$FORM_rbeds&rbaths=$FORM_rbaths&rperiod=$FORM_rperiod&rweeks=$FORM_rweeks&rday=$FORM_rday&which=week&uaddrno=$FORM_uaddrno&tab=yes" > tmp/$$.$line 2> /dev/null &
# echo "http://$broker/cgi-bin/RENTSEARCH?ryear=$FORM_ryear&rprice=$FORM_rprice&rbeds=$FORM_rbeds&rbaths=$FORM_rbaths&rperiod=$FORM_rperiod&rweeks=$FORM_rweeks&rday=$FORM_rday&which=week&uaddrno=$FORM_uaddrno&tab=yes" "> tmp/$$.$line 2> /dev/null &"
echo "$!" >> tmp/$$.all
line=`expr $line + 1`
done
sleep $SLEEPTIME
PID="$$"
export PID
if test "$FORM_output" != "5"
then
echo "Compiling all request ... ($$) "
NOW="`date +%m/%d/%Y@%H:%M`"
echo "Report Run: $NOW
"
#echo "