Hej med jer. jeg har et lille problem jeg kan ikke få det til at
virker..
Sousekode
<%
Response.Expires = -1
Response.Buffer = True
Session.Timeout = 5
%>
<!--#include virtual="include/connstring.asp" -->
<%
if Request.ServerVariables("AUTH_USER")="" and
Request.ServerVariables("AUTH_PASSWORD")="" then
IsAdmin=false
IsUser=false
end if
if not (IsUser and IsAdmin) then
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnString
set = conn.execute("select level from users where
nick='"&Request.ServerVariables("AUTH_USER")&"' and
pass='"&Request.ServerVariables("AUTH_PASSWORD")&"'")
if not (.EOF or .BOF) then
IsUser=True
if (int(("level")) = 10 or int(("level")) = 9) then
IsAdmin=True
else
IsAdmin=false
end if
else
IsUser=false
end if
end if
if not (IsUser and IsAdmin) then
Response.Addheader "WWW-Authenticate", "BASIC
Realm="&chr(34)&"User Authorization"&chr(34)&""
response.Status = 401
%><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD><TITLE>401 Authorization Required</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000"><H1>401 Authorization
Required</H1>
<p>Either you gave a wrong username or password, or your browser
did not send the information correctly.</p>
<p>You don´t have permission to access <%=
Request.ServerVariables("SCRIPT_NAME") %> on this
server.</p></BODY></HTML><%
response.end
end if
conn.close
set conn = nothing
%>
--
Brug Validator service:
http://www.html.dk/validator
- Tast din URL én gang, og validér dokumentet hos 12 validatorer
- Understøtter HTML, CSS og søgemaskineoptimering