473,503 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Instr(Request.ServerVariable(HTTP_REFERER),"pagena me.asp")

1 New Member
How can I make use of thisi ASP instruction in trying to restrict access to a page.

If Instr(Request.ServerVariable(HTTP_REFERER),"pagena me.asp")

The pagename is the name of the page that containsn the form action.


<%
if Instr (Request.ServerVariables(HTTP_REFERER),"log") = "true" then
response.write("INVALID USER")
session.contents.remove("login")
end if
%>

<%

if request.form("btnsubmit") = "submit" then

if request.form("fname") = username and request.form("pw")= password then
response.redirect("welcome.asp")
else
response.redirect("DEFAULT.ASP")
end if
end if

%>

Both ASP commands are on two different pages.


ERROR CODES

The error codes displayed is

string expected as input
Jan 2 '08 #1
1 4837
jhardman
3,406 Recognized Expert Specialist
Instr should return a number, 0 if false, >0 if true (I thought it returned the integer position of the found string within the greater string, but someone recently said it was the number of occurrences, regardless it should be a positive integer). try:
Expand|Select|Wrap|Line Numbers
  1. if Instr(Request.ServerVariables(HTTP_REFERER),"log") > 0 then 
Let me know if this helps.

Jared
Jan 3 '08 #2

Sign in to post your reply or Sign up for a free account.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.