#!/bin/sh #QUERY_STRING="AREA=ALL&HEADER=privateproperty%2Fheader.htm&INDEX=nottinghamshire%2Fprivateproperty.008%2F__localind&TYPE=FS&BED=0&H=true&F=true&MIN=10%2C000&MAX=20000&image=Search+Now&email=demo" OURHOME=/usr/home/gerald cat $OURHOME/public_html/bits/header.htm #by default assume type=FS type=FS include="," exclude="," proptype="" minrooms=0 counter=1 hollink=1 contact=1 newstring=`echo $QUERY_STRING | tr "&" " "` house=false flat=false comm=false holiday=false val=false devel=false farm=false start=1 finish="" display=5 #htmldir indicates the directory where the s ad f files reside for this search #htmldir=summary indicates the default summary and full dirs htmldir=summary_agent random=`date +%H%M%S`$$ search_agents=":" for string in $newstring do #echo "$string or $token and $value
" #token=`echo $string | sed s~"=.*"~""~g ` #value=`echo "$string" | sed s~".*="~""~g ` token=`echo "$string" | cut -d'=' -f1` value=`echo "$string" |cut -d'=' -f2` if [ "`echo $token | cut -c 1-3`" = "PT_" ] then subtoken=`echo $token | cut -c 4-80` token="PT_" fi if [ "`echo $token | cut -c 1-2`" = "MT" ] then value=`echo "$string" |cut -d'=' -f2 |sed -f $OURHOME/bits/specialchars| sed -e 's/(a)/@/g'| sed -e 's/+//g'` token="MT_" fi case $token in T) sel_town=`echo $value | tr "+" " "` ##echo the value of selected town = $sel_town ;; MT_) # multi token to allow Bung:Det proptype=${proptype}${value}":" ;; PT_) if [ "$value" = "true" ] then proptype=${proptype}${subtoken}":" fi ;; TYPE) type="$value" ##echo the value of TYPE=$type ;; AREA) county=`echo $value | sed -e 's/+//g' | tr '[a-z]' '[A-Z]'` ##echo the value of AREA=$county ;; BED) minrooms=`expr $value` ##echo value of minrooms = $minrooms ;; H) house=$value ;; F) flat=$value ;; CUST) cust=$value ;; VAL) val=$value ;; COMM) comm=$value ;; DEVEL) devel=$value ;; FARM) farm=$value ;; HOLIDAY) holiday=$value ;; MIN) if test -z "$value" then minprice=`expr 0` else price=`echo "$value" | sed -e 's/%2C//g' | sed -e 's/,//g' ` minprice=`expr $price` fi ;; MAX) price=`echo "$value" | sed -e 's/%2C//g' | sed -e 's/,//g' ` maxprice=`expr $price` ;; WMIN) if test -z "$value" then minprice=`expr 0` else price=`echo "$value" | sed -e 's/%2C//g' | sed -e 's/,//g' ` minprice=`expr $price \* 52 ` minprice=`expr $minprice / 12 ` fi ;; WMAX) price=`echo "$value" | sed -e 's/%2C//g' | sed -e 's/,//g' ` maxprice=`expr $price \* 52 ` maxprice=`expr $maxprice / 12 ` maxprice=`expr $maxprice + 1 ` ;; PRICEBAND) #sel_town=`echo $value | tr "+" " "` # token=`echo $string | cut -d"=" -f1 ` # value=`echo $string | cut -d"=" -f2 ` minprice=`echo $value | cut -d"-" -f1 ` maxprice=`echo $value | cut -d"-" -f2 ` #echo minprice=$minprice maxprice=$maxprice ;; START) #Starting from record start=`echo "$value" | sed -e 's/%2C//g'` ;; FINISH) #finish at record finish=`echo "$value" | sed -e 's/%2C//g'` ;; DISPLAY) #Display increment display=`echo "$value" | sed -e 's/%2C//g'` if [ "$display" = "ALL" ] then finish=100000 fi ;; HOLLINK) hollink=`echo "$value" | sed -e 's/%2C//g'` ;; COUNTER) counter=`echo "$value" | sed -e 's/%2C//g'` ;; CONTACT) contact=`echo "$value" | sed -e 's/%2C//g'` ;; CINDEX) ## #indexfile=`echo $value |sed s~"%2F"~"/"~g` cindexfile="__countyind" ;; INTHEADER) intheader=`echo $value | sed s~"%2F"~"/"~g` ;; HEADER) header=`echo $value | sed s~"%2F"~"/"~g` ;; AREAHEADER) areaheader=`echo $value | sed s~"%2F"~"/"~g` ;; INTFOOTER) intfooter=`echo $value | sed s~"%2F"~"/"~g` ;; FOOTER) footer=`echo $value | sed s~"%2F"~"/"~g` ;; HTMLDIR) htmldir=`echo $value | sed s~"%2F"~"/"~g` ;; excluding) ## echo "

value = $value

" if [ "$value" = "" ] then newexc="," else newexc=`echo $value | sed -e 's/+//g' | sed -e 's/%2C/,/g' ` fi if [ "$exclude" = "," ] then exclude=${newexc} else exclude=${exclude},${newexc} fi ## echo "

exclude = $exclude

" ;; including) ## echo "

value = $value

" if [ "$value" = "" ] then newinc="," else newinc=`echo $value | sed -e 's/+//g' | sed -e 's/%2C/,/g' ` fi if [ "$include" = "," ] then include=${newinc} else include=${include},${newinc} fi ## echo "

include = $include

" ;; INDEX) ## #indfile=`echo $value | tr "%2F" "/"` indfile=`echo $value | sed -e 's/%2F/\//g'` ## echo indfile = $indfile ;; email) #emailname=`echo "$value" | sed -e 's/%2C/,/g'| sed -e 's/+//g' | tr '[A-Z]' '[a-z]'` emailname=`echo "$value" | tr '[A-Z]' '[a-z]' |sed -f $OURHOME/bits/specialchars| sed -e 's/(a)/@/g'| sed -e 's/+//g'` if [ '(' "$value" != "" ')' -a '(' "$value" != "demo" ')' ] then lc_area=`echo $county |tr '[A-Z]' '[a-z]'` if ! test -d $OURHOME/info/email_current/$lc_area then mkdir $OURHOME/info/email_current/$lc_area chmod 777 $OURHOME/info/email_current/$lc_area chown hol $OURHOME/info/email_current/$lc_area chgrp hol $OURHOME/info/email_current/$lc_area fi echo $QUERY_STRING >$OURHOME/info/email_current//$lc_area/$emailname chmod 666 $OURHOME/info/email_current/$lc_area/$emailname echo $QUERY_STRING >$OURHOME/info/email_new/$emailname chmod 666 $OURHOME/info/email_new/$emailname fi ;; a) #echo agent num = $value search_agents=${search_agents}${value}: ##echo "search agents=$search_agents
" ##echo search_agents=$search_agents ## echo value of minrooms = $minrooms ;; *) ;; esac done if [ "$finish" = "" ] then finish=$display fi if [ "$search_agents" = ":" ] then search_agents="::" fi #echo "search_agents $search_agents
" # echo querystr $QUERY_STRING ## echo newsting=$newstring if [ "$emailname" != "demo" ] then echo `date` $QUERY_STRING >> $OURHOME/info/search_log expr `cat $OURHOME/info/search_log.count` + 1 >$OURHOME/info/search_log.count.$$ chmod 666 $OURHOME/info/search_log.count.$$ mv $OURHOME/info/search_log.count.$$ $OURHOME/info/search_log.count demo_mode=0 else demo_mode=1 fi # echo "debug, spec: minprice :$minprice: maxprice: $maxprice:
" # echo "debug, spec: house :$house: flat :$flat: county :$county:
" # now we have set up the search we now need to search through the ind files # that we've previously generated and match them matchcount=0 if [ "$cindexfile" = "__countyind" ] then lc_area=`echo $county |tr '[A-Z]' '[a-z]' ` indexfile=$OURHOME/public_html/$lc_area/__countyind ## echo indfile=$indexfile else indexfile=$OURHOME/public_html/$indfile ## echo indfile2=$indexfile fi if [ $house = true ] then proptype=$proptype"HOUSE:" fi if [ $flat = true ] then proptype=$proptype"FLAT:" fi if [ $val = true ] then proptype=$proptype"VAL:" fi if [ $cust = true ] then proptype=$proptype"CUST:" fi if [ $comm = true ] then proptype=$proptype"COMM:" fi if [ $devel = true ] then proptype=$proptype"DEVEL:" fi if [ $farm = true ] then proptype=$proptype"FARM:" fi if [ $holiday = true ] then proptype=$proptype"HOLIDAY:" fi #for advertsing.com/double click header swaping randomheader=`jot -r 1 1 9` if [ -f $OURHOME/public_html/$header ] then header=$header.$randomheader footer=$footer.$randomheader fi tmp_proptype=`echo $proptype | tr ';' ':'` if [ "$header" = "" ] then cat $OURHOME/public_html/bits/header2.htm else if [ -f $OURHOME/public_html/$header ] then cat $OURHOME/public_html/$header | sed s/"@@SEARCHLM@@"/"`cat $OURHOME/counters/searches_last_month`"/g | sed s/"@@SEARCHTM@@"/"`cat $OURHOME/info/search_log.count`"/g | sed s/"12190132861"/"$random"/g | sed s/"@@COUNTY@@"/"$county"/g | sed s/"@@MINBED@@"/"$minrooms"/g | sed s/"@@MINPRICE@@"/"$minprice"/g | sed s/"@@MAXPRICE@@"/"$maxprice"/g | sed s/"@@PROPTYPE@@"/"$tmp_proptype"/g | sed s/"@@TENURE@@"/"$type"/g else cat $OURHOME/public_html/bits/header2.htm fi fi if [ "$areaheader" = "yes" ] then if test -f $OURHOME/public_html/headers/${county}.htm then cat $OURHOME/public_html/headers/${county}.htm fi fi #echo indexfile=$indexfile >>/tmp/guy888 #echo "start=$start finish=$finish
" if [ -f "$indexfile" ] then $OURHOME/bin/search3 $demo_mode $OURHOME $indexfile $OURHOME/intray/agent_list $OURHOME/intray/contact_list $county $minrooms $proptype $minprice $maxprice $search_agents $type NO $htmldir $include $exclude $start $finish $counter /$intheader /$intfooter $contact rc=$? else #echo "
not running the search" >>/tmp/guy888 echo "
Property index not found, please contact the system administrator at hol@homes-on-line.com" fi if [ "$display" != "ALL" ] then nstart=`expr $start + $display` nfinish=`expr $start + $display + $display - 1` pstart=`expr $start - $display` pfinish=`expr $start - 1` #if [ $nfinish -gt $total ] #then # nfinish=$total #fi echo "
" # return 1= need previous 2 need next 3 need both 0 niether if [ "$rc" -eq 1 ] then echo "

