get MemberID without inc_header.asp?

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/61277?pagenum=1
05 November 2025, 00:07

Topic


tribaliztic
get MemberID without inc_header.asp?
09 March 2006, 08:26


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. <

 

Replies ...


Davio
09 March 2006, 09:34


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.<
tribaliztic
09 March 2006, 09:54


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. <
Davio
09 March 2006, 10:01


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
<
tribaliztic
09 March 2006, 10:06


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. <
Davio
09 March 2006, 10:21


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")
<
tribaliztic
10 March 2006, 02:23


heh, no wonder it didn't work then =)
I'll check that out, thank you! <
tribaliztic
10 March 2006, 02:59


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
10 March 2006, 03:03


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..)
<
Davio
10 March 2006, 11:40


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.<
tribaliztic
11 March 2006, 05:18


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
<
Davio
11 March 2006, 06:59


If you have config.asp included, you don't need to have this code in your file:
Code:
strDBNTSQLName = Request.Cookies("Snitz00User")("Name")
<
Zuel
11 March 2006, 12:41


Here's your problem:
folder = getMemberID("strDBNTUserName")

You are looking for a Member named strDBNTUserName. Try it without the quotes.
folder = getMemberID(strDBNTUserName)

Davio knew that! wink<
Davio
11 March 2006, 15:34


Originally posted by Zuel Davio knew that! wink
blackeyeblushbigsmile<
tribaliztic
13 March 2006, 03:43


As soon as I enter this line:
folder = getMemberID(strDBNTUserName)

I get this error:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/inc_func_secure.asp, line 78
<
tribaliztic
13 March 2006, 03:55


How can I add "member_id" to this url then:
<form name="upldfile" action="ezuploadorig.asp?action=upld&<% = PID %>" onSubmit="return ShowProgress();" method="post" enctype="multipart/form-data">

I tried this:
<form name="upldfile" action="ezuploadorig.asp?action=upld&<% = PID %>&memid=<% MemberID %>" onSubmit="return ShowProgress();" method="post" enctype="multipart/form-data">

But it didn't work.. <
tribaliztic
13 March 2006, 04:50


Ok got it.. I used this in top of the code:
if memid = "" then
folder = Request.Querystring("memid")
else
folder = Request.Querystring("memid2")
end if

and it seems to work. BUT, I get an error on this line:
<form name="upldfile" action="ezuploadorig.asp?action=upld&<% = PID %>&memid2=<% MemberID %>" onSubmit="return ShowProgress();" method="post" enctype="multipart/form-data">

Runtime Error Microsoft VBScript error '800a000d'

incompatible types

/ezuploadorig.asp, line 174

(I translated the error so don't trust me on the wording)

Seems like it don't like that I use the memid2? <
tribaliztic
13 March 2006, 06:20


I think it's better if I continue in my other thread now that the problem with MemberID is solved =)
<
Zuel
13 March 2006, 10:37


Also Trib you need to do this:

<%=MemberID%>

You forgot the equals sign.<
tribaliztic
14 March 2006, 04:50


Yeah, I noticed that =)
<
puthen
26 September 2007, 19:43


Hi,Tribaliztic,
Did you ultimately get to solve the problem.Iam also trying to do the same in an asp upload page where i want to check if the member is loged in and if not redirct him to the login.asp. can you put out the entire code for your page or send me via email please. Puthen<
tribaliztic
27 September 2007, 01:09


ouch, it's been awhile.. I THINK that I just forwarded the value in the redirect like this:
Response.Redirect "ezuploadorig.asp?memid=" & variable & ""
<
cripto9t
27 September 2007, 09:41


You can use the chkUser() function located in "inc_func_common.asp"
It returns "mLev" (Members Level) and "MemberID".
Code:
<!-- #INCLUDE FILE="config.asp" -->
<!--#INCLUDE FILE="inc_func_common.asp" -->
<%
'## Open connection
set my_Conn= Server.CreateObject("ADODB.Connection")
my_Conn.Open strConnString

'## Check for the cookie
strDBNTUserName = Request.Cookies(strUniqueID & "User")("Name")

chkCookie = 1
mLev = cLng(chkUser(strDBNTUserName, Request.Cookies(strUniqueID & "User")("Pword"),-1))
chkCookie = 0

'## Your stuff starts here
Response.Write MemberID & "<br />" & mLev
'## Your stuff ends

'## Close connection
my_Conn.Close
set my_Conn = nothing
%>
<
Shaggy
27 September 2007, 09:46


You'll need to dim the MemberID variable first. Never mind, just spotted that you included config.asp; MemberID is already dimmed in there.
<
puthen
30 September 2007, 23:39


hi,
Iam developing the pages in .net frame work and hence it is a pain to incorporate include files(asp) in the webforms.Is there any work around?
I need to protect only one page in my website.<
© 2000-2021 Snitz™ Communications