Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - How can I require login for non-forum pages?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How can I require login for non-forum pages?

 Post Reply Post Reply Page  12>
Author
ForumDummy View Drop Down
Groupie
Groupie


Joined: 04 December 2006
Status: Offline
Points: 58
Post Options Post Options   Thanks (0) Thanks(0)   Quote ForumDummy Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
myhyipforum.com View Drop Down
Newbie
Newbie
Avatar

Joined: 13 April 2006
Location: East Timor
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote myhyipforum.com Quote  Post ReplyReply Direct Link To This Post 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>




Back to Top
ForumDummy View Drop Down
Groupie
Groupie


Joined: 04 December 2006
Status: Offline
Points: 58
Post Options Post Options   Thanks (0) Thanks(0)   Quote ForumDummy Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
myhyipforum.com View Drop Down
Newbie
Newbie
Avatar

Joined: 13 April 2006
Location: East Timor
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote myhyipforum.com Quote  Post ReplyReply Direct Link To This Post 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>



Back to Top
ForumDummy View Drop Down
Groupie
Groupie


Joined: 04 December 2006
Status: Offline
Points: 58
Post Options Post Options   Thanks (0) Thanks(0)   Quote ForumDummy Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
ForumDummy View Drop Down
Groupie
Groupie


Joined: 04 December 2006
Status: Offline
Points: 58
Post Options Post Options   Thanks (0) Thanks(0)   Quote ForumDummy Quote  Post ReplyReply Direct Link To This Post 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">&nbsp;<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
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 27 December 2006 at 10:23am
Originally posted by ForumDummy 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.
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.