Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Grap the username outside the forum ?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Grap the username outside the forum ?

 Post Reply Post Reply
Author
 Rating: Topic Rating: 1 Votes, Average 4.00  Topic Search Topic Search  Topic Options Topic Options
Sundsdal View Drop Down
Newbie
Newbie


Joined: 20 January 2008
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sundsdal Quote  Post ReplyReply Direct Link To This Post Topic: Grap the username outside the forum ?
    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





Edited by Sundsdal - 17 February 2008 at 5:10pm
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: 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.
Back to Top
Sundsdal View Drop Down
Newbie
Newbie


Joined: 20 January 2008
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sundsdal Quote  Post ReplyReply Direct Link To This Post 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 ?
Back to Top
Sundsdal View Drop Down
Newbie
Newbie


Joined: 20 January 2008
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sundsdal Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Sundsdal View Drop Down
Newbie
Newbie


Joined: 20 January 2008
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sundsdal Quote  Post ReplyReply Direct Link To This Post 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))


Back to Top
akela11 View Drop Down
Newbie
Newbie
Avatar

Joined: 18 March 2007
Location: Mexico
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote akela11 Quote  Post ReplyReply Direct Link To This Post Posted: 10 March 2008 at 12:38am
I want to do the same, but i can't get it work :(
Back to Top
 Post Reply Post Reply

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.