-1

i'm stuck at my job dealing with an issue new to me, you see, i need to check that only certain users can access a determined page rather than all of them, so i'm trying an "if not" command but it's not working, how can i solve this?

basically what i need is that if is not a determined user shows a page that says "hey, you're not allowed here" and if it is such user shows a page that says "welcome to this page" or something

If not user_unique_id = 287 OR 809 OR 833 OR 829 OR 837 OR 831 then 

     response.redirect "Authorized_users_only.asp"
Else
    response.redirect "Desired_page.asp"
End If

the error i'm getting is it is only allowing me one user, usually the first one i place, the rest doesn't let them into the desired page

1 Answers1

3

You need to repeat your test for each ID. For example:

If not (user_unique_id = 287 OR user_unique_id = 809 OR...) then

Try this variation instead:

Select Case user_unique_id
  Case 287, 809, 833, 829, 837, 831
  response.redirect "Desired_page.asp"
  Case Else
  response.redirect "Authorized_users_only.asp"
End select

Ideally, you should use a database where user rights are defined, or you'll need to modify your code everytime a new user gets access or someone leaves...

  • 1
    hi chris, and thanks for your answer, i tried the first method and worked perfectly, however i had the table you mentioned of user rights only i forgot to mention it, and for other similar case i'll surely try you second method, thank you very much :D – сꝛıϻѕοɴ ᴠᴇɴoϻ Sep 05 '19 at 13:48