| Author |
|
Sundsdal
Newbie
Joined: 20 January 2008
Status: Offline
Points: 19
|
Post Options
Thanks(0)
Quote Reply
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
|
 |
WebWiz-Bruce
Admin Group
Web Wiz Developer
Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
|
Post Options
Thanks(0)
Quote Reply
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.
|
|
|
 |
Sundsdal
Newbie
Joined: 20 January 2008
Status: Offline
Points: 19
|
Post Options
Thanks(0)
Quote Reply
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 ?
|
 |
Sundsdal
Newbie
Joined: 20 January 2008
Status: Offline
Points: 19
|
Post Options
Thanks(0)
Quote Reply
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.
|
 |
Sundsdal
Newbie
Joined: 20 January 2008
Status: Offline
Points: 19
|
Post Options
Thanks(0)
Quote Reply
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))
|
 |
akela11
Newbie
Joined: 18 March 2007
Location: Mexico
Status: Offline
Points: 5
|
Post Options
Thanks(0)
Quote Reply
Posted: 10 March 2008 at 12:38am |
|
I want to do the same, but i can't get it work :(
|
 |