|
| |
|
|
AllenD
Posts: 258 From: Dayton, OH, USA Status: offline
|
question about checking a database for a user - 7/5/2005 12:03:49
I found this code on a webpage that was in some other garbled language or something and I can't quite figure it out, I basically have a form that queries a database if a user exists in it, if it does 'do this', if it doesnt 'do this' type of thing: here is the code I am using:
<%
session("Uname")=""
mememail=request("mememail")
mempassword=request("mempassword")
if mememail<>"" and mempassword <> "" then
Set Conn = Server.CreateObject("ADODB.Connection")
dsn="driver={microsoft access driver (*.mdb)};dbq=" & _
server.mappath("members.mdb")
Conn.Open dsn
Set RS = Server.CreateObject("ADODB.Recordset")
SQL="select * from memberinfo where memberemail='" & mememail & _
"' and memberpassword='" & mempassword & "'"
Rs.Open sql,Conn,1,3
If Rs.Recordcount<>0 then
session("Uname")=rs("mName")
End If
Rs.Close
Conn.Close
end if
if session("Uname")<>"" then
response.redirect session("callfrom")
else
response.redirect request("notfound.asp")
end if
%>
<%session("callfrom")=request("found.asp")
if session("Uname")="" then response.redirect("notfound.asp")%>
Hello world
--------------------------------------------- I get the following error: Response object error 'ASP 0158 : 80004005' Missing URL /checkuser.asp, line 23 A URL is required. --------------------------------------------- Not quite sure how this URL redirection session stuff works...maybe there is a different way to do this? Basically if the user is not found in the database I need it to go to the notfound.asp page......If they are found, then go to: found.asp I found all of this on the following site: http://mcu1.psu.ac.th/asp/authen/
< Message edited by AllenD -- 7/5/2005 12:13:55 >
|
|
|
|
AllenD
Posts: 258 From: Dayton, OH, USA Status: offline
|
RE: question about checking a database for a user - 7/5/2005 16:14:49
Ok, that part works, at least I dont get an error, but even now if I put a username and password in my form that DOES exist I get my notfound.asp page, and I should be getting my found.asp page ?
|
|
|
|
AllenD
Posts: 258 From: Dayton, OH, USA Status: offline
|
RE: question about checking a database for a user - 7/5/2005 17:08:58
Ok, good idea, I did that, but still get my notfound.asp page even if there is a record that it should have found? I guess my other code isnt correct, I never got a good "tutorial" from the original site of how this thing works, now I have:
<%
session("Uname")=""
mememail=request("mememail")
mempassword=request("mempassword")
if mememail<>"" and mempassword <> "" then
Set Conn = Server.CreateObject("ADODB.Connection")
dsn="driver={microsoft access driver (*.mdb)};dbq=" & _
server.mappath("members.mdb")
Conn.Open dsn
Set RS = Server.CreateObject("ADODB.Recordset")
SQL="select mName from memberinfo where memberemail='" & mememail & _
"' and memberpassword='" & mempassword & "'"
Rs.Open sql,Conn,1,3
If NOT Rs.EOF then
session("Uname")=rs(0)
End If
Rs.Close
Conn.Close
end if
if session("Uname")<>"" then
response.redirect session("callfrom")
else
response.redirect ("notfound.asp")
end if
%>
<%'session("callfrom")=request("found.asp")
'if session("Uname")="" then response.redirect("notfound.asp")%>
|
|
|
|
AllenD
Posts: 258 From: Dayton, OH, USA Status: offline
|
RE: question about checking a database for a user - 7/5/2005 17:31:36
Ok, your right, I did not have the values identified correctly for the information that was being passed...Now I have the following error after making my corrections, never seen this one before? Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x11d4 Thread 0x9b8 DBC 0x8ddf024 Jet'. /checkuser.asp, line 12 ------------ My code is now:
<%
session("Uname")=""
mememail=request("memberemail")
mempassword=request("memberpassword")
'response.write mememail
'response.write mempassword
'response.end
if mememail<>"" and mempassword <> "" then
Set Conn = Server.CreateObject("ADODB.Connection")
dsn="driver={microsoft access driver (*.mdb)};dbq=" & _
server.mappath("members.mdb")
Conn.Open dsn
Set RS = Server.CreateObject("ADODB.Recordset")
SQL="select mName from memberinfo where memberemail='" & mememail & _
"' and memberpassword='" & mempassword & "'"
Rs.Open sql,Conn,1,3
If NOT Rs.EOF then
session("Uname")=rs(0)
End If
Rs.Close
Conn.Close
end if
if session("Uname")<>"" then
response.redirect session("callfrom")
else
response.redirect ("notfound.asp")
end if
%>
<%session("callfrom")=request("found.asp")
if session("Uname")="" then response.redirect("notfound.asp")%>
|
|
|
|
AllenD
Posts: 258 From: Dayton, OH, USA Status: offline
|
RE: question about checking a database for a user - 7/7/2005 12:50:12
Can anyone help me with the Query string's ?
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: question about checking a database for a user - 7/7/2005 14:57:26
What error are you getting?
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
AllenD
Posts: 258 From: Dayton, OH, USA Status: offline
|
RE: question about checking a database for a user - 7/7/2005 15:05:22
Microsoft JET Database Engine error '80004005' Could not find file 'c:\members.mdb'. /checkuser.asp, line 11 ------------------------- I am using a webhosting service from ipowerweb.com....So how do I know where the file is located on the server, c:, etc ?
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: question about checking a database for a user - 7/7/2005 15:10:05
And you are sure that is where the database resides, at the root of C:?
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
AllenD
Posts: 258 From: Dayton, OH, USA Status: offline
|
RE: question about checking a database for a user - 7/7/2005 15:58:05
No, I am not sure where it is...How do I find out?
|
|
|
|
AllenD
Posts: 258 From: Dayton, OH, USA Status: offline
|
RE: question about checking a database for a user - 7/7/2005 17:08:53
Ok, I got it working (kinda) by doing this: dsn="Provider=Microsoft.Jet.OLEDB.4.0; Server.MapPath=members.mdb" But if I enter a user that is in the database I get this error: Microsoft JET Database Engine error '80004005' Could not find installable ISAM. /checkuser.asp, line 11 ------ Anyone have any ideas on this? Line 11 is Conn.Open dsn
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: question about checking a database for a user - 7/7/2005 17:24:26
Try the modified version below: dsn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath=("members.mdb")
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
AllenD
Posts: 258 From: Dayton, OH, USA Status: offline
|
RE: question about checking a database for a user - 7/7/2005 17:41:20
That gives me this error: Microsoft VBScript runtime error '800a01c2' Wrong number of arguments or invalid property assignment: 'Server.MapPath' /checkuser.asp, line 10
|
|
|
|
AllenD
Posts: 258 From: Dayton, OH, USA Status: offline
|
RE: question about checking a database for a user - 7/7/2005 18:23:03
Woops, disregard this entry.
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: question about checking a database for a user - 7/7/2005 18:33:13
Oops, the = after server.mappath is a typo. Should be: dsn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath("members.mdb")
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
AllenD
Posts: 258 From: Dayton, OH, USA Status: offline
|
RE: question about checking a database for a user - 7/7/2005 18:40:25
Getting closer! Now I get this error? Microsoft JET Database Engine error '80004005' Could not find file 'C:\Accounts\medicati\wwwRoot\members.mdb'. /checkuser.asp, line 13 --- I verified the file is there, and I can open and see it. Is there a way for me to do it with FILEDSN = ? I saw something like there here http://mavweb.net/asp-samples/database-connection-strings.asp but dont quite understand it.
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: question about checking a database for a user - 7/7/2005 19:04:22
dsn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath("/members.mdb")
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: question about checking a database for a user - 7/7/2005 19:35:47
Actually, I think you need to at least know where the database resides. Do you have a folder within your web that holds your dbs?
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
AllenD
Posts: 258 From: Dayton, OH, USA Status: offline
|
RE: question about checking a database for a user - 7/7/2005 19:44:10
Yep, changed that too: dsn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath("fpdb/members.mdb") now I get this error: Microsoft JET Database Engine error '80040e10' No value given for one or more required parameters. /checkuser.asp, line 15 Line 15 reads: Rs.Open sql,Conn,1,3
|
|
|
|
AllenD
Posts: 258 From: Dayton, OH, USA Status: offline
|
RE: question about checking a database for a user - 7/7/2005 20:04:08
I got it...your right, the Mname was not valid, not sure why I had that in there, I changed it too, and it works! THANKS DUANE! select * from from memberinfo where memberemail='" & mememail & _
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: question about checking a database for a user - 7/7/2005 20:08:31
Glad you got it sorted out. Now you can enjoy what's left of your day.
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|