Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - restrict access to forums?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

restrict access to forums?

 Post Reply Post Reply
Author
DDC Web Guy View Drop Down
Newbie
Newbie


Joined: 05 January 2004
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote DDC Web Guy Quote  Post ReplyReply Direct Link To This Post Topic: restrict access to forums?
    Posted: 16 January 2004 at 2:32pm

My client has a "members only" site in which he would like a forums section. I am trying to figure out how to only allow users that have logged correctly into his site to be able to utilize the Web Wiz Forums.

I am using ASP.VBScript to authenticate the users for his site. However, whenever I try to ammend the header.asp file with the server behavior that would normally restrict a user's access to a page, I get errors when I try to load WWF on my browser.

Suggestions anyone?

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: 16 January 2004 at 6:19pm
What are the errors????
Back to Top
DDC Web Guy View Drop Down
Newbie
Newbie


Joined: 05 January 2004
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote DDC Web Guy Quote  Post ReplyReply Direct Link To This Post Posted: 21 January 2004 at 9:46am

My error messages are listed below, along with what changes I made to the header.asp file. Keep in mind, that I want to be able to restrict user access to the forum to members of the parent site. Likewise, I want users to be able to logout from the parent site like they can do from any other site page.

1.  AFTER COPYING HEADER INFORMATION THAT APPEARS AT THE TOP OF ALL PARENT SITE PAGES (INCLUDES LOGOUT BEHAVIOR)

Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'MM_Logout'
/WebWiz/forum/includes/header.asp, line 89

2.  REMOVED LOGOUT BEHAVIOR

Active Server Pages error 'ASP 0141'
Page Command Repeated
/WebWiz/forum/includes/header.asp, line 1
The @ command can only be used once within the Active Server Page.

3.  REMOVED "<%@LANGUAGE="VBSCRIPT"%>" FROM LINE 1

page loads

4.  ADDED BEHAVIOR TO RESTRICT PAGE ACCESS

Active Server Pages error 'ASP 0141'
Page Command Repeated
/WebWiz/forum/includes/header.asp, line 1
The @ command can only be used once within the Active Server Page.

5.  REMOVED "<%@LANGUAGE="VBSCRIPT"%>" FROM LINE 1 (AGAIN)

Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'MM_authorizedUsers'
/WebWiz/forum/includes/header.asp, line 3

Thanks!
James

 

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: 21 January 2004 at 1:13pm
All these errors are happening becuase you are trying to intergarte other code into the forum.

The problem isn't with the forum codes, it's with the code that you are trying to put into it yourself, it's bad coding and looking at the MM part I guess you are trying to use Dreamweaver to write the code.

Most of these errors are happening becuase you are trying to introduce new variables without first declaring them (this is bad programming practise).

You need to either remove the Option Explicit line from each file of the forum, or correct the bad programming and declare all the new varaibles that you are introducing before using them using dim statements. eg:-

Dim MM_authorizedUsers

The <%@LANGUAGE="VBSCRIPT"%> error is happening becuase the forum already uses that line in it's code and the new code you are introducing also has it. This line can only be used once.




Edited by -boRg-
Back to Top
DDC Web Guy View Drop Down
Newbie
Newbie


Joined: 05 January 2004
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote DDC Web Guy Quote  Post ReplyReply Direct Link To This Post Posted: 21 January 2004 at 2:07pm

All of this "bad code" works perfectly fine in all other pages on the parent site.

Once a user has logged in to the site, he/she is able to logout from anywhere on the site using the very code that you are saying is "bad." Likewise, any non-member whom tries to access a restricted page on the site is appropriately redirected to a "Please log-in first" page.

But simply copying all header code into the header.asp file is not working for me. I am not saying that some of the .ASP code possibly doesn't need some tweaking to make it work ("Hey! That's kinda why I am here in the first place."), but to just label all of it as "bad coding" I don't feel is fair.

And yes, I am using Macromedia Dreamweaver (MX 2004 to be exact)and their built in behaviors. I am not a proficient .ASP programmer by any stretch.

I am just hoping someone might give me some suggestions as to why my code does not work when I copy it into my header.asp as is suggested in the help files and in this forum.

Thanks!
James

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: 21 January 2004 at 2:47pm
If you read my last post you will see that I have given a suggestion to fix the code.

Variables should always be declared, but VbScript has option explicit turned off by default so that it allows you to get away with sloppy coding (such as that done by programs like Dreamweaver). So yes the code would run in the rest of your site as option explicit isn't enabled allowing sloppy code to run.

In the forum code stricter coding standards are used so option explicit is turned on, this forces all variables to have to be declared before being used.

If you read my last post I did give a suggestion on how to fix Dreamweavers sloppy coding, or removing the option explicit from each file used in thf forum.
Back to Top
MadDog View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 01 January 2002
Status: Offline
Points: 3008
Post Options Post Options   Thanks (0) Thanks(0)   Quote MadDog Quote  Post ReplyReply Direct Link To This Post Posted: 21 January 2004 at 3:52pm
Originally posted by DDC Web Guy DDC Web Guy wrote:

All of this "bad code" works perfectly fine in all other pages on the parent site.

Just because it works doesnt mean its good code.

If its made in Dreamweaver, i bet the code is extremly bad. Dreamweaver sucks for programming ASP. Hell, just about all Rich Text Editors suck for programming ASP.

Back to Top
 Post Reply Post Reply

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.