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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bolatito
    New Member
    • Jan 2008
    • 1

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

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

    If Instr(Request.S erverVariable(H TTP_REFERER),"p agename.asp")

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


    <%
    if Instr (Request.Server Variables(HTTP_ REFERER),"log") = "true" then
    response.write( "INVALID USER")
    session.content s.remove("login ")
    end if
    %>

    <%

    if request.form("b tnsubmit") = "submit" then

    if request.form("f name") = username and request.form("p w")= password then
    response.redire ct("welcome.asp ")
    else
    response.redire ct("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
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    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:
    [code=asp]if Instr(Request.S erverVariables( HTTP_REFERER)," log") > 0 then [/code] Let me know if this helps.

    Jared

    Comment

    Working...