Connecting Tech Pros Worldwide Help | Site Map

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

Newbie
 
Join Date: Jan 2008
Posts: 1
#1: Jan 2 '08
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
jhardman's Avatar
Moderator
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,690
#2: Jan 3 '08

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


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
Reply