Print Page | Close Window

Integrating Log in feature to rest of site

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums Modifications
Forum Description: Mod's and Add-on's for Web Wiz Forums.
URL: https://forums.webwiz.net/forum_posts.asp?TID=20489
Printed Date: 29 March 2026 at 4:41am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Integrating Log in feature to rest of site
Posted By: Landlord-Forum
Subject: Integrating Log in feature to rest of site
Date 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?
 
 



Replies:
Posted By: dpyers
Date 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.


Posted By: Mikey
Date 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?


Posted By: Landlord-Forum
Date 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


Posted By: Scotty32
Date 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 - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins

For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .


Posted By: Mikey
Date 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?


Posted By: Landlord-Forum
Date 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)
 

 


Posted By: Mikey
Date 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?


Posted By: degergio
Date Posted: 29 July 2006 at 1:11pm
this is the best way of integrating wwf membership to any existing web-site.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net