<% 'Autore: Gabriele 'Data:11/06/2003 'Descrizione: Pagina di gestione delle richieste al server di immagini '19/06/2003: Modificata la ricerca sui nodi XML per le copie colore per contemplare uppercase e lowercase, ' siccome i file vengono spesso rinominati a mano e l'applicazione che genera l'xml non considerava il problema '12/06/2004: Redirection changed from relative path to absolute path '25/05/2007: Gab: revisione accesso via 'Input parameters QueryCode = request("c") QueryUnderscore = request("u") set RCode = server.CreateObject("MSXML2.DomDocument.6.0") RCode.load (Server.MapPath(left(QueryCode,2)&"/"&mid(QueryCode,6,3)&"/xml/"&left(QueryCode,8)&".xml")) c8switch=0 if RCode.parseError <> 0 Then log QueryCode,QueryUnderscore FallBack 1 else if len (QueryCode)=10 Then if not (Rcode.selectSingleNode ("/IMGS/CC[(@ID="""&lcase(right(QueryCode,2))&""" or @ID="""&ucase(right(QueryCode,2))&""")]") is nothing) Then vlue = Rcode.selectSingleNode ("/IMGS/CC[(@ID="""&lcase(right(QueryCode,2))&""" or @ID="""&ucase(right(QueryCode,2))&""")]").getAttribute("_"&lcase(QueryUnderscore)) vlue2 = Rcode.selectSingleNode ("/IMGS/CC[(@ID="""&lcase(right(QueryCode,2))&""" or @ID="""&ucase(right(QueryCode,2))&""")]").getAttribute("_"&ucase(QueryUnderscore)) chk = (vlue="-1" or vlue2="-1") Else chk = False End if if not chk Then c8switch=1 vlue = Rcode.selectSingleNode ("/IMGS").getAttribute("_"&lcase(QueryUnderscore)) vlue2 = Rcode.selectSingleNode ("/IMGS").getAttribute("_"&ucase(QueryUnderscore)) chk = (vlue="-1" or vlue2="-1") End if Else if len (QueryCode)= 8 Then vlue = Rcode.selectSingleNode ("/IMGS").getAttribute("_"&lcase(QueryUnderscore)) vlue2 = Rcode.selectSingleNode ("/IMGS").getAttribute("_"&ucase(QueryUnderscore)) chk = (vlue="-1" or vlue2="-1") Else set RCode=nothing Fallback 2 End if End if set RCode=nothing if chk = True Then if c8switch = 1 Then 'Case codice10 not exisisting QueryCode=left(QueryCode,8) End if Redirection Querycode,QueryUnderscore Else Fallback 3 End if end if '------------------------------------------------------------------------------------------------ function extension (byVal u) if u="4" Or u="full" Then extension=".gif" else extension=".jpg" End if End function function ctype (byVal u) if u="4" Or u="full" Then ctype ="image/gif" else ctype ="image/jpeg" End if End function Sub Redirection (byref QueryCode,byref QueryUnderscore) Response.ContentType = ctype (QueryUnderscore) Response.redirect ("http://imgs.yoox.com/"&left(QueryCode,2)&"/"&mid(QueryCode,6,3)&"/"&QueryCode&"_"&QueryUnderscore&extension(QueryUnderscore)) End Sub Sub FallBack (byref x) Response.ContentType = "image/gif" Server.Transfer "/s.gif" End Sub Sub Log (byVal codice,byVal underscore) 'Scrittura su FSO del problema rilevato (drv4 si occuperà poi di controllare cosa è successo) End Sub %>