| Author |
Topic Search Topic Options
|
ForumDummy
Groupie
Joined: 04 December 2006
Status: Offline
Points: 58
|
Post Options
Thanks(0)
Quote Reply
Topic: How can I require login for non-forum pages? Posted: 26 December 2006 at 2:11am |
|
I am setting up the forum as part of a website. Some of non-forum pages have sensitive material which only forum members are allowed to see. I want them to login to see those pages but I don't want them to have to login twice - once to view the non-forum pages and once to view the forum pages.
Can someone please tell me what code I need to put at the top of my non-forum pages so that if someone logs into the site they will be logged into the forum and visa versa?
What code would I need to forward the user to the page the clicked on (forum or non-forum) once they have submitted the correct user ID and Password?
BTW, anyone who has registered and been approved will be allow access access to the "sensitive" non-forum pages.
Edited by ForumDummy - 26 December 2006 at 2:14am
|
 |
WebWiz-Bruce
Admin Group
Web Wiz Developer
Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
|
Post Options
Thanks(0)
Quote Reply
Posted: 26 December 2006 at 10:59am |
|
Have a look at the functions/functions_member_API.asp file in notepad, all you need to know is within that file.
|
|
|
 |
myhyipforum.com
Newbie
Joined: 13 April 2006
Location: East Timor
Status: Offline
Points: 16
|
Post Options
Thanks(0)
Quote Reply
Posted: 26 December 2006 at 2:16pm |
use this on every asp page before <html>:
'If the user is not allowed then send them away If intGroupID = 2 OR blnActiveMember = False OR blnBanned Then 'Clean up Set rsCommon = Nothing
'Clean up Call closeDatabase() 'Redirect Response.Redirect("insufficient_permission.asp" & strQsSID1) End If
%>
<html> |
|
 |
ForumDummy
Groupie
Joined: 04 December 2006
Status: Offline
Points: 58
|
Post Options
Thanks(0)
Quote Reply
Posted: 26 December 2006 at 3:24pm |
|
myhyipforum.com, thank you for the code. Does this code bring up a login screen? And if they login in with it, will it redirect them to the page they were trying to access?
Also, can you tell me how to do this if the asp pages are in a directory level above the forum folder?
|
 |
myhyipforum.com
Newbie
Joined: 13 April 2006
Location: East Timor
Status: Offline
Points: 16
|
Post Options
Thanks(0)
Quote Reply
Posted: 26 December 2006 at 3:32pm |
directory level: forum/~all your asp file must be here! if guest (not login member) then redirect to "http://forums.webwiz.net/insufficient_permission.asp" full code:
<% @ Language=VBScript %> <% Option Explicit %> <!--#include file="common.asp" -->
<%
'Set the response buffer to true as we maybe redirecting and setting a cookie Response.Buffer = true
'Make sure this page is not cached Response.Expires = -1 Response.ExpiresAbsolute = Now() - 2 Response.AddHeader "pragma","no-cache" Response.AddHeader "cache-control","private" Response.CacheControl = "No-Store"
'If the user is not allowed then send them away If intGroupID = 2 OR blnActiveMember = False OR blnBanned Then 'Clean up Set rsCommon = Nothing
'Clean up Call closeDatabase() 'Redirect Response.Redirect("insufficient_permission.asp" & strQsSID1) End If
%>
<html>
|
|
 |
ForumDummy
Groupie
Joined: 04 December 2006
Status: Offline
Points: 58
|
Post Options
Thanks(0)
Quote Reply
Posted: 26 December 2006 at 3:34pm |
|
-boRg- Thanks for the tip but there is a lot of code in that file and most of it goes over my head.
|
 |
ForumDummy
Groupie
Joined: 04 December 2006
Status: Offline
Points: 58
|
Post Options
Thanks(0)
Quote Reply
Posted: 26 December 2006 at 3:44pm |
|
myhipforum.com, that was easy enough. However, can you tell me how to get it to redirect the members to the asp page they originally clicked on? The way it is now, it redirects them to the forum page.
One idea I have is this. If we made a commons page and an insufficient_permission.asp page for each page that we wanted the user redirected to, we could change the default.asp below to whatever page we wanted it redirected to, correct?
<td><strong><img src="<% = strImagePath %>open_folder_icon.gif" border="0" align="absmiddle"> <a href="default.asp<% = strQsSID1 %>"><strong><% = strMainForumName %></strong></a><% = strNavSpacer %><% = strTxtAccessDenied %></strong></td>
For example, if we had a page called abc.asp and wanted the member redirected to abc.asp after login we could have a commons1.asp page that calls an insufficient_permission1.asp page with the redirect back to the abc.asp page, correct?
Edited by ForumDummy - 26 December 2006 at 4:48pm
|
 |
WebWiz-Bruce
Admin Group
Web Wiz Developer
Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
|
Post Options
Thanks(0)
Quote Reply
Posted: 27 December 2006 at 10:23am |
ForumDummy wrote:
-boRg- Thanks for the tip but there is a lot of code in that file and most of it goes over my head.
|
Have a read of the file most of it is text on how to enable and use the API which is very simple. If you want to use the other methods and modify the code you would need to purchase a license for the software as modifications are not permitted on the free versions.
|
|
|
 |