Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Integration of login
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Integration of login

 Post Reply Post Reply Page  12>
Author
wetcat007 View Drop Down
Newbie
Newbie


Joined: 14 October 2002
Location: United States
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote wetcat007 Quote  Post ReplyReply Direct Link To This Post Topic: Integration of login
    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/ tell me what you think bout that too if ya get a chance.

-Mark

Back to Top
[ P H u N K Y ] View Drop Down
Newbie
Newbie


Joined: 03 November 2002
Location: Australia
Status: Offline
Points: 31
Post Options Post Options   Thanks (0) Thanks(0)   Quote [ P H u N K Y ] Quote  Post ReplyReply Direct Link To This Post Posted: 12 February 2003 at 12:46am
Looks pretty schmick man... can't help you with the login tho'
Back to Top
wetcat007 View Drop Down
Newbie
Newbie


Joined: 14 October 2002
Location: United States
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote wetcat007 Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
jaz9090 View Drop Down
Groupie
Groupie


Joined: 25 October 2002
Location: United Kingdom
Status: Offline
Points: 135
Post Options Post Options   Thanks (0) Thanks(0)   Quote jaz9090 Quote  Post ReplyReply Direct Link To This Post Posted: 13 February 2003 at 8:49am
You might be able to change the existing login page (a backup of it)
Back to Top
Mailman View Drop Down
Newbie
Newbie
Avatar

Joined: 12 February 2003
Location: Canada
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mailman Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
wetcat007 View Drop Down
Newbie
Newbie


Joined: 14 October 2002
Location: United States
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote wetcat007 Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Mailman View Drop Down
Newbie
Newbie
Avatar

Joined: 12 February 2003
Location: Canada
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mailman Quote  Post ReplyReply Direct Link To This Post Posted: 13 February 2003 at 7:30pm

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

Welcome <%=strGlobalLoggedInUsername %>

 

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.