This is a forum where members new and old can come to ask questions and get info and opinions. It is not a place to advertise your business or have other forms of advertising, whether it be in your posts or signature.

All links in the forum will not be indexed by Search Engines and any unapproved forms of advertising or spam will be dealt with accordingly, deleted, and that member's account banned.

Forums

Overview » ASP » Assistance in helping tweek a redirect anti-spam script please.
Reply

Assistance in helping tweek a redirect anti-spam script please.

Somjad P
Member



Since: 22 Feb 2010
Posts: 7
Posted 15 May 2010 21:30:07

Greetings!

Thank you for your input. This forum is always full of good information and great people.

I have a page that I currently have running a script from Dreamweaver MX that has an include file. This include file redirects a user to page 1 if their IP is xxx or page 2 if it is yyy. I have a database that has a list of IP addresses that I query out and I want to compare it to the current user's IP. If it matches any of the nonapproved IPs that are in the database then I want them to go a page 1 but if there are no matches then go to page two.

Below is what I have so far. The problem I have is that it seems to let everything go to page 2 and does not stop and go to page 1 even if one of the ip is showing a match. Am I placing the "else" command in the wrong place? (I tried to substitue the redirect with just a response.write to test it and the list does show up with the correct response but it is not executing the ELSE command...it just displays the list)

Thank you so much and have a great day!


<%
startrw = 0
endrw = HLooper1__index
numberColumns = 10
numrows = -1
while((numrows <> 0) AND (Not bannediplist.EOF))
startrw = endrw + 1
endrw = endrw + numberColumns
%>
<tr align="center" valign="top">
<%
While ((startrw <= endrw) AND (Not bannediplist.EOF))
%>
<td><%
dim ipban
dim clientinformation

ipban = Request.ServerVariables("REMOTE_ADDR"
clientinformation = (clientinfo.Fields.Item("ClientID".Value)
If (bannediplist.Fields.Item("IPnum".Value) = ipban then
response.Redirect (("IPSTblocked.asp?ClientID="& clientinformation)
else
response.redirect ((clientinfo.Fields.Item("clientwebsite".Value))


%> </td>
<%
startrw = startrw + 1
bannediplist.MoveNext()
end if
Wend

%>
</tr>
<%
numrows=numrows-1
Wend
%>
Edited by - Somjad P on 15 May 2010  21:30:33

Edited by - Somjad P on 20 May 2010  17:56:18

Greetings!

Thank you for your input. This forum is always full of good information and great people.

I have a page that I currently have running a script from Dreamweaver MX that has an include file. This include file redirects a user to page 1 if their IP is xxx or page 2 if it is yyy. I have a database that has a list of IP addresses that I query out and I want to compare it to the current user's IP. If it matches any of the nonapproved IPs that are in the database then I want them to go a page 1 but if there are no matches then go to page two.

Below is what I have so far. The problem I have is that it seems to let everything go to page 2 and does not stop and go to page 1 even if one of the ip is showing a match. Am I placing the "else" command in the wrong place? (I tried to substitue the redirect with just a response.write to test it and the list does show up with the correct response but it is not executing the ELSE command...it just displays the list)

Thank you so much and have a great day!


<%
startrw = 0
endrw = HLooper1__index
numberColumns = 10
numrows = -1
while((numrows <> 0) AND (Not bannediplist.EOF))
startrw = endrw + 1
endrw = endrw + numberColumns
%>
<tr align="center" valign="top">
<%
While ((startrw <= endrw) AND (Not bannediplist.EOF))
%>
<td><%
dim ipban
dim clientinformation

ipban = Request.ServerVariables("REMOTE_ADDR"
clientinformation = (clientinfo.Fields.Item("ClientID".Value)
If (bannediplist.Fields.Item("IPnum".Value) = ipban then
response.Redirect (("IPSTblocked.asp?ClientID="& clientinformation)
else
response.redirect ((clientinfo.Fields.Item("clientwebsite".Value))


%> </td>
<%
startrw = startrw + 1
bannediplist.MoveNext()
end if
Wend

%>
</tr>
<%
numrows=numrows-1
Wend
%>
Edited by - Somjad P on 15 May 2010  21:30:33

Edited by - Somjad P on 20 May 2010  17:56:18
Seb Adlington
Freaking Member



Since: 09 Aug 2001
Posts: 104
Replied 03 Jun 2010 13:13:08
Hi Somjad,

try putting the code above your opening head statement, that way the page won't load at all and the divert happens as soon as they hit the page

Cheers

Seb

Reply to this topic

Message
Reply
Follow us on Facebook Follow us on twitter Subscribe to the RSS feed
Activate your free membership today | Login | Currency