Solved

login script

Posted on 1998-08-21
7
155 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

707 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now