Print Page | Close Window

Grap the username outside the forum ?

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=25310
Printed Date: 03 April 2026 at 9:56pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Grap the username outside the forum ?
Posted By: Sundsdal
Subject: Grap the username outside the forum ?
Date Posted: 17 February 2008 at 4:55pm
Does anyone know how i can grap the username outside the forum. ?  It could be on my frontpage...etc.

I have tried to grap it with the cookies and strLoggedInUsername .... But no luck






Replies:
Posted By: WebWiz-Bruce
Date Posted: 17 February 2008 at 6:01pm
Usernames ar not stored in cookies, sessions, etc. so you would not be able o grab the username in this way

You would need to look into a secure way to save and retrieve the username from the forum.


-------------
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: Sundsdal
Date Posted: 17 February 2008 at 7:38pm
I know....   but im using the code from the forum:

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

'###strLoggedInUserCode = Request.Cookies("Forum")("UserID")

'Replace harmful SQL quotation marks with doubles
strLoggedInUserCode = Replace(strLoggedInUserCode, "'", "''", 1, -1, 1)
'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 isEmpty(strLoggedInUserCode) = False Then

    'Intialise the ADO recordset object
    Set rsLoggedInUser = Server.CreateObject("ADODB.Recordset")
   
    'Initalise the strSQL variable with an SQL statement to query the database
   
        strSQL = "SELECT tblAuthor.Username, tblAuthor.Author_ID, tblAuthor.Active, tblAuthor.Signature, tblAuthor.Author_email, tblAuthor.Status, tblAuthor.Redaktion "
        strSQL = strSQL & "FROM tblAuthor "
        strSQL = strSQL & "WHERE User_code = '" & strLoggedInUserCode & "';"


       
    'Query the database
    'rsLoggedInUser.Open strSQL, strCon
    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
            strLoggedInUsername = rsLoggedInUser("Username")
        .....
......
......  etc.

I should be able to read the username this way.... right ?


Posted By: Sundsdal
Date Posted: 17 February 2008 at 8:21pm
Ok i see now.... i have testet the cookie.  And it will now read the cookie outside the forum folder ?

weird.


Posted By: Sundsdal
Date Posted: 17 February 2008 at 9:28pm
Yep i know.... talking to myself here :-) BUT i figured it out.... and i works now.

I edited in this strLoggedInUserCode = Trim(Mid(Request.Cookies("Forum")("UserID"), 1, 40))




Posted By: akela11
Date Posted: 10 March 2008 at 12:38am
I want to do the same, but i can't get it work :(



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