This topic is locked

Log on Page

3/17/2004 7:20:48 PM
ASPRunnerPro General questions
author

Log on questions.
I know that ASP Runner gives two options.

  1. Log on as a user and be able to edit, add, etc info.
  2. Log on as a guest and be able to view only.
    Is there a way to issue usernames and passwords for two types of users

    For example, once each user log on

    type 1 user can have access and permission to add, edit, view, and delete.

    type 2 user can only view info
    Thanks
    Lolo

Sergey Kornilov admin 3/17/2004

Currently you can do it do manually. Here is the some info that can help you doing this:

  1. Add a text field named UserType to Users table (table where you store usernames and passwords). Put in this field "Type1" for the first user and "Type2" for the second user.
  2. Modify login page (login.asp) to read UserType and save it to Session variable when user logs in. Insert this code right before redirecting user to list or menu page.
    Session("UserType") = rs("UserType")


3. Insert the following snippet of code in the beginning of CheckSecurity function in the ..._list.asp file:

if Session("UserType")="Type2" then

    CheckSecurity = False

    Exit Function

end if


I hope this helps.

501037 3/18/2004

Your explaination was clear, but I do not have asp knowledge. Please elaborate further step 2 and 3.
2. Modify login page (login.asp) to read UserType and save it to Session variable when user logs in. Insert this code right before redirecting user to list or menu page.
Do you want me to save it as usertype.asp instead of login.asp?

Can you please elaborate (hint between codes) where the code should be inserted before redirecting user to list or menu page. ?
Insert the following snippet of code in the beginning of CheckSecurity function in the ..._list.asp file:

Do I have to inser this code at all ..._list asp files?

I have RFQ_list.asp, Quote_list.asp, etc
Thank you,
Lolo

Sergey Kornilov admin 3/18/2004

Here is the code section that you need to modify in login.asp file. See my changes in bold:

If Not rs.EOF Then

    Session("UserID") = Request("username")

    Session("AccessLevel") = ACCESS_LEVELUSER

    if Request("username")=cAdminUserID then


          Session("AccessLevel") = ACCESS_LEVEL_ADMIN
    Session("UserType") = rs("UserType")
    Response.Redirect Replace("menu.asp", "%20", " ")

Else


CheckSecurity function need to be updated in each ..._list.asp file.

501038 3/18/2004

I did modify the secury check Point and the .._list.asp files. Please see below what I did with .._list.asp files
<%@ Language=VBScript %>
<%

if Session("UserType")="Type2" then  Â

CheckSecurity = False Â

Exit Function

end if

%>
<%

If Session("UserID")="" Then

Response.Redirect "login.asp"

End If

%>
<link REL="stylesheet" href="include/style.css" type="text/css">

<!--#include file="include/PASSWORD_dbconnection.asp"-->

<!--#include file="include/PASSWORD_variables.asp"-->

<!--#include file="include/PASSWORDaspfunctions.asp"-->

<%
Session.LCID = 1033

On Error Resume Next
strOrderBy=""

strOrderImage=""

Call CalculateOrderBy
TargetPageNumber=Request.Form("TargetPageNumber")

if TargetPageNumber="" or Request.Form("action")="search" then


TargetPageNumber=1
Error msg received
/ASPRunner/INV_list.asp, line 3, column 36

if Session("UserType")="Type2" then