Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Login Script 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Can anyone tell me where i can find a good ASP Login Script with a 'Forgotten Password' section included. Most of the ASP sites dont have what i am looking for.

Thanks.

P.S. I am also looking for a ASP Shopping cart script that is quality code with good features and Access 2000 driven.

Hope someone can help!!!
 
Try this code :

<%
data_source = &quot;Provider=Microsoft.Jet.OLEDB.4.0; Data Source=&quot; & Server.MapPath(&quot;site.mdb&quot;)
username = Request(&quot;username&quot;)
password = Request(&quot;password&quot;)
try = Request(&quot;try&quot;)
forgot = Request(&quot;forgot&quot;)
sendpwtry = Request(&quot;sendpwtry&quot;)
If sendpwtry = &quot;True&quot; Then
Set rsp = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsp.Open &quot;select * from login where ( username = '&quot; & USERNAME & &quot;' )&quot;, data_source
If rsp.EOF And rsp.BOF Then
%>
<html>
<head>
<title>
</title>
</head>
<body>
<form action>
<input type=&quot;hidden&quot; name=&quot;sendpwtry&quot; value=&quot;True&quot;>
<table>
<tr>
<td><img alt=&quot;&quot;&quot;&quot; src=&quot;&quot;../img/spacer.gif&quot;&quot; height=&quot;&quot;10&quot;&quot; width=&quot;&quot;1&quot;&quot;></td>
</tr>
<tr>
<td colspan=&quot;&quot;2&quot;&quot;><font face=&quot;&quot;Verdana, Arial, Helvetica, sans-serif&quot;&quot; size=&quot;&quot;2&quot;&quot;>That username does not exist in the database</font></td>
</tr>
<tr>
<td><font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;>Username :</font></td>
<td><input type=&quot;text&quot; name=&quot;username&quot;></td>
</tr>
<tr>
<td colspan=&quot;2&quot; align=&quot;right&quot;><input type=&quot;submit&quot; value=&quot;Request Password&quot;></td>
</tr>
</table>
</form>
</body>
</html>
<%
rsp.Close
Set rsp = Nothing
Else
%>
<html>
<head>
<title>
</title>
</head>
<body>
<table>
<tr>
<%
name = &quot;Your-Site admin&quot;
senderEmail = &quot;admin@your-site.com&quot;
subject = &quot;You password is...&quot;
recipient = rsp(&quot;email&quot;)
body = &quot;... Hello &quot; & rsp(&quot;username&quot;) & &quot; your password is : ' &quot; & rsp(&quot;password&quot;) & &quot; '&quot;


set msg = Server.CreateOBject( &quot;JMail.Message&quot; )

msg.Logging = true
msg.silent = true


msg.From = senderEmail
msg.FromName = name

msg.AddRecipient recipient

msg.body = body

If not msg.Send(&quot;mail.your-server.co.uk&quot; ) Then
Response.Write &quot;<td><font face=&quot;&quot;Verdana, Arial, Helvetica, sans-serif&quot;&quot; size=&quot;&quot;2&quot;&quot;>&quot; & msg.log & &quot;</font></td>&quot;
Else
Response.Write &quot;<td><font face=&quot;&quot;Verdana, Arial, Helvetica, sans-serif&quot;&quot; size=&quot;&quot;2&quot;&quot;>Your password has been e-mailed to : &quot; & rsp(&quot;email&quot;) & &quot;</font></td>&quot;
End If

