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

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 check for logged in user
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dongough
Starting Member

6 Posts

Posted - 27 May 2009 :  18:59:43  Show Profile  Reply with Quote
Hi

Can anyone assist with the correct code for this please (I'm new to ASP and not really sure what I'm doing)

I want to allow only logged in forum members to access another non-forum part of the website. It's all in the same directory as the forum code.

If they are logged in, they can access the other page/s, if they are not logged in, they are redirected to the forum login page

The response.redirect & response.write each appear to work fine. I'm just lost finding the right code to check the members login status

Thanks


<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_func_common.asp"-->

<%

select case Request.Form("Method_Type")
case "login"
if strLoginStatus = 0 then
Response.Redirect "default.asp"

Else

Response.Write "<html>" & vbNewline & _
"<head>" & vbNewline & _
"<script language=""JavaScript"" type=""text/javascript"">" & vbNewLine & _
"<!--" & vbNewLine & _
"if (location.href == top.location.href) {" & vbNewLine & _
"top.location.href = 'outbackclub.htm' }" & vbNewLine & _
"// -->" & vbNewLine & _
"</script>" & vbNewLine & _
"</head>" & vbNewline & _
"<frameset rows=""100%"" border=""0"">" & vbNewline & _
"<frame name=""members"" src=""a welcome page"" marginwidth=""0"" marginheight=""0"" scrolling=""auto"" frameborder=""0"">" & vbNewline & _
"</frameset>" & vbNewline & _
"<body>" & vbNewline & _
"</body>" & vbNewline & _
"</html>" & vbNewline
End if
End select
%>

<moved from="Help: General / Current Version (v3.4.xx)" by="Shaggy" />

Edited by - Shaggy on 29 May 2009 04:30:16

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 27 May 2009 :  21:06:12  Show Profile  Reply with Quote
Use mLev.

if mLev > 0 then ' Logged in
  ' Allow access
else
  Response.Redirect ....
end if
Go to Top of Page

dongough
Starting Member

6 Posts

Posted - 28 May 2009 :  15:49:30  Show Profile  Reply with Quote
Hi

Many thanks for that, I've set it up as you suggest however there still appears to be a problem

The code seems to be unable to read the member level. Whether I am logged in to the Forum or not, the code alwasys responds as if the mlev=0. I hvae tested this by changing the code to read mlev = 0, mlev = 1, mlev = 2, mlev = 3, ect & based on the test results I have determined that the code cannot see the correct member level when I am logged in.

Is there an error in my code somewhere, some extra code needed, or a missing include?

Regards
Don

<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_func_secure.asp" -->
<!--#INCLUDE FILE="inc_sha256.asp"-->
<!--#INCLUDE FILE="inc_func_common.asp"-->
<!--#INCLUDE FILE="inc_func_member.asp" -->

<%
if mlev > 0 then
Response.Write "<html>" & vbNewline & _
"<head>" & vbNewline & _
"<script language=""JavaScript"" type=""text/javascript"">" & vbNewLine & _
"<!--" & vbNewLine & _
"if (location.href == top.location.href) {" & vbNewLine & _
"top.location.href = 'outbackclub.htm' }" & vbNewLine & _
"// -->" & vbNewLine & _
"</script>" & vbNewLine & _
"</head>" & vbNewline & _
"<frameset rows=""100%"" border=""0"">" & vbNewline & _
"<frame name=""members"" src=""my welcome page"" marginwidth=""0"" marginheight=""0"" scrolling=""auto"" frameborder=""0"">" & vbNewline & _
"</frameset>" & vbNewline & _
"<body>" & vbNewline & _
"</body>" & vbNewline & _
"</html>" & vbNewline
else
Response.Redirect "default.asp"
End if
%>
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 29 May 2009 :  04:29:37  Show Profile  Reply with Quote
You'll need to call the chkUser function in order to assign a value to the mlev function. Have a look in inc_header.asp to see how it's done.


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

dongough
Starting Member

6 Posts

Posted - 29 May 2009 :  04:39:38  Show Profile  Reply with Quote
Many thanks

I'll give it a go
Go to Top of Page

dongough
Starting Member

6 Posts

Posted - 02 June 2009 :  02:05:05  Show Profile  Reply with Quote
All sorted & running

Thanks for your help

Don
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 02 June 2009 :  04:42:08  Show Profile  Reply with Quote
Glad you've got it sorted.
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 02 June 2009 :  05:21:40  Show Profile  Reply with Quote
You're welcome


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.11 seconds. Powered By: Snitz Forums 2000 Version 3.4.07