<cfset intMinPhotoIndex = 57 />
<cfset intMaxPhotoIndex = 96 />
<cfset strQuery = (
"q=" &
"0+OR+" &
"1+OR+" &
"2+OR+" &
"3+OR+" &
"4+OR+" &
"5+OR+" &
"6+OR+" &
"7+OR+" &
"8+OR+" &
"9&" &
"rpp=#RandRange( 10, 100 )#&" &
"page=" & RandRange( 1, 5 )
) />
<cfhttp
result="objGet"
method="get"
url="http://search.twitter.com/search.json?#strQuery#"
useragent="bot.bennadel.com"
/>
<cfset arrStatuses = DeserializeJSON( objGet.FileContent ).Results />
<cfset intTotal = 0 />
<cfloop
index="objStatus"
array="#arrStatuses#">
<cfset arrNumbers = REMatch( "\d{1,5}", objStatus.Text ) />
<cftry>
<cfset intTotal += ArraySum( arrNumbers ) />
<cfcatch>
</cfcatch>
</cftry>
</cfloop>
<cfset intPhotoIndex = (
intMinPhotoIndex +
(intTotal MOD (intMaxPhotoIndex - intMinPhotoIndex + 1))
) />
<cfoutput>
<p>
And the winner is:
<a
href="http://www.bennadel.com?site-photo=#intPhotoIndex#"
target="bennadel"
>#intPhotoIndex#</a>
</p>
</cfoutput>