rsp.Close
Set rsp = Nothing
%>
</tr>
</table>
</form>
</body>
</html>
<%
End If
Else
If forgot = &quot;True&quot; Then
%>
<html>
<head>
<title>
</title>
</head>
<body>
<form action>
<input type=&quot;hidden&quot; name=&quot;sendpwtry&quot; value=&quot;True&quot;>
<table>
<tr>
<td><font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;>Username :</font></td>
<td><input type=&quot;text&quot; name=&quot;username&quot;></td>
</tr>
<tr>
<td colspan=&quot;2&quot; align=&quot;right&quot;><input type=&quot;submit&quot; value=&quot;Request Password&quot;></td>
</tr>
</table>
</form>
</body>
</html>
<%
Else
If try = &quot;True&quot; Then
If session(&quot;access&quot;) = &quot;True&quot; Then
Response.Write &quot;&quot;
Else
Set rsp = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsp.Open &quot;select * from login where ( username = '&quot; & USERNAME & &quot;' ) and ( password = '&quot; & PASSWORD & &quot;')&quot;, data_source
If rsp.EOF And rsp.BOF Then
rsp.Close
Set rsp = Nothing
eror = &quot;<tr><td><img alt=&quot;&quot;&quot;&quot; src=&quot;&quot;../img/spacer.gif&quot;&quot; height=&quot;&quot;10&quot;&quot; width=&quot;&quot;1&quot;&quot;></td></tr><tr><td colspan=&quot;&quot;2&quot;&quot;><font face=&quot;&quot;Verdana, Arial, Helvetica, sans-serif&quot;&quot; size=&quot;&quot;2&quot;&quot;><h1>Login Incorrect</h1>Please retype your <strong>username</strong> and <strong>password</strong></font></td></tr>&quot;
Else
pword = rsp(&quot;password&quot;)
uname = rsp(&quot;username&quot;)
rsp.Close
Set rsp = Nothing
If pword = password And uname = username Then
session(&quot;access&quot;)=(&quot;True&quot;)
End If
End If
End If
End If
If Not session(&quot;access&quot;) = &quot;True&quot; Then
%>
<html>
<head>
<title>
</title>
</head>
<body>
<form action=&quot;default.asp&quot; method=&quot;post&quot;>
<input type=&quot;hidden&quot; name=&quot;try&quot; value=&quot;True&quot;>
<table>
<tr>
<td colspan=&quot;2&quot;><font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;>Enter you login information below.</font></td>
</tr>
<% =eror %>
<tr>
<td><img alt=&quot;&quot; src=&quot;../img/spacer.gif&quot; height=&quot;10&quot; width=&quot;1&quot;></td>
</tr>
<tr>
<td><font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;>Username :</font></td>
<td><input type=&quot;text&quot; name=&quot;username&quot;></td>
</tr>
<tr>
<td><font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;>Password :</font></td>
<td><input type=&quot;password&quot; name=&quot;password&quot;></td>
</tr>
<tr>
<td colspan=&quot;2&quot;><font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;><a href=&quot;default.asp?forgot=True&quot;>Forgot password ?</a></font></td>
</tr>
<tr>
<td colspan=&quot;2&quot; align=&quot;right&quot;><input type=&quot;submit&quot; value=&quot;Login&quot;></td>
</tr>
</table>
</form>
</body>
</html>
<%
Else
%>
<html>
<head>
<title>
</title>
</head>
<body>
<table>
<tr>
<td><font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;>You are now logged in.</font></td>
</tr>
</table>
</body>
</html>
<%
End If
End If
End If
%> Regards

Big Dave


** If I am wrong I am sorry, but i'm only trying to help!! **

 
Hey thanks Dave........I will give that a try.......looks like the code i need........Would you know of a comprehensive quality ASP Shopping cart script that is Access 2000 driven?.....I need one fairly quickly to include into my site.......hey thanks again for your help.
 
Sure,
I'll make you one 2morrow, Off to bed now as it's 5 oclock in the morning. Regards

Big Dave


** If I am wrong I am sorry, but i'm only trying to help!! **

 
FYI -- next time you post on ASP, just to let you know there is another forum on this site just for ASP.

First you make a page that requests user's email, then the action page checks the database table for this email, and if it finds the record, it sends the password field from this table to that email via CDONTS or any other mailing component.

HTH,
Rydel
---
---
 
To Dave.......with the script you supplied above........do i need to name each page with a specific name and will i need to create an access 2000 database.........As you probably gathered i am new to asp and need some help setting it up.......i have tried to run the scripts in IIS but they wont work.....can you help with these questions??

Thanks
 
Yes, the reason the script I made dosn't work on your machine, is because you havn't got the DB set-up. Regards

Big Dave


** If I am wrong I am sorry, but i'm only trying to help!! **

 
And in answer to the other question, the script runs from one page only. It is just default.asp Regards

Big Dave


** If I am wrong I am sorry, but i'm only trying to help!! **

 
which script do i name default.asp.........the first part of the script??..........i have added each block of asp code into a seperate page..and at this stage i have just named them asp1 through to asp5
 
Dave.....do i create a database table with the field of Username and another for password.........and is that all?
 
You need fields :

username

password

email

ok Regards

Big Dave


** If I am wrong I am sorry, but i'm only trying to help!! **

 
Oh yeah,
You will need to set the mail component bit up to match the mail component you have on the server, if you don't know how to do that then just say. Regards

Big Dave


** If I am wrong I am sorry, but i'm only trying to help!! **

 
Dave......do i name the first block of asp code as the default.asp page.............or is it one of the other sections...............hey thanks for your help too
 
just cut and paste the whole code, and save the whol chunk as default.asp (from : <% to : %> ) Regards

Big Dave


** If I am wrong I am sorry, but i'm only trying to help!! **

 
One more question Dave , then i wont bother you again.........if the user is new to the site how can i have a registration page to initally let them set up their account as a new user??
 
Yup,
I will do you a demo 2morrow. Regards

Big Dave


** If I am wrong I am sorry, but i'm only trying to help!! **

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top