PDA

View Full Version : Random URL selection


muneeba9071
10-14-2009, 11:49 PM
I am writing an ASP script, that will redirect each visitor to other URL.

The program will have X different URLs, Every visitor that come into our website will automatically be redirected to a different URL (in a cyclic way)
EX: we will have two different URLs (www.cnn.com and www.bbc.com)
the first visitor will be redirected to “www.cnn.com”, the second to ‘www.bbc.com”, the third again to www.cnn.com the fourth to www.bbc.com and so on …

I don't have much skill with ASP, :)

Help, appreciated!

Thanks in advance

muneeba9071
10-15-2009, 02:04 AM
Help please :(

Old Pedant
10-15-2009, 07:51 PM
<%
urls = Array("www.cnn.com", "www.abc.com", "www.ibm.com")
Application.Lock
urlpick = CLNG( "0" & Application("URLPick") )
Application("URLPick") = ( urlpick + 1 ) MOD ( UBound(urls) + 1 )
Application.UnLock
Response.Redirect "http://" & urls(urlpick)
%>

muneeba9071
10-17-2009, 02:09 AM
Thanks it works!!!