| Author |
Topic Search Topic Options
|
Andy Rowland
Groupie
Joined: 13 July 2004
Location: London
Status: Offline
Points: 86
|
Post Options
Thanks(0)
Quote Reply
Topic: Show if user logged in Posted: 07 March 2008 at 10:50pm |
|
Is there a way of showing or not showing an area on a page only if you are logged in to the forum, eg Administartor. I have a comments section on a page and only want registered forum members who are logged in to see the comments form. I am using mySQL version of the forum. Also using Dreamweaver. Thanks
|
|
Who the hell is calling at this time?
|
 |
StarDust
Senior Member
Joined: 14 May 2007
Location: Bangladesh
Status: Offline
Points: 310
|
Post Options
Thanks(0)
Quote Reply
Posted: 08 March 2008 at 1:30pm |
|
It is located right left to this post. :)
|
|
|
 |
Scotty32
Moderator Group
Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
|
Post Options
Thanks(0)
Quote Reply
Posted: 08 March 2008 at 5:32pm |
He isnt refering to the online status stardust. anyway, if you want to make an area for members only just do:
<% if lngLoggedInUserID <> 2 then Response.Write("You are logged in") end if %> |
if you want it to be for Admins only just do:
<%
if intGroupID = 1 then
Response.Write("You are an Administrator")
end if
%> |
Also, i have a tutorial on Member-Only Pages. When i get time i intend to do a list of Member related commands (such as how to get the users id, username, group etc)
|
|
|
 |
StarDust
Senior Member
Joined: 14 May 2007
Location: Bangladesh
Status: Offline
Points: 310
|
Post Options
Thanks(0)
Quote Reply
Posted: 08 March 2008 at 9:03pm |
|
My understanding is so poor. Sorry guys.
I am a bit weak in receiving department.
|
|
|
 |
Andy Rowland
Groupie
Joined: 13 July 2004
Location: London
Status: Offline
Points: 86
|
Post Options
Thanks(0)
Quote Reply
Posted: 08 March 2008 at 9:17pm |
Thanks for your help.
I have already used:
<% if lngLoggedInUserID <> 2 then Response.Write("You are logged in") end if %> |
and then scroll down until you get to the Latest Review and Add Review. I want to hide the Add Review form if you are not logged in using the forum.
Thanks.
|
|
Who the hell is calling at this time?
|
 |
Scotty32
Moderator Group
Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
|
Post Options
Thanks(0)
Quote Reply
Posted: 10 March 2008 at 12:45pm |
|
That page doesnt appear to be connected to the forum.
You would need to include the /forum/common.asp file into that page for the above code to work.
Check my Members Only tutorial and combine it with the above code for it to work.
|
|
|
 |
Andy Rowland
Groupie
Joined: 13 July 2004
Location: London
Status: Offline
Points: 86
|
Post Options
Thanks(0)
Quote Reply
Posted: 10 March 2008 at 8:59pm |
All I want is to hide the form on that page, not the entire page. As understand your script blocks access to pages that include your code to none registerd forum members.
How would your code be used to do this on my page.
Thanks for your help on this.
|
|
Who the hell is calling at this time?
|
 |
Scotty32
Moderator Group
Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
|
Post Options
Thanks(0)
Quote Reply
Posted: 11 March 2008 at 12:27pm |
As I said, you will need to merge the two. The tutorial tells you how to block access, so you would simply remove the redirecting code and change it to suit your needs. basically you need this at the top of the page:
<!--#include virtual="/forum/common.asp" --> |
and then you would use this where you want to hide:
<% if lngLoggedInUserID <> 2 then %>
*What you want to hide here*
<% end if %> |
And then you need to add this at the bottom of the page to close any database connections created by the forum.
<% Call closeDatabase() %> |
|
|
|
 |