Print Page | Close Window

Integration of login

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=92
Printed Date: 31 March 2026 at 4:39pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Integration of login
Posted By: wetcat007
Subject: Integration of login
Date Posted: 12 February 2003 at 12:18am

I want to be able to have a thing on my website on one of the menu bars, always show there persons name trhat is logged in, and if they are not logged in have a link saying click here to login.  I was wondering what the best way of accessing the cookie on peoples computers is to get the information for login or what exactly that best way to go about doing this is?  One last thing I'm working on a skin for version 7, http://www.pcraider.com/forum/ - http://www.pcraider.com/forum/ tell me what you think bout that too if ya get a chance.

-Mark




Replies:
Posted By: [ P H u N K Y ]
Date Posted: 12 February 2003 at 12:46am
Looks pretty schmick man... can't help you with the login tho'

-------------


Posted By: wetcat007
Date Posted: 12 February 2003 at 11:33pm
Well anyone got any idea how to do that I know it can be done, it's just that I myself have not enuff ASP knoledge to get it work correctly.


Posted By: WebWiz-Bruce
Date Posted: 13 February 2003 at 3:03am

The forum cookie holds a usercode not the users name so you will have to get the usercode and then match it up against the database to get the username.

Have a look in the common.asp file to see how it it done in there, it is commented so you should be able to find those parts that you need.

Also you will need so ASP skills in connecting and reading data from a database, so it maybe worth looking at some of the tutorials in the ASP section of this site.



-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: jaz9090
Date Posted: 13 February 2003 at 8:49am
You might be able to change the existing login page (a backup of it)


Posted By: Mailman
Date Posted: 13 February 2003 at 2:57pm

Hi all, this is my first post so be nice :)

I did similar thing on my website, I have 2 type of users using the same login. I also use a frameset so the code need to be in one of my frame page only. The reason of a frameset is that I have to query only one time to get the user informations instead of everytime a page is loaded. Here is the code I use. P.S. That code is part of the common.asp file starting at line 259. For security purpose my connection string is not included. You will need to create yours. Conn is the ADODB object

'Read in users ID number from the cookie
strLoggedInUserCode = Trim(Mid(Request.Cookies("Forum")("UserID"), 1, 44))

'Make the usercode SQL safe
strLoggedInUserCode = formatSQLInput(strLoggedInUserCode)


'If a cookie exsists on the users system then read in there username from the database
If strLoggedInUserCode <> "" Then

 'Intialise the ADO recordset object
 Set rsLoggedInUser = Server.CreateObject("ADODB.Recordset")
 
  strSQL = "SELECT tblAuthor.Username, tblAuthor.Author_ID, tblAuthor.Active, tblAuthor.Signature, tblAuthor.Author_email, tblAuthor.Status "
  strSQL = strSQL & "FROM tblAuthor "
  strSQL = strSQL & "WHERE User_code = '" & strLoggedInUserCode & "';"
  
 'Query the database
 Set rsLoggedInUser = Conn.Execute(strSQL)
 
 'If the database has returned a record then run next bit
 If NOT rsLoggedInUser.EOF Then
  'Before getting the users details make sure then are not trying to log in under the guest account
  If rsLoggedInUser("Author_ID") <> 2 Then
   'Read in the users details from the recordset
   strGlobalLoggedInUsername = rsLoggedInUser("Username")
   lngLoggedInUserID = CLng(rsLoggedInUser("Author_ID"))
   blnActiveMember = CBool(rsLoggedInUser("Active"))
   If rsLoggedInUser("Author_Email") <> "" Then blnLoggedInUserEmail = True
   If rsLoggedInUser("Signature") <> "" Then blnLoggedInUserSignature = True
   intMemberStatus = CInt(rsLoggedInUser("Status"))
   
   'If the members account is not active then set there security level to 0 (Guest)
   If blnActiveMember = False Then intMemberStatus = 0   
  Else
   lngLoggedInUserID = 0
  End If

 'Otherwise the username is not correct or the user has been barred so set there User ID to 0
 Else
  lngLoggedInUserID = 0
 End If
 Set rsLoggedInUser = Nothing
 
 'Close the recordset
 rsLoggedInUser.Close
 Set rsLoggedInUser = Nothing
End If

The strGlobalLoggedInUsername variable hold your user name. Hope this will help you.



Posted By: wetcat007
Date Posted: 13 February 2003 at 6:06pm

Hey thanks for the code, but I am really not quite sure what I'm doing wrong, because I'm not getting it to work, how do i make it actually display the username, I added in lines to tell it where the database and stuff is..  What exactly is the usercode u speak of and where do i find mine?  Sorry for not really knowing ASP good enuff but I get confused to beyond comprehension when I go too far beyond the basics.

-Mark



Posted By: Mailman
Date Posted: 13 February 2003 at 7:30pm

To display the username in your HTML, simply use that syntax:

Welcome <%=strGlobalLoggedInUsername %>

 



Posted By: wetcat007
Date Posted: 13 February 2003 at 7:43pm

http://www.pcraider.com/testing/ - http://www.pcraider.com/testing/   there's what i have tried so far on the file in that folder, but I'm not having a real lot of luck getting it to work, could ya take a look at the file and tell me what I did wrong?  Thanks again for the help

-Mark



Posted By: Mailman
Date Posted: 13 February 2003 at 10:23pm
From the link you provide, we can not see the server side. send me the file to mailto:mailman@rtwclan.com - mailman@rtwclan.com and I will send you back the file documented.


Posted By: wetcat007
Date Posted: 13 February 2003 at 10:47pm
K i sent ya it


Posted By: Mailman
Date Posted: 13 February 2003 at 11:22pm

Check your mail :)



Posted By: Munk
Date Posted: 11 May 2003 at 3:53pm

Sheesh, I hate to beat a dead horse guys...

How about when you want different apps in their respective folders, as in the forums in forums, chat in chat, etc.... but want a global login using the cookies, since these have been so well written? My problem is that a different cookie is written, depending on what folder the common/login files are in. Then, when navigating to any sub-folders, it doesn't track that I'm logged in, because it's looking for a different cookie? I hope that makes sense  

For example, if I'm at the root directory, where I'd like the common/login/etc to be for globally logging in, the cookie is set appropriately with the site name itself. If I then go to the forums folder, the logged state isn't synced, because it's looking for @forums cookie.

I hope I'm not being toooooo newbie-ish here  but is there an easy answer for a workaround with that?



-------------
~~Munk~~

'The details are the jungle in which the Devil hides... the only salvation lies in structure' - Author Unknown


Posted By: xeerex
Date Posted: 11 May 2003 at 4:22pm

You really need to just look at the included pages for the forum and make sure those are included anywhere you want to have the "cookie follow you". Also, a good place to start is by looking at the code in forum/default.asp where the username, etc is displayed.

I'm not an ASP expert but that is a good way to start.

As far as a "global" cookie for logins to various apps, you're gonna have to either extensively mod the forum or the other apps to do that.



-------------
http://webspacegeeks.com - Need Hosting, Domains, Dedicated Servers?
http://www.smartergeek.com - web design | pc support | training | podcasts | video production


Posted By: Munk
Date Posted: 11 May 2003 at 4:49pm

Ok, cool, xeerex. Thanks for the info - I was kind of expecting to hear that I would have to write a mother of mods for a global tracking like that. I did try relocating the necessary files, and making sure things were included, but it gets pretty ugly when changing up as many files as are needed.

Thanks again  :)  Maybe if I do write that mod I'll submit it in the mods for boRg to review or something.



-------------
~~Munk~~

'The details are the jungle in which the Devil hides... the only salvation lies in structure' - Author Unknown



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