470,619 Members | 1,769 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,619 developers. It's quick & easy.

Passing login values issue ??? test1.asp?name =value???

Hello,

I need some help with passing a value from my login authorization page.
The authorization is done with the code below (it works), but I need the
'uName' value passed on when the window.location is activated.

I code my ASP with JavaScript NOT vbscript so please no &'s. And yes I
know I should be using a DSN-less connection! ((sorry, everytime I post
I get blasted about my syntax and connection choice :+))

I am slightly baffled with query's and this is what I have tried:
============= taken from code below ==================
var memid;
memid = Request.form("uName");
//Response.write(memid);//THIS PRINTS OUT FINE!!!
Response.write("<SCRIPT
Language=\"../clientside/clientnewstest1.asp?MemberID=+memid\";</SCRIPT>
");//THIS DOES NOT!!
=============================================

==========================================
======== THE WHOLE SECTION ==========
==========================================

var conn;
var rs;
var sSQL;

conn=Server.CreateObject("ADODB.Connection");
rs=Server.CreateObject("ADODB.Recordset");
conn.Open("cpWebdata");

sSQL = "SELECT InvestorAdmin.*";
sSQL += " FROM InvestorAdmin ";
sSQL += " WHERE MemberID = '" + Request.Form("uName") + "' ";
sSQL += " AND MemberPW = '" + Request.Form("uPass") + "';";
rs=Server.CreateObject("ADODB.Recordset");
rs.Open(sSQL, conn);
//Response.write(sSQL); THIS RETURNS MemberID='undefined'

if (!rs.eof) {
//User Validated as a record exists in recordset
var memid;
memid = Request.form("uName");
//Response.write(memid);
Response.write("<SCRIPT
Language=\"../clientside/clientnewstest1.asp?MemberID=+memid\";</SCRIPT>
");
} else {
//Not a valid username or password - THIS WORKS FINE
Response.write("<SCRIPT Language=JavaScript>window.location =
\"loginportfolio.asp\";</SCRIPT>");
rs.close();
conn.close();
rs=null;
conn=null;
}
=================================================
=============== END CODE ===================
===============================================

One more thing. My login page is used for two different databases - I
test for one, if false test for the other and if thats false they are
not allowed in. This works, but I just need that one value to go with
it!!
I would appreciate any help with this :+)
Thanks in advance, Miranda

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
3 2322
Two things that I noticed immediately.
1) Shouldn't it be Language=Javascript rather than
Language=../clientside/etc.
2) memid needs to be outside of the quotes if you wish to concatenate it's
value.
Response.write ("yada yada yada" + memid);
"Miranda johnsen" <in**@mirandajohnsen.com> wrote in message
news:um**************@TK2MSFTNGP11.phx.gbl...
Hello,

I need some help with passing a value from my login authorization page.
The authorization is done with the code below (it works), but I need the
'uName' value passed on when the window.location is activated.

I code my ASP with JavaScript NOT vbscript so please no &'s. And yes I
know I should be using a DSN-less connection! ((sorry, everytime I post
I get blasted about my syntax and connection choice :+))

I am slightly baffled with query's and this is what I have tried:
============= taken from code below ==================
var memid;
memid = Request.form("uName");
//Response.write(memid);//THIS PRINTS OUT FINE!!!
Response.write("<SCRIPT
Language=\"../clientside/clientnewstest1.asp?MemberID=+memid\";</SCRIPT>
");//THIS DOES NOT!!
=============================================

==========================================
======== THE WHOLE SECTION ==========
==========================================

var conn;
var rs;
var sSQL;

conn=Server.CreateObject("ADODB.Connection");
rs=Server.CreateObject("ADODB.Recordset");
conn.Open("cpWebdata");

sSQL = "SELECT InvestorAdmin.*";
sSQL += " FROM InvestorAdmin ";
sSQL += " WHERE MemberID = '" + Request.Form("uName") + "' ";
sSQL += " AND MemberPW = '" + Request.Form("uPass") + "';";
rs=Server.CreateObject("ADODB.Recordset");
rs.Open(sSQL, conn);
//Response.write(sSQL); THIS RETURNS MemberID='undefined'

if (!rs.eof) {
//User Validated as a record exists in recordset
var memid;
memid = Request.form("uName");
//Response.write(memid);
Response.write("<SCRIPT
Language=\"../clientside/clientnewstest1.asp?MemberID=+memid\";</SCRIPT>
");
} else {
//Not a valid username or password - THIS WORKS FINE
Response.write("<SCRIPT Language=JavaScript>window.location =
\"loginportfolio.asp\";</SCRIPT>");
rs.close();
conn.close();
rs=null;
conn=null;
}
=================================================
=============== END CODE ===================
===============================================

One more thing. My login page is used for two different databases - I
test for one, if false test for the other and if thats false they are
not allowed in. This works, but I just need that one value to go with
it!!
I would appreciate any help with this :+)
Thanks in advance, Miranda

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #2
Thanks Tom,

whoops, cut&paste error there :+s

So, This area is the main prob: ?memberid=+memid\";
I'm not sure what you mean about the quotes???
This is a slight re-write of what I thought I pasted in :+s
Response.write("<script
language=Javascript>window.location=\"../clientside/clientnewstest1.asp?
memberid=+memid\";</script>");

Thanks, MJ


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #3
Sorry I haven't got back sooner.
Response.Write("the text to be written"); is the format for
Response.Write --- as you know.
The engine will write whatever's in quotes as is. Therefore, to send the
value of a variable, it needs to be appended outside of the quotes....

Response.Write("Hello" + fName); Where fName is a variable containing the
value you want sent..

So in your code
Response.write("<script
language=Javascript>window.location=\"../clientside/clientnewstest1.asp?
memberid=+memid\";</script>");

memid - a variable - is within the quotes of
Response.write("<SCRIPT...........+memid\";</SCRIPT>");
Where I think it should be......
Response.write("<script
language=Javascript>window.location=\"../clientside/clientnewstest1.asp?
memberid=" + memid + "\";</script>");

Easier still.....

<script language=Javascript>

window.location="../clientside/clientnewstest1.asp?memberid=<%Response.Write
(memid);%>";
</script>
"Miranda johnsen" <in**@mirandajohnsen.com> wrote in message
news:Op**************@TK2MSFTNGP12.phx.gbl...
Thanks Tom,

whoops, cut&paste error there :+s

So, This area is the main prob: ?memberid=+memid\";
I'm not sure what you mean about the quotes???
This is a slight re-write of what I thought I pasted in :+s
Response.write("<script
language=Javascript>window.location=\"../clientside/clientnewstest1.asp?
memberid=+memid\";</script>");

Thanks, MJ


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Paul | last post: by
1 post views Thread by Paul | last post: by
3 posts views Thread by redneck_kiwi | last post: by
1 post views Thread by Wayne Deleersnyder | last post: by
14 posts views Thread by Adrienne Boswell | last post: by
2 posts views Thread by bytesbytes | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.