I think some people forget Java runs on Windows too, I know you would be an idiot to use Java on Windows (More expensive, sacrificing awesome Linux performance) lol.
Printable View
I think some people forget Java runs on Windows too, I know you would be an idiot to use Java on Windows (More expensive, sacrificing awesome Linux performance) lol.
Well im sorry i am stupit... but can anny1 make a vid for this :S
Your version didn't work for me, so here's my version;
Code:<cfset hosts = ["http://habbo.de/", "http://habbo.com/", "http://habbo.es/", "http://habbo.nl/", "http://habbo.au/", "http://habbo.ca/"]>
<cfif not StructKeyExists(URL, "user")>
Please input a username.
<cfabort>
</cfif>
<cfquery name="getUserLook" datasource="#config.DSN#">
SELECT look
FROM users
WHERE username = <cfqueryparam value="#user#" cfsqltype="CF_SQL_CHAR" maxLength="50">
</cfquery>
<cfset args = "">
<cfif StructKeyExists(URL, "direction")>
<cfset args = "&direction=#direction#">
</cfif>
<cfif StructKeyExists(URL, "head_direction")>
<cfset args = "#args#&head_direction=#head_direction#">
</cfif>
<cfif StructKeyExists(URL, "gesture")>
<cfset args = "#args#&gesture=#gesture#">
</cfif>
<cfif StructKeyExists(URL, "size")>
<cfset args = "#args#&size=#size#">
</cfif>
<cfif StructKeyExists(URL, "img_format")>
<cfset args = "#args#&img_format=#img_format#">
</cfif>
<cfif StructKeyExists(URL, "action")>
<cfset args = "#args#&action=#action#">
</cfif>
<cfif not FileExists("#GetCurrentTemplatePath()#/../avatar_cache/#Hash("#getUserLook.look##args#", "SHA-1")#.png")>
<cfif getUserLook.RecordCount>
<cfset data = [user, getUserLook.look]>
<!--- Loop through supplied hosts. --->
<cfloop from="1" to="#arraylen(hosts)#" index="u">
<!--- Call the host. --->
<cfhttp method="head" url="#hosts[u]#" resolveurl="no" throwonerror="no" />
<!--- If called host responds with a status code --->
<cfif IsDefined("CFHTTP.responseHeader.status_code")>
<!--- Providing the host does not respond with error 403 or 404, then proceed. --->
<cfif CFHTTP.responseHeader.status_code neq "403" or CFHTTP.responseHeader.status_code neq "404">
<!--- The host loads, so let's now verify that it isn't on maintenance or closed by looking for the image. --->
<cfset grabthis = "#hosts[u]#habbo-imaging/avatarimage?figure=#getUserLook.look##args#">
<cfhttp method="get" url="#grabthis#" useragent="#CGI.http_user_agent#" timeout="5" getasbinary="yes" result="objGET">
<cfhttpparam type="HEADER" name="referer" value="http://habbo.com/Home/Shorty-234-Otaku-toas"/>
</cfhttp>
<cfif find("200", objGet.statusCode)>
<cfimage action="write" source="#objGet.FileContent#" destination="#GetCurrentTemplatePath()#/../avatar_cache/#Hash("#getUserLook.look##args#", "SHA-1")#.png" overwrite="no">
<cfcontent type="image/gif" variable="#objGet.FileContent#">
<cfbreak>
<cfelse>
<cfoutput>#objGet.statusCode#</cfoutput>
</cfif>
Whoops, PNG error!
<cfabort>
</cfif>
Whoops, 403/ 404!
<cfabort>
</cfif>
Didn't respond!
<cfabort>
</cfloop>
<cfcontent type="image/png" file="#GetCurrentTemplatePath()#/../avatar_cache/#Hash("#getUserLook.look##args#", "SHA-1")#.png">
<cfelse>
Username does not exist.
<cfabort>
</cfif>
<cfelse>
<cfset existingAvatar = "#GetCurrentTemplatePath()#/../avatar_cache/#Hash("#getUserLook.look##args#", "SHA-1")#.png">
<cfcontent type="image/png" file="#existingAvatar#">
</cfif>
Improved again, it looks like it would have aborted rather than gone to the next available host, this should check the next host if the first is down;
Code:<cfset hosts = ["http://habbo.de/", "http://habbo.com/", "http://habbo.es/", "http://habbo.nl/", "http://habbo.au/", "http://habbo.ca/"]>
<cfif not StructKeyExists(URL, "user")>
Please input a username.
<cfabort>
</cfif>
<cfquery name="getUserLook" datasource="#config.DSN#">
SELECT look
FROM users
WHERE username = <cfqueryparam value="#user#" cfsqltype="CF_SQL_CHAR" maxLength="50">
</cfquery>
<cfset args = "">
<cfif StructKeyExists(URL, "direction")>
<cfset args = "&direction=#direction#">
</cfif>
<cfif StructKeyExists(URL, "head_direction")>
<cfset args = "#args#&head_direction=#head_direction#">
</cfif>
<cfif StructKeyExists(URL, "gesture")>
<cfset args = "#args#&gesture=#gesture#">
</cfif>
<cfif StructKeyExists(URL, "size")>
<cfset args = "#args#&size=#size#">
</cfif>
<cfif StructKeyExists(URL, "img_format")>
<cfset args = "#args#&img_format=#img_format#">
</cfif>
<cfif StructKeyExists(URL, "action")>
<cfset args = "#args#&action=#action#">
</cfif>
<cfif not FileExists("#GetCurrentTemplatePath()#/../avatar_cache/#Hash("#getUserLook.look##args#", "SHA-1")#.png")>
<cfif getUserLook.RecordCount>
<cfset data = [user, getUserLook.look]>
<!--- Loop through supplied hosts. --->
<cfloop from="1" to="#arraylen(hosts)#" index="u">
<!--- Call the host. --->
<cfhttp method="head" url="#hosts[u]#" resolveurl="no" throwonerror="no" />
<!--- If called host responds with a status code --->
<cfif IsDefined("CFHTTP.responseHeader.status_code")>
<!--- Providing the host does not respond with error 403 or 404, then proceed. --->
<cfif CFHTTP.responseHeader.status_code neq "403" or CFHTTP.responseHeader.status_code neq "404">
<!--- The host loads, so let's now verify that it isn't on maintenance or closed by looking for the image. --->
<cfset grabthis = "#hosts[u]#habbo-imaging/avatarimage?figure=#getUserLook.look##args#">
<cfhttp method="get" url="#grabthis#" useragent="#CGI.http_user_agent#" timeout="5" getasbinary="yes" result="objGET">
<cfhttpparam type="HEADER" name="referer" value="http://habbo.com/Home/Shorty-234-Otaku-toas"/>
</cfhttp>
<cfif find("200", objGet.statusCode)>
<cfimage action="write" source="#objGet.FileContent#" destination="#GetCurrentTemplatePath()#/../avatar_cache/#Hash("#getUserLook.look##args#", "SHA-1")#.png" overwrite="no">
<cfcontent type="image/gif" variable="#objGet.FileContent#">
<cfbreak>
</cfif>
Whoops, PNG error! (<cfoutput>#objGet.statusCode#</cfoutput>)
</cfif>
Whoops, 403/ 404!
</cfif>
</cfloop>
<cfcontent type="image/png" file="#GetCurrentTemplatePath()#/../avatar_cache/#Hash("#getUserLook.look##args#", "SHA-1")#.png">
<cfelse>
Username does not exist.
<cfabort>
</cfif>
<cfelse>
<cfset existingAvatar = "#GetCurrentTemplatePath()#/../avatar_cache/#Hash("#getUserLook.look##args#", "SHA-1")#.png">
<cfcontent type="image/png" file="#existingAvatar#">
</cfif>