Author |
Topic |
Zuel
Average Member
USA
540 Posts |
Posted - 12 October 2005 : 16:36:32
|
I am creating my own asp pages not relevent to the forums just the website itself and I included
config.asp inc_func_secure.asp inc_header.asp
To prevent people from accessing the page without logging in. Now is there is a way to incorporate the usergroup mod in that page so only a certain group or groups can see the page?
I think I will have to hardcode the values. Anyone play with this before?< |
My Completed Mods: News Mod | Zuel's Avatar Add-on In Development: World of Warcraft Member Roster | [C# Based Forum]
Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.
MSN / E-Mail: ucyimDa_Ruler@Hotmail.com
Personal Bookmarks: How to work a DBS File
|
|
AnonJr
Moderator
United States
5768 Posts |
Posted - 12 October 2005 : 17:09:51
|
Not entirely sure... but if you are using the forums user management you will also need to include inc_sha256.asp as well.< |
|
|
Zuel
Average Member
USA
540 Posts |
Posted - 12 October 2005 : 19:00:26
|
Works fine without it. But I'll include that file then test for a change.< |
My Completed Mods: News Mod | Zuel's Avatar Add-on In Development: World of Warcraft Member Roster | [C# Based Forum]
Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.
MSN / E-Mail: ucyimDa_Ruler@Hotmail.com
Personal Bookmarks: How to work a DBS File
|
|
|
Zuel
Average Member
USA
540 Posts |
Posted - 12 October 2005 : 19:02:36
|
Internal Server Error when I include inc_sha256.asp.
I didn't run it on my local machine so I don't know what threw the error. I'll just leave it off for now.
I basically took the same includes default.asp had.< |
My Completed Mods: News Mod | Zuel's Avatar Add-on In Development: World of Warcraft Member Roster | [C# Based Forum]
Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.
MSN / E-Mail: ucyimDa_Ruler@Hotmail.com
Personal Bookmarks: How to work a DBS File
|
Edited by - Zuel on 12 October 2005 19:03:08 |
|
|
AnonJr
Moderator
United States
5768 Posts |
Posted - 12 October 2005 : 21:06:54
|
Odd... last time I left it out it wouldn't work... as long as its working < |
|
|
Zuel
Average Member
USA
540 Posts |
Posted - 13 October 2005 : 13:42:35
|
Back to the original question. Has anyone made a page restricted to a usergroup only?< |
My Completed Mods: News Mod | Zuel's Avatar Add-on In Development: World of Warcraft Member Roster | [C# Based Forum]
Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.
MSN / E-Mail: ucyimDa_Ruler@Hotmail.com
Personal Bookmarks: How to work a DBS File
|
|
|
Roger Fredriksson
Average Member
Sweden
556 Posts |
Posted - 13 October 2005 : 14:11:43
|
While waiting for some real Snitzer to answer I would test to use USERGROUP_ID in a query based on the table FORUM_USERGROUPS and FORUM_USERGROUPS_MEMBER for checking if the user has access to the page or not.< |
rf/www.avgifter.com |
|
|
Zuel
Average Member
USA
540 Posts |
Posted - 13 October 2005 : 22:36:47
|
quote: Originally posted by Roger Fredriksson
While waiting for some real Snitzer to answer I would test to use USERGROUP_ID in a query based on the table FORUM_USERGROUPS and FORUM_USERGROUPS_MEMBER for checking if the user has access to the page or not.
Having said that. I need to make a SQL script that says something similar too:
dbo.FORUM_USERGROUP_USERS SELECT MEMBER_ID WHERE USERGROUP_ID = 1 or USERGROUP_ID = 2
Then I need a way to check MEMBER_ID vs their ID. If it doesn't match, then Response.Redirect, else show page.
If anyone gets this, can you please point me in the right direction.
Thanks!< |
My Completed Mods: News Mod | Zuel's Avatar Add-on In Development: World of Warcraft Member Roster | [C# Based Forum]
Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.
MSN / E-Mail: ucyimDa_Ruler@Hotmail.com
Personal Bookmarks: How to work a DBS File
|
Edited by - Zuel on 13 October 2005 22:37:53 |
|
|
Roger Fredriksson
Average Member
Sweden
556 Posts |
Posted - 14 October 2005 : 06:03:30
|
MemberID is present when you include the files in your post above. Cheating by using Access i get this SQL:
SELECT [FORUM_USERGROUPS].[USERGROUP_ID], [FORUM_USERGROUP_MEMBERS].[MEMBER_ID] FROM FORUM_USERGROUPS INNER JOIN FORUM_USERGROUP_MEMBERS ON [FORUM_USERGROUPS].[USERGROUP_ID]=[FORUM_USERGROUP_MEMBERS].[USERGROUP_ID] WHERE ((([FORUM_USERGROUPS].[USERGROUP_ID])=2 Or ([FORUM_USERGROUPS].[USERGROUP_ID])=3) And (([FORUM_USERGROUP_MEMBERS].[MEMBER_ID])=[MemberID]));
After generating the recordset it ought to be some easy way to find out if it is empty(=redirect) or not(=access) (While Not objRS.EOF....?) Haven´t got the time just now to look it up - I´ll be back in a couple of hours if no one else steps in and tell you the smartest way to do what originally asked for. (If I am lost I do hope they also delete my posts)< |
rf/www.avgifter.com |
Edited by - Roger Fredriksson on 14 October 2005 06:05:06 |
|
|
Roger Fredriksson
Average Member
Sweden
556 Posts |
Posted - 14 October 2005 : 18:31:55
|
The easy way: If oRS.RecordCount = 0 then redirect else acess (a kind of shorthand asp!!) should do the trick, would it not?< |
rf/www.avgifter.com |
Edited by - Roger Fredriksson on 14 October 2005 18:32:59 |
|
|
Zuel
Average Member
USA
540 Posts |
Posted - 15 October 2005 : 01:01:22
|
Man, thanks for the info. I will test it out when I get some sleep. < |
My Completed Mods: News Mod | Zuel's Avatar Add-on In Development: World of Warcraft Member Roster | [C# Based Forum]
Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.
MSN / E-Mail: ucyimDa_Ruler@Hotmail.com
Personal Bookmarks: How to work a DBS File
|
|
|
Roger Fredriksson
Average Member
Sweden
556 Posts |
Posted - 15 October 2005 : 06:06:13
|
You are welcome, please let me know if it works.< |
rf/www.avgifter.com |
|
|
Zuel
Average Member
USA
540 Posts |
Posted - 16 October 2005 : 21:58:18
|
How would I go about on putting this in the code? I get the following error:
Error Type: Microsoft VBScript compilation (0x800A03FD) Expected 'Case' file path, line 28, column 7 SELECT [FORUM_USERGROUPS].[USERGROUP_ID], [FORUM_USERGROUP_MEMBERS].[MEMBER_ID] FROM FORUM_USERGROUPS INNER JOIN FORUM_USERGROUP_MEMBERS ON [FORUM_USERGROUPS].[USERGROUP_ID]=[FORUM_USERGROUP_MEMBERS].[USERGROUP_ID] WHERE ((([FORUM_USERGROUPS].[USERGROUP_ID])=1 Or ([FORUM_USERGROUPS].[USERGROUP_ID])=2) And (([FORUM_USERGROUP_MEMBERS].[MEMBER_ID])=[MemberID])); ------^< |
My Completed Mods: News Mod | Zuel's Avatar Add-on In Development: World of Warcraft Member Roster | [C# Based Forum]
Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.
MSN / E-Mail: ucyimDa_Ruler@Hotmail.com
Personal Bookmarks: How to work a DBS File
|
|
|
Roger Fredriksson
Average Member
Sweden
556 Posts |
Posted - 17 October 2005 : 05:58:49
|
Hm, you shouldn´t use the code without necessary changes due to how asp works. I will send you asp-code later today.< |
rf/www.avgifter.com |
|
|
Roger Fredriksson
Average Member
Sweden
556 Posts |
Posted - 17 October 2005 : 10:27:59
|
This one works on my local server.Only config and inc_header and a connection-file to your db is needed at the top of the page. Remember that I am just a 'copy & past'- coder and I would very much appreciate if a genuine coder looked at my attempt to help you.
<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_header.asp" -->
<!-- #include file="connection_snitz.asp" -->
<%
'ADO constants used in this file
adUseClient = 3
oSql = "SELECT FORUM_USERGROUPS.USERGROUP_ID, FORUM_USERGROUP_MEMBERS.MEMBER_ID" & _
" FROM FORUM_USERGROUPS INNER JOIN FORUM_USERGROUP_MEMBERS ON FORUM_USERGROUPS.USERGROUP_ID = FORUM_USERGROUP_MEMBERS.USERGROUP_ID" & _
" WHERE (((FORUM_USERGROUPS.USERGROUP_ID)=1 Or (FORUM_USERGROUPS.USERGROUP_ID)=3) AND ((FORUM_USERGROUP_MEMBERS.MEMBER_ID)="&[MemberID]&"))"
Set oRS = Server.CreateObject("ADODB.Recordset")
oRS.CursorLocation = adUseClient
oRS.CacheSize = 5
oRS.Open oSql, cnObj
foundrecs = oRS.RecordCount
ors.close
set ors =nothing
if foundrecs = 0 then
Response.Write ("no access to page")
Response.End
else
Response.Write ("welcome to the page")
Response.End
end if
%> < |
rf/www.avgifter.com |
Edited by - Roger Fredriksson on 17 October 2005 10:29:14 |
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 17 October 2005 : 10:41:10
|
There is a variable in the user groups mod for this already, I can't check my codes at the moment but if I remember I'll have a look tonight. < |
/Tribaliztic - www.gotlandrace.se -
|
|
|
Topic |
|