Print Page | Close Window

Use WWF authentication for other parts of website

Printed From: S2H.co.uk
Category: Web Wiz Forums
Forum Name: Web Wiz Forums Discussions
Forum Description: Discussions and advice on Web Wiz Forums
URL: http://www.s2h.co.uk/forum/forum_posts.asp?TID=188
Printed Date: 03 Jul 2022 at 3:58pm


Topic: Use WWF authentication for other parts of website
Posted By: Info_Tech
Subject: Use WWF authentication for other parts of website
Date Posted: 04 Oct 2010 at 4:59am
Hello guys...

Is there a way to use WWF authentication for pages that are outside of the forum? If so, how can that be done? Thanks!



Replies:
Posted By: Matt
Date Posted: 09 Oct 2010 at 4:02pm

You can secure pages with our ../wwf/tips/intergration/member-only-pages.asp - Member-Only Pages tutorial.

Or if you just want to grab user details (eg submitting a form) you can follow part of the tutorial (eg everything except for the redirect).

Details you can use are (among others)

Username = strLoggedInUsername
Group ID = intGroupID (1 = admin, 2 = guest, rest depend on how you set it)
User ID = lngLoggedInUserID (1 = admin, 2 = guest, rest are users who signed up)

so adding the following to a page will print the members username:

[code]<%=strLoggedInUsername%>[/url]


Posted By: Info_Tech
Date Posted: 13 Oct 2010 at 11:19pm
Scotty, this is great, thank you!!!
I am setting up a page (conference page) that involves other attributes, such as username color, gender, etc... so I don't know if I should do it so that they are logged in first, then redirected to a page where they pick a username color before they can login to the conference page or what.. I'm working on it and will probably need some more help. Thank you again!


Posted By: Info_Tech
Date Posted: 14 Oct 2010 at 2:40am
Ok here is the first problem I'm having:

I'm trying to include a URL to get to a member profile... so I'm using the following
Profile URL: <a href="forum/member_profile.asp?PF=<% = lngUserID %>" rel="nofollow"><% = strLoggedInUsername %></a><br /> 

However, the URL isn't including the User ID at the end... it only takes you to this:

forum/member_profile.asp?PF=

As you could see from the URL above, the user ID is missing after the equal ( = ) sign... what am I missing?


Posted By: Matt
Date Posted: 14 Oct 2010 at 6:02pm

Is this a link for the currently logged in user?

If so, then "lngUserID" is wrong and, as I said above, should be "lngLoggedInUserID"

for example:
Profile URL: <a href="forum/member_profile.asp?PF=<% = lngLoggedInUserID %>" rel="nofollow"><% = strLoggedInUsername %></a><br />


If this is your own custom code grabbing the user data from somewhere else, I would need more info on where "lngUserID" is set.




Posted By: Info_Tech
Date Posted: 14 Oct 2010 at 6:45pm
Dear Scotty,

You're the man! The "lngLoggedInUserID" did the trick : ) 

Now, I'm struggling to display the user's gender... my own profile displays my gender but when i try to grab it from outside the forum, I keep getting "Not Given".. even though it's specified.
I'm using the following code:

Gender: <% If strGender <> "" Then Response.Write(strGender) Else Response.Write(strTxtNotGiven) %>

I appreciate all the help you've provided... it helped me tremendously!



Posted By: Matt
Date Posted: 14 Oct 2010 at 7:16pm

The Gender field isnt set as part of the current users details, its only things that are used frequently throughout the forum for that user.

The full list of variables set globally for the current user is:

Quote strLoggedInUsername
intGroupID
lngLoggedInUserID
blnActiveMember
strDateFormat
strTimeOffSet
intTimeOffSet
blnReplyNotify
blnAttachSignature
blnWYSIWYGEditor
strLoggedInUserEmail
intNoOfPms
dtmUserLastVisitDate
blnLoggedInUserSignature
blnBanned
blnAttachments
blnImageUpload



You can add more if you wish, to the "functions/functions_login.asp" file.

Add the variable (eg strLoggedInUserGender) to the start of the Function around line 321 like so:

'Sun procedure to get the user data for users

Public Sub getUserData(ByVal strSessionItem)
    Dim strLoggedInUserGender

Though I would recommend using something unique. You will notice from my mods that I generally prefix things with "S2H", For example "strS2HUserGender" so that it isnt likely to create a conflict with the forum software.


