Print Page | Close Window

One more ASP question....

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=804
Printed Date: 29 March 2026 at 8:08pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: One more ASP question....
Posted By: fernan82
Subject: One more ASP question....
Date Posted: 07 March 2003 at 11:59am
Ok, this is for a mod i'm making to integrate the wwf login whith the rest of the site, i need to make a variable with more than one value and then compare it with a single value variable...

example:
<%
intAllowGroups = "3,7"

If Not IntGroupID = intAllowGroups Then Response.Redirect "no_access.asp"
%>

Would that work just like that or do I need to make any changes since there's more than 1 value on the intAllowGroups variable?

Thanks in advance for your responses,
Fernan



Replies:
Posted By: boyohboy
Date Posted: 07 March 2003 at 12:10pm
what's in IntGroupID? intAllowGroups look like a string

-------------
Visit my community website @
http://www.everythingviet.com - EverythingVIET.com


Posted By: fernan82
Date Posted: 07 March 2003 at 12:21pm
intGroupID is the forums Group ID #, like Moderator Group is 3, Admin 1, Guest 2, etc...


Posted By: boyohboy
Date Posted: 07 March 2003 at 12:31pm
if you must use one variable intAllowGroups  for that, i guess you must parse, convert it to int first before the comparison cuz intgroupid is a singular int

-------------
Visit my community website @
http://www.everythingviet.com - EverythingVIET.com


Posted By: fernan82
Date Posted: 07 March 2003 at 12:35pm
That's what I need to know how to do..............that might be a dumb question but I don't know sh*t about ASP...


Posted By: boyohboy
Date Posted: 07 March 2003 at 12:45pm

<%

arrayVar = CInt(Trim(Split(intAllowGroups , ","))) 'split, trim space, convert to int
If Not IntGroupID = arrayVar(0) Then Response.Redirect "no_access.asp"
End If
%>

What the heck is 7 for?



-------------
Visit my community website @
http://www.everythingviet.com - EverythingVIET.com


Posted By: fernan82
Date Posted: 07 March 2003 at 1:10pm
Thanks, 7 is the GroupID of a private group i got in my forums, i want only those members and moderators to access certain pages on my site...


Posted By: fernan82
Date Posted: 07 March 2003 at 1:19pm
Tried it just like that and it gave me a type mismatch error on this line:

arrayVar = CInt(Trim(Split(intAllowGroups , ","))) 'split, trim space, convert to int



Posted By: fernan82
Date 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"


Posted By: boyohboy
Date 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 @
http://www.everythingviet.com - EverythingVIET.com


Posted By: fernan82
Date 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.....


Posted By: boyohboy
Date 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 @
http://www.everythingviet.com - EverythingVIET.com


Posted By: fernan82
Date 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?



Posted By: faubo
Date 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.



-------------
http://www.conhecerparaconservar.org - I don't know how to make you click here


Posted By: fernan82
Date 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 http://forums.webwiz.net/forum_posts.asp?TID=821&PN=1 - here

I'm still working on moding the login page so you can include it anywhere on your site...



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net