If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > How can I accomplish this?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-22-07, 14:45
mstng07 mstng07 is offline
Registered User
 
Join Date: Oct 2007
Posts: 27
Question How can I accomplish this?

The company I work for want to add something new to their intranet. They have a MS Access database set up already and want to add a form so users can enter information into this database. To do this, they must go first to a login page. (The users are already set up in the database.) I know how to do this with php & mysql, but not with an access database. I'm clueless, I've been researching it and still am clueless.

I have only until Wednesday to finish this project. Right now I'm stumped. If there is any easier to way to do this can someone please let me know? Any help would be greatly appreciated!
Reply With Quote
  #2 (permalink)  
Old 10-22-07, 23:28
mwood mwood is offline
Registered User
 
Join Date: Nov 2006
Posts: 24
I have a form and a script to do this with access if it will help
Reply With Quote
  #3 (permalink)  
Old 10-22-07, 23:33
mwood mwood is offline
Registered User
 
Join Date: Nov 2006
Posts: 24
make a page named login.asp and add this code:

<table summary="This table is used for layout purposes only" border="0" width="101%" cellspacing="0" cellpadding="0" id="table10">
<tr><!-- #include file="connection.inc" -->
<td><table summary="This table is used for layout purposes only" border="0" cellpadding="0" cellspacing="0" width="100%" id="table12">
<tr>
<% if request.querystring("msg")="0" then%>
<td width="25%"><font face="Arial" color="#BF0033" style="font-size: 20px"><strong>Invalid LogIn, Please Try Again</strong></font></td>
<%end if%>
<% if request.querystring("msg")="1" then%>
<td width="25%"><font face="Arial" color="#BF0033" style="font-size: 20px"><strong>Session Expired, Please Login</strong></font></td>
<%end if%>
<% if request.querystring("msg")="2" then%>
<td width="25%"><font face="Arial" color="#BF0033" style="font-size: 20px"><strong>Invalid Login, Please Select User Type</strong></font></td>
<%end if%>
<% if request.querystring("msg")="" then%>
<td width="25%"><strong><font face="Arial" style="font-size: 20px" color="#BF0033">Welcome</font></strong></td>
<%end if%>
</tr>
</table></td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td><%
if request("submit")="true" then
if request("usertype")="0" then
response.redirect ("index.asp?msg=2")
end if
sql="select * from user_Master um,type_master tm where um.user_type=tm.id and um.user_login='"& request("userlogin") &"' and um.user_password='"& request("password") &"' and um.user_type="& request("usertype")&" and um.status=1"
set rstemp=conn.execute(sql)
if not rstemp.eof then
session("userlogin")=rstemp("user_login")
session("typename")=rstemp("type_name")
response.redirect(rstemp("file_Name"))
else
response.redirect ("index.asp?msg=0")
end if
end if
%>
<form method="POST" action="index.asp?submit=true">
<div align="center">
<table border="2" cellpadding="2" cellspacing="2" style="font-size: 9pt; padding: 3px; background-color: #cccccc" width="400" id="table7">
<tr>
<td style="color: #ffffff; background-color: #0000cc; border-width: 0px">
<font color="#FFFFFF">Enter User Name and Password</font></td>
</tr>
<tr>
<td style="color: #000000; background-color: #cccccc; border-width: 0px">
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="table8">
<tr>
<td width="7">&nbsp;</td>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="table9">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="table10">
<tr>
<td width="87">Site Name:</td>
<td><%=Request.ServerVariables("SERVER_NAME")%>&nb sp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<img border="0" src="images/menu/blank.gif" width="41" height="10"></td>
</tr>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="table11">
<tr>
<td colspan="2">

</td>
</tr>
<tr>
<td colspan="2">
<img border="0" src="images/menu/blank.gif" width="41" height="6"></td>
</tr>
<tr>
<td width="80">User Name:</td>
<td><input name="userlogin" type="text" size="29"></td>
</tr>
<tr>
<td width="80">Password:</td>
<td><input name="password" type="password" size="29"></td>
</tr>
<tr>
<td width="80">User Type:</td>
<td><select name="usertype" class="combobox" size=auto>
<option value=0>--Select--</option>
<%sql="select * from type_Master"
set rstype=conn.execute(sql)
if not rstype.eof then
while not rstype.eof
response.write"<option value='" & rstype("Id") & "'>" & rstype("Type_Name") & "</option>"
rstype.movenext
wend
end if%>
</select>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<img border="0" src="images/menu/blank.gif" width="41" height="10"></td>
</tr>
<tr><%If chb<>"" then %>
<td><input type="checkbox" name="cbrem" <%=chb%>>Remember me</td>
</tr><%End If%>
<tr>
<td>
<span style="font-weight: 400">Uncheck the flag to erase stored User Name and Password</span></td>
</tr>
</table>
</td>
<td width="8">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<p align="center">
<input type="submit" name="submit" value="Submit" class="button" >&nbsp;&nbsp;&nbsp;&nbsp; <input type="reset" value="Reset" name="B2"></p>
</form></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
Reply With Quote
  #4 (permalink)  
Old 10-22-07, 23:35
mwood mwood is offline
Registered User
 
Join Date: Nov 2006
Posts: 24
then make a page named connection.inc and add this code:


<%

'---Constant Emails-----------------
'---Connection String-----------------
'strConnect="Provider=SQLOLEDB.1;Persist Security Info=False;User ID=opcsql;pwd=opcsql;Initial Catalog=OPCdb;Data Source=localhost"
'strConnect="Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;pwd=;Initial Catalog=property;Data Source=localhost"
'strConnect="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath(".") & "\fpdb\scpr.mdb"
strConnect="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\websites\ahec.com\fpdb\ahec1.mdb"
'strConnect="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/fpdb/scpr.mdb")
'***********************************************
' Connection, Recordset and SQL string variables
'***********************************************
Dim Conn ' Connection object
Dim strConnect ' Connects to the database (used in "Connection.inc/datastore.inc")

'**************************
' Create connection object
' Create recordset object
'**************************
Set Conn = Server.CreateObject("ADODB.Connection")
'**********************************************
' Connection string for database
' strConnect comes from the Connection.inc/datastore.inc file
'**********************************************
Conn.Open strConnect

conn.CursorLocation =3

%>
Reply With Quote
  #5 (permalink)  
Old 10-22-07, 23:36
mwood mwood is offline
Registered User
 
Join Date: Nov 2006
Posts: 24
you will need to edit the pages to match your db and tables
Reply With Quote
  #6 (permalink)  
Old 10-23-07, 09:35
mstng07 mstng07 is offline
Registered User
 
Join Date: Oct 2007
Posts: 27
Thank you for your help i'm giving those a shot right now!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On