Previous page

" fi if [ "$rc" -eq 2 ] then echo "

Next page

" fi if [ "$rc" -eq 3 ] then echo "

Previous page " echo "Next page

" fi #echo "tot=$total nstart=$nstart nfinish=$nfinish pstart=$pstart pfinish=$pfinish" echo "
" fi #end of display != "ALL" if [ "$footer" = "" ] then cat $OURHOME/public_html/bits/footer.htm else if [ "$hollink" = "1" ] then echo "
Property data provided via Homes On-Line Limited
" fi cat $OURHOME/public_html/$footer | sed s/"@@SEARCHLM@@"/"`cat $OURHOME/counters/searches_last_month`"/g | sed s/"@@SEARCHTM@@"/"`cat $OURHOME/info/search_log.count`"/g | sed s/"12190132861"/"$random"/g | sed s/"@@COUNTY@@"/"$county"/g | sed s/"@@MINBED@@"/"$minrooms"/g | sed s/"@@MINPRICE@@"/"$minprice"/g | sed s/"@@MAXPRICE@@"/"$maxprice"/g | sed s/"@@PROPTYPE@@"/"$tmp_proptype"/g | sed s/"@@TENURE@@"/"$type"/g fi # note yes on the end is do you want homelink properties #cat $OURHOME/public_html/bits/footer.htm