Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Current Version (Old)
 password protect areas
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

madmark
Starting Member

20 Posts

Posted - 01 August 2001 :  00:38:36  Show Profile
I'm sure this is a simple question but I can't seem to find it out:

How do I make it so that you HAVE to be logged in as a member to
view certain pages such as 'statistics' and 'members'?

What would be even cooler is if I could limit those pages to a specified
list or moderators.

I just don't want anyone to view the list of members on the site (it's a site
for a teacher's union, sort of confidential reasons).
Thanks-
Mark Swanson

www.mydta.org

GauravBhabu
Advanced Member

4288 Posts

Posted - 01 August 2001 :  08:15:24  Show Profile
Just add this script to the top of the page after include statements you want to restrict access:




<!--#INCLUDE FILE="include/inc_top.asp" -->
Below the above line add the following script

<%
if mlev < 1 then %>
<table width="50%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="100%" bgcolor="<% =strPopUpTableColor %>">
<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">Members only Area!</font></p>
<p align="center"><font color="red" size="<% =strHeaderFontSize %>">You are not registered</font>
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">(</font><a href="policy.asp" alt="register"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">register now</font></a><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">)</font><font color="red" size="<% =strHeaderFontSize %>"> or logged in</font></p>
<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><a href="JavaScript:history.go(-1)">Go Back To Previous Page.</a></font></p>
<p></p>
</td>
</tr>
</table>


Share A Square at forumSquare


gauravbhabu

There is only one miracle...That is LIFE!
Go to Top of Page

madmark
Starting Member

20 Posts

Posted - 01 August 2001 :  12:39:56  Show Profile
Thank you for the response....
However, I have tried to insert this code in my 'members.asp', 'events.asp', etc., but it gives me this error:

Microsoft VBScript compilation error '800a03f6'

Expected 'End'

If I understood you right, I am to place the code you gave me directly after the <!--#INCLUDE FILE="include/inc_top.asp" --> statement.

Mine looks like this (with the error):

<!--#INCLUDE FILE="config.asp" -->
<!--#INCLUDE FILE="inc_functions.asp" -->
<!--#INCLUDE FILE="inc_top.asp" -->
<%
if mlev < 1 then %>
<table width="50%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="100%" bgcolor="<% =strPopUpTableColor %>">
<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">Members only Area!</font>
</p> <p align="center"><font color="red" size="<% =strHeaderFontSize %>">You are not registered</font>
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">(</font><a href="policy.asp" alt="register">
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">register now</font></a>
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">)
</font><font color="red" size="<% =strHeaderFontSize %>"> or logged in</font></p>
<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><a href="JavaScript:history.go(-1)">Go Back To Previous Page.</a></font></p>
<p></p>
</td>
</tr>
</table>

etc. etc.

Thanks!
Mark Swanson






Edited by - madmark on 01 August 2001 12:43:42
Go to Top of Page

Sgt Dak
Starting Member

France
15 Posts

Posted - 02 August 2001 :  05:05:06  Show Profile  Visit Sgt Dak's Homepage
I think you may just have to add this line after the script given by GauravBhabu :
<% End If %>

=========
Sgt Dak :
=========

"We're all around you"

Go to Top of Page

madmark
Starting Member

20 Posts

Posted - 02 August 2001 :  10:53:47  Show Profile
Thank you, that does clear up the error and does warn you with :

Members only Area!

You are not registered ( register now ) or logged in

Go Back To Previous Page.


However, below this warning is still all the info that shouldn't be seen if you
are not logged in. This code here works by checking if you are logged in and
then lets you see the page if you are. It will warn you that you are not
logged in also, but you can still view the page.... Hmmmm... Is it where I
stuck this code? Do I need to put it somewhere else? Right now, I have it
below my includes in the member.asp.


<!--#INCLUDE FILE="config.asp" -->
<!--#INCLUDE FILE="inc_functions.asp" -->
<!--#INCLUDE FILE="inc_top.asp" -->
<%
if mlev < 1 then %>
<table width="50%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="100%" bgcolor="<% =strPopUpTableColor %>">
<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">Members only Area!</font>
</p> <p align="center"><font color="red" size="<% =strHeaderFontSize %>">You are not registered</font>
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">(</font><a href="policy.asp" alt="register">
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">register now</font></a>
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">)
</font><font color="red" size="<% =strHeaderFontSize %>"> or logged in</font></p>
<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><a href="JavaScript:history.go(-1)">Go Back To Previous Page.</a></font></p>
<p></p>
</td>
</tr>
</table>
<% End If %>

Thanks-

Mark Swanson



Edited by - madmark on 02 August 2001 17:47:05
Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 02 August 2001 :  21:08:15  Show Profile
There are two ways to accomplish what you want.

1. You can put Response.End right before the 'end if', like so:
<%
Response.End
End If %>
2. or you can put <% Else %> where the <% End If %> is and move the <% End If %> code to the very bottom of the page.

Both ways would work.


- David
Go to Top of Page

madmark
Starting Member

20 Posts

Posted - 02 August 2001 :  23:09:19  Show Profile
As always Davio, you are my hero! Works like a charm! For others out there, if you want to protect areas of your forum from non-registered users, just insert the follwing code after your initial includes:

<%
if mlev < 1 then %>
<table width="50%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="100%" bgcolor="<% =strPopUpTableColor %>">
<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">Members only Area!</font>
</p> <p align="center"><font color="red" size="<% =strHeaderFontSize %>">You are not registered</font>
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">(</font><a href="policy.asp" alt="register">
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">register now</font></a>
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">)
</font><font color="red" size="<% =strHeaderFontSize %>"> or logged in</font></p>
<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><a href="JavaScript:history.go(-1)">Go Back To Previous Page.</a></font></p>
<p></p>
</td>
</tr>
</table>
<%
Response.End
End If %>

Works Great!
Thanks-
Mark Swanson


Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.37 seconds. Powered By: Snitz Forums 2000 Version 3.4.07