Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Integrating Log in feature to rest of site
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Integrating Log in feature to rest of site

 Post Reply Post Reply Page  12>
Author
Landlord-Forum View Drop Down
Newbie
Newbie
Avatar

Joined: 11 January 2006
Location: United Kingdom
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Landlord-Forum Quote  Post ReplyReply Direct Link To This Post Topic: Integrating Log in feature to rest of site
    Posted: 29 June 2006 at 8:21pm
Hi all,
 
still a bit of a novice with the code aspect of all this, but forum is going well, so a big thankyou again to all here.
 
i have a number of documents that i onbly wnat registered members to download, currently i have placed the only link to these files in a memebrs only forum, which obviously you only access by being a logged in registered member.
 
of course this means that if someone who was registered wanted to they could email that link to a friend who could then access the page without being a member.
 
is it possible to modify or create other non forum pages that checked to see that the viewer was a registered member of the forum?
 
 
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 30 June 2006 at 1:15am
You need to google for an asp anti hotlinking script.
These scripts are often used to prevent hotlinking images.
Instead of inserting a link directly to a file, you link to the script with a file id.
The script then does whatever validation you want - ususally checking to see if the http_referrer is local, and then streams the file identified by the file id to the requestor after putting the appropriate mime type in the header.
You could add a check for the wwf cookie in the script.

hotscripts.com and aspin.com probably have hotlink prevention scripts.

Lead me not into temptation... I know the short cut, follow me.
Back to Top
Mikey View Drop Down
Senior Member
Senior Member

1979

Joined: 06 October 2003
Location: United Kingdom
Status: Offline
Points: 839
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mikey Quote  Post ReplyReply Direct Link To This Post Posted: 30 June 2006 at 2:03am
You can create other pages using the forums login and other DB credentials.

I do this by including the 'common.asp' file from the forums root folder, in all pages i need to.
Handyman man?
Back to Top
Landlord-Forum View Drop Down
Newbie
Newbie
Avatar

Joined: 11 January 2006
Location: United Kingdom
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Landlord-Forum Quote  Post ReplyReply Direct Link To This Post Posted: 30 June 2006 at 9:55pm

Thank you both,

i might be wrong but Mikey i think your solution sounds the easiest for me given my limited experience with this, could you answer this.

If i use the commom file presumably that has a "user is logged in" check type function, is that right?
 
if so could you point me at the right bit of the code?
 
and is it a simple case that the bit of the commom file checks the user is logged in and i just add to it that if yes, let them view the page if not send them to another page that tells them to login? (the same way the forum does?)
 
so i basically strip out the rest of the file and just leave the check the user is logged in function?
 
many thanks all your help is much appreciated
Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post Posted: 30 June 2006 at 10:18pm
if you include the common.asp file remember to close the DB connections

just add the following code to the end of the page, or before any Redirects

<% Call closeDatabase() %>

once you include the common.asp file you can get details such as username and member id, and wether their activated or not, eg:

lngLoggedinUserID = members user id, this is good for checking if their logged in

strLoggedInUsername = the members username

blnActiveMember  = is either true or false, depending wether the members account is active

blnAdmin = if the member is a forum Administrator

blnMod = if the user is a forum Moderator


a simple example is below:
<%
  if lngLoggedInUserID = 2 then
      Response.Write("You are a guest")
  else
      if blnActiveMember then
          Response.Write("You are logged in as" & strLoggedInUsername )
         if blnAdmin then
             Response.Write(", and your the forum administrator")
         elseif blnMod then
             Response.Write(", and your a forum moderator")
      else
          Response.Write("You are logged in as" & strLoggedInUsername & " , but you still need to activate your account")
      end if
  end if
%>

umm, maybe that'll be a bit advanced for you, but if you put that in a page it'll tell you info on the user viewing it
S2H.co.uk - WebWiz Mods and Skins

For support on my mods + skins, please use my forum.
Back to Top
Mikey View Drop Down
Senior Member
Senior Member

1979

Joined: 06 October 2003
Location: United Kingdom
Status: Offline
Points: 839
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mikey Quote  Post ReplyReply Direct Link To This Post Posted: 30 June 2006 at 10:30pm
Originally posted by Scotty_32 Scotty_32 wrote:

if you include the common.asp file remember to close the DB connections

just add the following code to the end of the page, or before any Redirects

<% Call closeDatabase() %>



Lol my bad

Should ALWAYS close database connections!!!

That run down lays it out perfectly.
Handyman man?
Back to Top
Landlord-Forum View Drop Down
Newbie
Newbie
Avatar

Joined: 11 January 2006
Location: United Kingdom
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Landlord-Forum Quote  Post ReplyReply Direct Link To This Post Posted: 30 June 2006 at 11:09pm
thanks, i kind of follow it.
 
i am at the stage where i can see what things are doing, but writing new things is a bit past me yet.
 
i think what i need is very simple:
 
i amhappy that people come through the forum login toaccess the page so when they click a link in the forum post they go to a page written by me
 
if the visitor to the page is a member of the forum (or logged in to the forum whichever is easier) then i show them them the document.
 
if they are not a member/logged in then they get a message that say, please register/log in (whichever it is)
 
BTW,  i know i could simply put a link to the doc in a members only forum but the doc would display if someone published the link outside of that forum, so i need the page to verify that the viewer is a member before diplaying the contents of the doc
 
taking you example above could i write:
 
<%
  if lngLoggedInUserID = 2 then
      Response.Write("Contents of document etc etc.....")
  else
      if blnActiveMember then
          Response.Write("not needed")
         if blnAdmin then
             Response.Write(", not needed")
         elseif blnMod then
             Response.Write(", not needed")
      else
          Response.Write("You are logged in as" & strLoggedInUsername & " , but you still need to activate your account")
      end if
  end if
%>
 
i take it user id =2 is a member, what about non members?
 
not in code but as an example of the simplicity of what i need (if you know what i mean)
 
if membeer = yes then write (document)
 
else write (sod off and register/sign in.....thank you)
 

 
Back to Top
Mikey View Drop Down
Senior Member
Senior Member

1979

Joined: 06 October 2003
Location: United Kingdom
Status: Offline
Points: 839
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mikey Quote  Post ReplyReply Direct Link To This Post Posted: 01 July 2006 at 12:29am
I wrote a really long decription but then relised you'd already wrtote it at the bottom of your post

The user ID 2 is for the guest group aka non-members

I think what you may want is something like this...


<%
if blnActiveMember then
%>

Your document goes in this bit here

<%
else
%>

Redirect them to login or tell em they do not have access

<%
end if
%>


This bit of code should show em the document if they are logged in or not if they are a guessed.
Handyman man?
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.