Solved

login script

Posted on 1998-08-21
7
158 Views
Last Modified: 2012-05-04
the best login method for my web site security like that on this site, using asp?
0
Comment
Question by:pmaderia
  • 4
  • 3
7 Comments
 
LVL 10

Expert Comment

by:MasseyM
ID: 1836899
On some of my sites, I have a dataase that is securely stored on the server... The use  r then inputs a name & password..I connect to the database and verify both... It is not like this site, but it works just the same... Interested in the code?  If so, let me know...

0
 
LVL 10

Accepted Solution

by:
MasseyM earned 50 total points
ID: 1836900
Ok, I decided to post my ASP... It is not pretty, but it serves its purpose, at least for me...

-------------------------------------------------
This is the Login Form:

<%
=Request.Cookies("Logininfo")("NameFirst")
%>

<CENTER>
<FORM ACTION="Verify.Asp" METHOD="POST">
<INPUT TYPE="HIDDEN" NAME = "Type" VALUE="Login">
<TABLE COLS = "2" ALIGN = CENTER WIDTH = 100%>
      <TR>
      <TD>
      <CENTER>
            <TABLE WIDTH = "50%">
            <TH COLSPAN = "3" BGCOLOR = "Wheat">Login Information</TH>
            <TR>
            
                  <TD COLSPAN = "3"><FONT SIZE = "+2">W</FONT>elcome to the user information area. Please login below using your email and password.  If you haven't created an account yet, enter your email and a password then press "New User"</TD></TR>

            <TR>
                  <TD>Email Address:</TD><TD><INPUT TYPE="TEXT" NAME = "LoginUser" VALUE = "<% =Request.Cookies("LoginInfo")("EMail") %>" SIZE="15"></TD></TR>
            <TR>      
                  <TD>Password:</TD><TD><INPUT TYPE="PASSWORD" NAME = "LoginPassword" VALUE = "" SIZE = "15"></TD></TR>
            <TR COLSPAN = "3" ALIGN = "RIGHT">
                  <TD COLSPAN = "3" ALIGN = "CENTER"><INPUT TYPE="SUBMIT" NAME="SubmitType" VALUE = "Login"></TD>
                  <TD ALIGN = "CENTER" COLSPAN = "2">
            </TR>
      </TD>
      </CENTER>
</FORM>
            <TR>            
            <TD COLSPAN = "3" ALIGN = "CENTER">
            <FORM ACTION = "Form.Asp" METHOD="POST" NAME="NewUser">
                  <INPUT TYPE="HIDDEN" NAME="Type" VALUE="NewUser">
                  <INPUT TYPE="SUBMIT"  NAME="SubmitType" VALUE = "New User">
            </FORM>


            </TABLE>
      
</TABLE>
</CENTER>
</HTML>

-------------------------------------------------
This is the Verification Script:

<% Response.Buffer = TRUE %>
<%
Param = Request.QueryString("Param")
Data = Request.QueryString("Data")
%>
<%
If IsObject(Session("YourDSN_conn")) Then
    Set conn = Session("YourDSN_conn")
Else
    Set conn = Server.CreateObject("ADODB.Connection")
    conn.open "YourDSN","",""
    Set Session("YourDSN_conn") = conn
End If
%>
<%
    sql = "SELECT Table.EMail, Table.UserPassword FROM Table;"

    If cstr(Param) <> "" And cstr(Data) <> "" Then
        sql = sql & " WHERE [Table.EMail] = request.form(LoginUser) "
    End If
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open sql, conn, 3, 3
%>

<%
On Error Resume Next
rs.MoveFirst
do while Not rs.eof
%>

<%
User=rs.Fields("EMail")
Pwd=rs.Fields("UserPassword")
User=UCase(User)
Pwd=UCase(Pwd)
%>

<% If UCase(Request.Form("LoginUser")) = User Then %>
      <% NSuccess = True %>
      <% rs.MoveLast %>
      <% If UCase(Request.Form("LoginPassword")) = Pwd Then %>
            HELLO!!!
            <%
            Response.Clear
            Response.Redirect "/Form.asp"  ' Form.Asp is the for they will go to if pwd/username are correct
            %>
      <% Else %>
            The login specifications you supplied were incorrect.  Please check them and try again.<BR>
            You provided the wrong: <B><FONT COLOR = "Red">Password</B></FONT><BR>
            <% DontShowHeader = True %>  ' Redirect them back to login page w/ error code.
            <!-- #include Virtual="/UserInfo/Index.Asp" -->
      <% End If %>
<% Else %>
      <% NSuccess = False %>
<% End If %>

<%
rs.MoveNext
loop
%>

<% If NSuccess = false then %>
      The login specifications you supplied were incorrect.  Please check them and try again.<BR>
      You provided the wrong: <B><FONT COLOR = "Red">EMail Address</B></FONT><BR>
      <% DontShowHeader = True %>
      <!-- #include Virtual="/UserInfo/Index.Asp" -->
<%End If %>
<% rs.Close %>
--------------------------------------------------
0
 

Author Comment

by:pmaderia
ID: 1836901
Yes. What I really want is for my website to be able to authenticate off of an access database. Also I have different forms that I would like to retrieve the information from and have that placed in the database. Ideally it would be entered as soon as they hit submit. Thanks alot for your response. I am a computer Instructor at Devry. I teach small system so programming has never been my strong point but now I am falling in love with it, yet at the same time I'm trying to get a KILLER website up to show to some potential investors in a business that I have some ownership in. It's a Travel Agency so if you need anything I'll do it at cost. Again thanks for the reply. I look forward to hearing from you soon.

Pat
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 10

Expert Comment

by:MasseyM
ID: 1836902
That would be no problem at all.. The above scripts allow you to authenticate off the access database... As for adding info to the DB, that is simple as well.. I could write those for you if you would like, or you can do it yourself..  Very simple.  Check out the book "ProfessionalActive Server Pages 2.0" from Wrox Press.   It tells you EXACTLY how to do everything you ever wanted to know about database connection within ASP.  
0
 

Author Comment

by:pmaderia
ID: 1836903
I would like to have you do that. What site are you the webmaster of? How much would it cost? I really want to learn myself as well. I'm going to go out and get that book tommorrow.

Thanks,

Pat
0
 
LVL 10

Expert Comment

by:MasseyM
ID: 1836904
I run a website at http://ldsmissions.net/crm/index.asp and a number of other intranet web sites... The above link is the first I have done in ASP and it is still in BETA testing... (There seem to be some browser incompatibility in my HTML, so I have to work that out), but everything is run via the ASP language and it is all database driven... It is a pretty neat thing to have it all dynamic... As for cost, I would rather just help you along the way... Let you code it and when you run into problems, I will try and assist you... But, if you would like it coded, you can email me at masseym@hotmail.com and tell me exactly what you are looking for and what information you need presented and we can see what we can come up with...

- Thanks for your time.

Matt
0
 

Author Comment

by:pmaderia
ID: 1836905
What page layout program do you use. Frontpage or something like that?
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Change div area and length 1 34
Hide cell in a table 2 27
How to create a table with buttons 3 22
output of netstat -r in Powersshell HTML 3 25
Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question