get MemberID without inc_header.asp? - Posted (2102 Views)
Senior Member
tribaliztic
Posts: 1532
1532
Is it possible to get MemberID without using inc_header.asp?
I'm working on an uploadthingy with a popup-window. At first I used this link:
<a href=""javascript:openWindow6('ezuploadorig.asp?memid=" & MemberID & ')"">
and then got the memid via Request.Querystring("memid").
But:
after selecting the files I want to upload the popup-window reloads and the memid is lost... If I include the inc_header.asp I get an error as stated in another thread. <
/Tribaliztic
- www.gotlandrace.se -
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Development Team Member
Davio
Posts: 12217
12217
2 other ways to retrieve the MemberID without using inc_header.asp.
1. Use inc_header_short.asp instead. wink 2. Use the getMemberID() function which requires the user name of the member to be passed to it. It is found in inc_func_secure.asp.<
Posted
Senior Member
tribaliztic
Posts: 1532
1532
inc_header_short.asp cause the same error as inc_header.asp unfortunately.. I tried getMemberID() but couldn't get it to work. What's the syntax? I checked code in topic.asp (I think it was) and tried to use it but it didn't work. <
/Tribaliztic
- www.gotlandrace.se -
Posted
Development Team Member
Davio
Posts: 12217
12217
What error is the "same error"?
The syntax is simple as for any other function you calling:
Code:
intMemberID = getMemberID("Davio")
OR
Code:
Response.Write "Your Member ID is " & getMemberID("Davio") & vbNewLine
<
Posted
Senior Member
tribaliztic
Posts: 1532
1532
Okay, so I should use it like this then:

intMemberID = getMemberID("" & strDBNTUsername & "")

I must use a variable because this will tell the code what foldername (the userid) it should upload the files to. <
/Tribaliztic
- www.gotlandrace.se -
Posted
Development Team Member
Davio
Posts: 12217
12217
Yes, you can use it like that. Just that, strDBNTUsername is set in inc_header.asp and inc_header_short.asp. bigsmile
You could put this in your code:
Code:
strDBNTUserName = Request.Cookies(strUniqueID & "User")("Name")
strUniqueID is set in config.asp. You could hard code it into your file.
Code:
strDBNTUserName = Request.Cookies("Snitz00User")("Name")
<
Posted
Senior Member
tribaliztic
Posts: 1532
1532
heh, no wonder it didn't work then =)
I'll check that out, thank you! <
/Tribaliztic
- www.gotlandrace.se -
Posted
Senior Member
tribaliztic
Posts: 1532
1532
Well, I tried this code:

Dim folder

strDBNTUserName = Request.Cookies("Snitz00User")("Name")

folder = getMemberID("strDBNTUserName")


And got this error:
"ADODB.Recordset error '800a0bb9'. The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another". /inc_func_secure.asp, line 78


I suppose it's because of this line in inc_func_secure.asp
strSql = strSql & " WHERE " & strDBNTSQLName & " = '" & ChkString(fUser_Name, "SQLString") & "'"

I guess that I get "strDBNTSQLName" from inc_header.asp also? <
/Tribaliztic
- www.gotlandrace.se -
Posted
Senior Member
tribaliztic
Posts: 1532
1532
No, it's from config.asp:

if strAuthType = "db" then
strDBNTSQLName = "M_NAME"
strAutoLogon = "0"
strNTGroups = "0"
else
strDBNTSQLName = "M_USERNAME"
end if

and the M_NAME is from inc_func_secure.asp:

function getMemberName(fUser_Number)

dim strSql
dim rsGetmemberName

'## Forum_SQL
if isNull(fUser_Number) then exit function
strSql = "SELECT M_NAME "
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " WHERE MEMBER_ID = " & cLng(fUser_Number)

set rsGetMemberName = Server.CreateObject("ADODB.Recordset")
rsGetMemberName.open strSql, my_Conn

if rsGetMemberName.EOF or rsGetMemberName.BOF then
getMemberName = ""
else
getMemberName = chkString(rsGetMemberName("M_NAME"),"display")
end if

rsGetMemberName.close
set rsGetMemberName = nothing

end function

and that function won't work since I don't have the "fUser_Number".
Am I wrong? (I hope so..)
<
/Tribaliztic
- www.gotlandrace.se -
Posted
Development Team Member
Davio
Posts: 12217
12217
Oops. Brain didn't catch that. Hmmm

Easiest fix would be to include config.asp. Or take out the variables out of config.asp and put it in your file. And copy the function into your file. Replacing the variables with the hard coded values.
Basically you will have to get the user name from their cookie, then search for their ID that matches their user name.<
Posted
Senior Member
tribaliztic
Posts: 1532
1532
I already have config.asp included =)
I still get the same error if I try this:

folder = getMemberID("strDBNTUserName")

Why won't it work? The complete code is here:
http://www.gotlandrace.se/tabort/ezuploadorig.txt
<
/Tribaliztic
- www.gotlandrace.se -
You Must enter a message