Add the fields you want (in this case "Gender" to the end of (roughly) line 350, it should look like so:

strSQL = "SELECT " & strDbTable & "Author.Username, " & strDbTable & "Author.Author_ID, " & strDbTable & "Author.Group_ID, " & strDbTable & "Author.Active, " & strDbTable & "Author.Signature, " & strDbTable & "Author.Author_email, " & strDbTable & "Author.Date_format, " & strDbTable & "Author.Time_offset, " & strDbTable & "Author.Time_offset_hours, " & strDbTable & "Author.Reply_notify, " & strDbTable & "Author.Attach_signature, " & strDbTable & "Author.Rich_editor, " & strDbTable & "Author.Last_visit, " & strDbTable & "Author.No_of_PM, " & strDbTable & "Author.Banned, " & strDbTable & "Group.Image_uploads, " & strDbTable & "Group.File_uploads, " & strDbTable & "Author.Gender " & _


Then grab the data Around like 390 like so:

            blnImageUpload = CBool(rsCommon("Image_uploads"))

            strLoggedInUserGender = rsCommon("Gender")




Posted By: Info_Tech
Date Posted: 16 Oct 2010 at 9:16pm
Hello Scotty,

I tried doing the following for two items I'm trying to grab (Gender and Avatar) so I did the following in the functions/functions_login.asp file:

  1. Declared the variable:

    'Sun procedure to get the user data for users
    Public Sub getUserData(ByVal strSessionItem)

    'Grab User Gender
    Dim strLoggedInUserGender
    'Grab User Avatar
    Dim strLoggedInUserAvatar 


  2. Added both items to the following line, as follows:
    strSQL = "SELECT " & strDbTable & "Author.Username, " & strDbTable & "Author.Author_ID, " & strDbTable & "Author.Group_ID, " & strDbTable & "Author.Active, " & strDbTable & "Author.Signature, " & strDbTable & "Author.Author_email, " & strDbTable & "Author.Date_format, " & strDbTable & "Author.Time_offset, " & strDbTable & "Author.Time_offset_hours, " & strDbTable & "Author.Reply_notify, " & strDbTable & "Author.Attach_signature, " & strDbTable & "Author.Rich_editor, " & strDbTable & "Author.Last_visit, " & strDbTable & "Author.No_of_PM, " & strDbTable & "Author.Banned, " & strDbTable & "Group.Image_uploads, " & strDbTable & "Group.File_uploads, " & strDbTable & "Author.Gender, " & strDbTable & "Author.Avatar "& _


  3. And last step, I added the following around line 383 along with other details:
    blnImageUpload = CBool(rsCommon("Image_uploads"))
    strLoggedInUserGender = rsCommon("Gender")
    strLoggedInUserAvatar = rsCommon("Avatar")
But I still cannot get those two from outside the forum.... what did I miss this time?


Posted By: Matt
Date Posted: 20 Oct 2010 at 8:26pm

Im sorry I have no idea, I do a similar thing my self on one of my forums and it works perfectly.

Does the user your logged in as (Guest, if not logged in) have anything set for those fields?

Also, I would try doing a simple "<%=strLoggedInUserGender%>" to see if anything is produced.



Posted By: Info_Tech
Date Posted: 21 Oct 2010 at 7:31am

Scotty,

I'm not sure what I did.. but it works now. Thank you for all your help!! Thumbs Up


Posted By: Info_Tech
Date Posted: 26 Oct 2010 at 5:48am

Scotty, hello again...

I am currently redirecting guest users to the login page. What I need to do is redirect the user back to the page where they came from (which is outside of the forum).
 
What I have done, so far, since WWF security measures don't allow redirecting to page outside of the forum, is I created a page within the forum directory that will redirect the user to where I want them to be redirected.
 
However, for whatever reason, I cannot get this to work.
 
I added the following function in the login_user_test.asp file but it does not seem to be working:
If strReturnURL = "mypage.asp" Then strReturnURL = "my_redirect_page_within_the_forum.asp"

What else should I do...? I appreciate your help!


Posted By: Matt
Date Posted: 26 Oct 2010 at 9:34pm

A solution I found for a phpBB forum I have (which has the same security in place) was to use URL Rewrites.

If you have this available on your server (I believe WebWiz has it on their servers if your with them) you can do a similar thing to what you did above but in a .htaccess file.

The solution I decided to do was to basically have "rw_folder_file.php" which would translate to "/folder/file.php".

To do this, Add the following to your htaccess file in the forum folder
RewriteRule ^rw_(.*)_(.*).asp$    /$1/$2.asp [R=301]


If how ever you dont have access to URL Rewrite then this post was a waste of time, and I'll see if i can figure something else out




Print Page | Close Window