snowblitzing
06-24-2003, 08:09 PM
HI, I have been working on a script I downloaded from paco drivers.com To Use For FREE! for some time and I can not get it working for the life of me. I found a few errors in the commands I believe but I still can not get it to work can anyone tell me if they have had any problems from this site or if this script if flawed. Still new at this and may just be overlooking something
http://pacosdrivers.com/asp/slog/
The codes can be downloaded there.
This is my error when I go to my web site under admin properties
ADODB.Connection.1 error '80004005'
SQLState: IM002
Native Error Code: 0
[INTERSOLV][ODBC lib] Data source name not found and no default driver specified
/slog/admin/admincheck.asp, line 8
HERE IS the CODE FOR Admin.asp
<html>
<head>
<title>Admin Login</title>
</head>
<body>
<form method="POST" action="admincheck.asp">
<div align="center">
<table border="0" width="31%">
<tr>
<td width="100%" align="center">
<p align="center">
<font face="Comic Sans MS" size="2">
<b>
Admin ID is me@me.com<br>
Password is paco123456</b></font>
</td>
</tr>
<center>
<tr>
<td width="100%" align="center"><font face="Comic Sans MS" size="2">Admin ID<br>
</font>
<input type="text" name="uid" size="20"></td>
</tr>
<tr>
<td width="100%" align="center"><font size="2" face="Comic Sans MS">Admin Password<br>
</font>
<input type="password" name="pwd" size="20"></td>
</tr>
<tr>
<td width="100%" align="center"><input type="submit" value="Login" name="B1"></td>
</tr>
</table>
</center>
</div>
</form>
</body>
</html>
Here is the code for admincheck.asp
<%
'here is the connection string
Set conn = server.createobject("adodb.connection")
'this connection uses JET 4 it is the prefered method of connecting to an access database
DSNtemp = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("/slog/login.mdb")
'if you cant use JET then comment out the line above and uncomment the line below
'DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("/slog/login.mdb")
conn.Open DSNtemp
'here we are getting the info from the login form
uid = Request.Form("uid")
pwd = Request.Form("pwd")
'now we will querry the database for a match
SQL = "Select * From admin Where uid = '" & uid & "' And pwd = '" & pwd & "'"
Set RS = Conn.Execute(SQL)
'if the user is found we will set the session okeydokey to TRUE allowing the user to gain entrance
If Not RS.EOF Then
Session("admin") = True
'always always always destroy recordsets and close connections!
Set RS = Nothing
Conn.Close
'since the user was found, we sent them toodling on to the next page
Response.Redirect "admin2.asp"
Else
'ooops if we got this far they dont know their login info or arent in the database
'AGAIN always always always destroy recordsets and close connections!
Set RS = Nothing
Conn.Close
'so we send em back to try again
Response.Redirect "admin.asp"
End If
%>
Thanks for any help:cry:
http://pacosdrivers.com/asp/slog/
The codes can be downloaded there.
This is my error when I go to my web site under admin properties
ADODB.Connection.1 error '80004005'
SQLState: IM002
Native Error Code: 0
[INTERSOLV][ODBC lib] Data source name not found and no default driver specified
/slog/admin/admincheck.asp, line 8
HERE IS the CODE FOR Admin.asp
<html>
<head>
<title>Admin Login</title>
</head>
<body>
<form method="POST" action="admincheck.asp">
<div align="center">
<table border="0" width="31%">
<tr>
<td width="100%" align="center">
<p align="center">
<font face="Comic Sans MS" size="2">
<b>
Admin ID is me@me.com<br>
Password is paco123456</b></font>
</td>
</tr>
<center>
<tr>
<td width="100%" align="center"><font face="Comic Sans MS" size="2">Admin ID<br>
</font>
<input type="text" name="uid" size="20"></td>
</tr>
<tr>
<td width="100%" align="center"><font size="2" face="Comic Sans MS">Admin Password<br>
</font>
<input type="password" name="pwd" size="20"></td>
</tr>
<tr>
<td width="100%" align="center"><input type="submit" value="Login" name="B1"></td>
</tr>
</table>
</center>
</div>
</form>
</body>
</html>
Here is the code for admincheck.asp
<%
'here is the connection string
Set conn = server.createobject("adodb.connection")
'this connection uses JET 4 it is the prefered method of connecting to an access database
DSNtemp = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("/slog/login.mdb")
'if you cant use JET then comment out the line above and uncomment the line below
'DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("/slog/login.mdb")
conn.Open DSNtemp
'here we are getting the info from the login form
uid = Request.Form("uid")
pwd = Request.Form("pwd")
'now we will querry the database for a match
SQL = "Select * From admin Where uid = '" & uid & "' And pwd = '" & pwd & "'"
Set RS = Conn.Execute(SQL)
'if the user is found we will set the session okeydokey to TRUE allowing the user to gain entrance
If Not RS.EOF Then
Session("admin") = True
'always always always destroy recordsets and close connections!
Set RS = Nothing
Conn.Close
'since the user was found, we sent them toodling on to the next page
Response.Redirect "admin2.asp"
Else
'ooops if we got this far they dont know their login info or arent in the database
'AGAIN always always always destroy recordsets and close connections!
Set RS = Nothing
Conn.Close
'so we send em back to try again
Response.Redirect "admin.asp"
End If
%>
Thanks for any help:cry: