| Author |
Topic Search Topic Options
|
fernan82
Mod Builder Group
Joined: 17 November 2002
Location: United States
Status: Offline
Points: 362
|
Post Options
Thanks(0)
Quote Reply
Posted: 07 March 2003 at 1:23pm |
|
Here's the exact code i'm using:
<%
Dim intAllowGroups
intAllowGroups = "3,7"
intAllowGroups = CInt(Trim(Split(intAllowGroups , ","))) 'split, trim space, convert to int
If Not intGroupIDInfo = intAllowGroups(0) Then Response.Redirect "insufficient_permission.asp"
|
 |
boyohboy
Groupie
Joined: 15 October 2002
Location: United States
Status: Offline
Points: 197
|
Post Options
Thanks(0)
Quote Reply
Posted: 07 March 2003 at 5:39pm |
try:
arrayVar = Split(intAllowGroups , ",") 'split If Not CInt(IntGroupID) = CInt(Trim(arrayVar(0))) Then Response.Redirect "no_access.asp" End If
|
|
|
 |
fernan82
Mod Builder Group
Joined: 17 November 2002
Location: United States
Status: Offline
Points: 362
|
Post Options
Thanks(0)
Quote Reply
Posted: 07 March 2003 at 6:21pm |
|
Still throwing errors......,
This is how i've got it to work so far:
If Not intGroupIDInfo = 3 And Not intGroupIDInfo = 7 Then Response.Redirect "insufficient_permission.asp"
but I want to be able to put the 3 and the 7 in a single variable (and be able to add as many usergroups as i want) to make it easier to use in other pages and add other groups without having to change the If....then line....
<edit> I also want to make it easy to use as i know some ppl is interest on it so i'm gonna make it available for dl when i get it done.....
Edited by fernan82
|
 |
boyohboy
Groupie
Joined: 15 October 2002
Location: United States
Status: Offline
Points: 197
|
Post Options
Thanks(0)
Quote Reply
Posted: 07 March 2003 at 6:38pm |
let me try harder to understand your problem. OK, how about this:
intAllowGroups = "3,7" ' some where you got IntGroupID = "3" or IntGroupID = 3, right? arrayVar = Split(intAllowGroups , ",") 'split ...
If (Not CInt(IntGroupID) = CInt(Trim(arrayVar(0)))) And (Not CInt(IntGroupID) = CInt(Trim(arrayVar(1))))
What kind of error it throw? I'm only looking at programming issue. The logic is your concern.
|
|
|
 |
fernan82
Mod Builder Group
Joined: 17 November 2002
Location: United States
Status: Offline
Points: 362
|
Post Options
Thanks(0)
Quote Reply
Posted: 07 March 2003 at 6:59pm |
|
On the last code I've tried i got a type mismatch error i think..........let me try to explain better what i want...., i'm making a mod that gets the logged in group ID info off the forums database so the file i'm making is an include that you added to the top of any page in your website and if the users doesn't have the right permission the it redirect him to a no access page........ i can get it to work like this:
If Not intGroupID = 3 And Not intGroupID = 7 Then Response.Redirect "insufficient_permission.asp"
and it works just fine... but if am to allow another group to access the page i would have to change the If.... line and add anothe And intGroupID = 8 (or whatever) so what i'm trying to do is make a single variable where i can enter all the usergroups numbers that would have access to the page without having to change the code...
Kind of like -borg- did on the site search utility where you enter all the barred folders (as many as you want) in a single variable separated by comas, and the script will compare them all 1 by 1....
so here:
If Not intGroupID = 3 And Not intGroupID = 7 Then Response.Redirect "insufficient_permission.asp"
if the userID is not 3 or 7 he'll be redirected to a no access page, what i want to make is single variable that would contain the 7 and the 3 and whatever else i want to add and compare them to intGroupID without having to add AND NOT intGroupID = 8 AND NOT intGroupID = 9.......... get it?
|
 |
faubo
Senior Member
Joined: 30 May 2002
Location: Brazil
Status: Offline
Points: 560
|
Post Options
Thanks(0)
Quote Reply
Posted: 08 March 2003 at 11:56am |
Nice that you are trying that Fernan82, I will want a copy when it's ready 
Right now I can't help you much, I'm in middle of a consulting job and have a load of work until mid April.
and don't know very well these array thing either .
Anyway, I will try to help when I have some spare time.
|
|
|
 |
fernan82
Mod Builder Group
Joined: 17 November 2002
Location: United States
Status: Offline
Points: 362
|
Post Options
Thanks(0)
Quote Reply
Posted: 08 March 2003 at 1:42pm |
faubo wrote:
Nice that you are trying that Fernan82, I will want a copy when it's ready 
Right now I can't help you much, I'm in middle of a consulting job and have a load of work until mid April.
and don't know very well these array thing either .
Anyway, I will try to help when I have some spare time. |
It's ready, you can get it here
I'm still working on moding the login page so you can include it anywhere on your site...
|
 |