Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - One more ASP question....
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

One more ASP question....

 Post Reply Post Reply Page  <12
Author
fernan82 View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 17 November 2002
Location: United States
Status: Offline
Points: 362
Post Options Post Options   Thanks (0) Thanks(0)   Quote fernan82 Quote  Post ReplyReply Direct Link To This Post 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"
Back to Top
boyohboy View Drop Down
Groupie
Groupie


Joined: 15 October 2002
Location: United States
Status: Offline
Points: 197
Post Options Post Options   Thanks (0) Thanks(0)   Quote boyohboy Quote  Post ReplyReply Direct Link To This Post 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

Visit my community website @
EverythingVIET.com
Back to Top
fernan82 View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 17 November 2002
Location: United States
Status: Offline
Points: 362
Post Options Post Options   Thanks (0) Thanks(0)   Quote fernan82 Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
boyohboy View Drop Down
Groupie
Groupie


Joined: 15 October 2002
Location: United States
Status: Offline
Points: 197
Post Options Post Options   Thanks (0) Thanks(0)   Quote boyohboy Quote  Post ReplyReply Direct Link To This Post 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.

Visit my community website @
EverythingVIET.com
Back to Top
fernan82 View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 17 November 2002
Location: United States
Status: Offline
Points: 362
Post Options Post Options   Thanks (0) Thanks(0)   Quote fernan82 Quote  Post ReplyReply Direct Link To This Post 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?

Back to Top
faubo View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 May 2002
Location: Brazil
Status: Offline
Points: 560
Post Options Post Options   Thanks (0) Thanks(0)   Quote faubo Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
fernan82 View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 17 November 2002
Location: United States
Status: Offline
Points: 362
Post Options Post Options   Thanks (0) Thanks(0)   Quote fernan82 Quote  Post ReplyReply Direct Link To This Post Posted: 08 March 2003 at 1:42pm
Originally posted by faubo 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...
Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.