#INCLUDE "AlnStandard.Inc"
FUNCTION PBMAIN () AS LONG
DEFSNG a-z
SQL_Authorize &h230ECB89
SQL_Initialize 2,2,250,3,3,0,0,hCurInst&
g$=http_cookie()::g$=MID$(g$,INSTR(g$,"user="))
10 nam$="":gg=0
20 DIM pn$(20),pd$(20),pw$(20),ph$(20)
100 STDOUT "Content-type: text/html
101 STDOUT
102 STDOUT "
Pictures/Floor Plans
103 STDOUT "
120 g$=http_cookie():g$=MID$(g$,INSTR(g$,"user="))
125 IF LEFT$(g$,8)<>"user=LOC" AND LEFT$(g$,8)<>"user=TEX" THEN STDOUT"You must sign in to ALN properly. Click here to continue":END
130 user$=MID$(g$,17,30):li$=MID$(g$,9,8)
131 pl$=MID$(g$,47,2):nl$=MID$(g$,49,1):so$=MID$(g$,50,1):acct$=MID$(g$,51,8)+" ":acct$=LEFT$(acct$,8)
132 acct1$=acct$
133 IF RIGHT$(acct1$,1)<=" " AND LEN(acct1$)>1 THEN acct1$=LEFT$(acct1$,LEN(acct1$)-1):GOTO 133
134 acct1$=acct1$+".sch"
150 l1$=readcgi()
SQLResult& = SQL_OpenDB ("Driver={SQL Server};Server=192.168.131.50;Database=ALNUberBob;Uid=AlnData;Pwd=dr1ver;PORT=1433")
IF SQLResult&=%SQL_ERROR THEN
STDOUT "Could not connect to database:"
STDOUT SQL_ErrorQuickOne
GOTO 4000
END IF
IF LEN(l1$)<6 THEN
IF VAL(LEFT$(l1$,1))>0 THEN l1$="D"+l1$ ' add a "D" if numbers only
sql$="select aptname,apthomepage,aptaddress1,aptzip,alnid,pictureid from apartments where oldalnid='"+l1$+"'"
ELSE
sql$="select aptname,apthomepage,aptaddress1,aptzip,alnid,pictureid from apartments where alnid='"+l1$+"'"
END IF
SQLResult& = SQL_Stmt(%SQL_STMT_IMMEDIATE,sql$)
IF SQLResult& = %SQL_ERROR THEN
STDOUT "SQL Error:"
STDOUT SQL_ErrorQuickOne
GOTO 5000
END IF
SQL_FETCH %NEXT_ROW
IF SQL_EOD THEN
STDOUT "** No Pictures Available ** "+l1$
GOTO 5000
END IF
wnam$=TRIM$(SQL_ResColStr(SQL_resColNumber("Aptname")))
propwebs$=TRIM$(SQL_ResColStr(SQL_resColNumber("apthomepage")))
Address$=TRIM$(SQL_ResColStr(SQL_resColNumber("aptAddress1")))
csz$=TRIM$(SQL_ResColStr(SQL_resColNumber("aptzip")))
ALNid&=SQL_ResColUInt(SQL_resColNumber("alnid"))
REPLACE " " WITH "+" IN address$
REPLACE "#" WITH "+" IN Address$
' STDOUT "["+propweb$+"]
"
' STDOUT "["+address$+"]
"
' STDOUT "["+format$(alnid&)+"]
"
' IF LEFT$(http_referer(),43)<>"http://www.alnbackup.com/scripts/lpone1.exe" THEN goto 5000
sql$="select pictureid,securityhash,description,height,width from pictures where alnid="+FORMAT$(alnid&)+" and propertyorfloorplan in ('P','F') and picturestatus='A' order by alnorder,pictureorder"
SQLResult& = SQL_Stmt(%SQL_STMT_IMMEDIATE,sql$)
IF SQLResult& = %SQL_ERROR THEN
STDOUT "SQL Error:"
STDOUT SQL_ErrorQuickOne
GOTO 5000
END IF
STDOUT ""+wnam$+"
STDOUT "(Click on picture for enlarged photo)
STDOUT "(If a picture does not load, click in the box to force it)
STDOUT "Click here for a map to this property
IF propwebs$<>"" THEN STDOUT "Property Web Site (Opens in New Window)
STDOUT "
cnt=0
wCol=SQL_resColNumber("width")
hcol=SQL_ResColNumber("Height")
dCol=SQL_ResColNumber("Description")
idCol=SQL_ResColNumber("pictureid")
hashCol=SQL_ResColNumber("SecurityHash")
DO
SQL_Fetch %NEXT_ROW
IF SQL_EOD THEN EXIT LOOP
w=SQL_ResColFloat(wCol)
h=SQL_ResColFloat(hCol)
r=240/w:w=w*r:h=h*r
WHILE h>180
w=w*0.99:h=h*0.99
WEND
w=INT(w):h=INT(h)
IF cnt MOD 2=0 THEN STDOUT ""
' picurl$="http://www.aptdata.net/images/alnpic.exe?id="+FORMAT$(SQL_ResColUInt(idCol))+"&ph="+TRIM$(SQL_ResColStr(hashCol))
picurl$="http://www.aptdata.net/aptpicture/?id="+FORMAT$(SQL_ResColUInt(idCol))+"&ph="+TRIM$(SQL_ResColStr(hashCol))
ThumbURL$=picurl$+"&h=180"
STDOUT " "+TRIM$(SQL_ResColStr(dCol))+" | "
INCR cnt
IF cnt>50 THEN EXIT LOOP
' stdout SQL_ResColText(%ALL_COLs)
LOOP
4000 REM it all comes here
4001 STDOUT "
4005 STDOUT "
Click on the BACK or PREVIOUS button supplied on your browser to return to the listings
4010 STDOUT "
5000 SQL_Shutdown
4999 END
END FUNCTION