473,725 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Code for Change password in ASP for Windows XP, IIS server

1 New Member
Hi
Iam facing a problem in my project, developing a web site for online shopping in ASP on windows XP using IIS server.
All the validations are ok but the new password is not upadated in the data base and also showing a error page.

the operating system we used is Windows XP,
the source code is ASP,
front end we used - HTML and
javascript and vb script for validations.
the inputs we used are :
old pasword :
new password :
confirm your new password :
and SUBMIT button

we have used two files
in first page we give option for changepassword when the user clicks this option then he gets the page with above mentioned inputs , this is all written in one file changepass.asp the code of the file changepass.asp is as follows:
<%
'option explicit
Response.Buffer = True
Response.Expire s = 0
%>

<html>
<head>
<title> Login Screen </title>
</head>
<body>
<form name="login" action="changep ass2.asp" method="post">
<input type=button value=" <<BACK " name=butt1 onClick="window .location='logi n.asp'">
<table align=center border=3 cellpadding="3" cellspacing=0>

<tr>
<th colspan=2 bgcolor=black>
<font face=verdana color=red size=+1><b> Change Password </font>
</th>
</tr>

<tr>
<td>
<font face=verdana><b >Enter user name :
</td>
<td>
<input type="text" name="user" size="20">

</td>
</tr>

<tr>
<td>
<font face=verdana><b > Enter old password :
</td>
<td>
<input type="password" name="pwd" size="20">
</td>
</tr>

<tr>
<td>
<font face=verdana><b > Enter new Password :
</td>
<td>
<input type="password" name="pwd2" size="20">
</td>
</tr>

<tr>
<td>
<font face=verdana><b > Re-enter new Password :
</td>
<td>
<input type="password" name="pwd3" size="20">
</td>
</tr>
<tr>
<th colspan="2">
<input type="submit" value=" CHANGE ">
</th>
</tr>
</table>


</form>

<script language="javas cript">
document.login. user.focus();
</script>
</body>
</html>



Then now when he submits after filling the inputs thenthe page shifts to the changepass2.asp file and the code of changepass2 is as follows:

<%
Response.Buffer = True
Dim Uid,Pwd,UserTyp e
Dim ChkUser, ChkUserRS

Uid = request.form("u ser")
Pwd = request.form("p wd")
Pwd2 = request.form("p wd2")
Pwd3 = request.form("p wd3")

if pwd2 <> pwd3 then
Response.Write "<html><bod y background='../jpgfiles/logo10poorer.jp g'>" &_
"<font face='comic sans ms' color=red> <center><h2>N ew Password mismatch" &_
"</h2> <Br> <h3>Please try again.</h3><br>" &_
"<br><Br><B r> <font face='comic sans ms' color=blue><a href='javascrip t:history.go(-1)'><h3>BACK&gt &gt</a></h3></body></html>"
Response.End
end if
on error resume next %>
<!-- #include file="include.a sp"-->
<% con.begintrans

set productrs = server.CreateOb ject("ADODB.REC ORDSET")

ChkUser = "SELECT UserID,PWD,TYPE FROM eusers WHERE upper(UserID)=' " & ucase(uid) & "' AND pWD='" & pwd & "'"

set ChkUserRS = Con.Execute(Chk User)
UserType = ucase(ChkUserRS ("type"))
if err.number <> 0 then
Response.Write "<h2><center><f ont face='courier new' Color='red'>AN error occured while connecting to the database<br></center><br>"
Response.Write "<h2><center><f ont face='courier new' Color='red'><a href='mailto:hy pers@hd2.dot.ne t.in?subject=Re porti ng an error in your website&bodyfor mat=0&body=The following error occured in your site:-'>Please Mail us About this Error<br></center><br></a>"
Response.Write "<a href='login.asp '><h2><center>< font face='courier new' Color='red'>Cli ck here to Continue</a>"
con.rollbacktra ns
Response.end
end if


if not chkuserRS.eof then
Response.Write ucase(uid) & ucase(pwd)

if ucase(uid) = ucase(chkuserRS (0)) and ucase(pwd) = ucase(chkuserRS (1)) then
UpdateQry = "UPDATE eusers SET PWD = '" & pwd2 & "' WHERE upper(UserID)=' " & ucase(uid) & "' AND upper(PWD)='" & pwd & "'"

Con.execute(Upd ateQry)
con.committrans

session("user") = chkuserRS(0)
session("utype" ) = UserType
Con.close
set con = nothing
Response.Write usertype
if UserType = ucase("adm") or UserType = ucase("seller") then
Response.Redire ct "eshop0.asp "
Response.End
elseif UserType = ucase("buyer") then
Response.Redire ct "../search/lframe2.asp"
Response.End
end if
end if
end if
Con.close
set con = nothing

Response.Write usertype & "usertype"
Response.Write "<html><bod y background='../jpgfiles/cmp.jpg'>" &_
"<font face='comic sans ms' color=red> <center><h2>Inc orrect User Name or PassWord!!!" &_
"</h2> <Br> <h3>Please try again.</h3><br>" &_
"<br><Br><B r> <font face='comic sans ms' color=blue><a href='javascrip t:history.go(-1)'><h3>BACK&gt &gt</a></h3></body></html>"

%>



please check this code or else if u have any code plss sent it to me .. please do reply me
thanking you
sincerely
roshina
Mar 5 '07 #1
1 7427
jhardman
3,406 Recognized Expert Specialist
the code of changepass2 is as follows:

<%
Response.Buffer = True
Dim Uid,Pwd,UserTyp e
Dim ChkUser, ChkUserRS

Uid = request.form("u ser")
Pwd = request.form("p wd")
Pwd2 = request.form("p wd2")
Pwd3 = request.form("p wd3")

if pwd2 <> pwd3 then
Response.Write "<html><bod y background='../jpgfiles/logo10poorer.jp g'>" &_
"<font face='comic sans ms' color=red> <center><h2>N ew Password mismatch" &_
"</h2> <Br> <h3>Please try again.</h3><br>" &_
"<br><Br><B r> <font face='comic sans ms' color=blue><a href='javascrip t:history.go(-1)'><h3>BACK&gt &gt</a></h3></body></html>"
Response.End
end if
on error resume next %>
<!-- #include file="include.a sp"-->
<% con.begintrans

set productrs = server.CreateOb ject("ADODB.REC ORDSET")

ChkUser = "SELECT UserID,PWD,TYPE FROM eusers WHERE upper(UserID)=' " & ucase(uid) & "' AND pWD='" & pwd & "'"

set ChkUserRS = Con.Execute(Chk User)
UserType = ucase(ChkUserRS ("type"))
if err.number <> 0 then
Response.Write "<h2><center><f ont face='courier new' Color='red'>AN error occured while connecting to the database<br></center><br>"
Response.Write "<h2><center><f ont face='courier new' Color='red'><a href='mailto:hy pers@hd2.dot.ne t.in?subject=Re porti ng an error in your website&bodyfor mat=0&body=The following error occured in your site:-'>Please Mail us About this Error<br></center><br></a>"
Response.Write "<a href='login.asp '><h2><center>< font face='courier new' Color='red'>Cli ck here to Continue</a>"
con.rollbacktra ns
Response.end
end if


if not chkuserRS.eof then
Response.Write ucase(uid) & ucase(pwd)

if ucase(uid) = ucase(chkuserRS (0)) and ucase(pwd) = ucase(chkuserRS (1)) then
UpdateQry = "UPDATE eusers SET PWD = '" & pwd2 & "' WHERE upper(UserID)=' " & ucase(uid) & "' AND upper(PWD)='" & pwd & "'"

Con.execute(Upd ateQry)
con.committrans

session("user") = chkuserRS(0)
session("utype" ) = UserType
Con.close
set con = nothing
Response.Write usertype
if UserType = ucase("adm") or UserType = ucase("seller") then
Response.Redire ct "eshop0.asp "
Response.End
elseif UserType = ucase("buyer") then
Response.Redire ct "../search/lframe2.asp"
Response.End
end if
end if
end if
Con.close
set con = nothing

Response.Write usertype & "usertype"
Response.Write "<html><bod y background='../jpgfiles/cmp.jpg'>" &_
"<font face='comic sans ms' color=red> <center><h2>Inc orrect User Name or PassWord!!!" &_
"</h2> <Br> <h3>Please try again.</h3><br>" &_
"<br><Br><B r> <font face='comic sans ms' color=blue><a href='javascrip t:history.go(-1)'><h3>BACK&gt &gt</a></h3></body></html>"

%>



please check this code or else if u have any code plss sent it to me .. please do reply me
thanking you
sincerely
roshina
It doesn't look like you set the "con". Is this the whole code? Maybe I missed it somewhere.

Jared
Mar 5 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
5887
by: gicio | last post by:
HI! I have a little problem: I have change the administrator password (Windows 2003 Server) which MS SQL 2000 use to login. And now the SQL server can't stand up. What should I do? thx!
0
1268
by: Sylvain Audet | last post by:
Hi there! We are experiencing a very strange problem with our VB.NET application. The application is using .NET Framework v1.1.4322 and the problem is experienced only by Windows XP users. When our application starts, it retrieves all required core assemblies from a network path \\SERVER\DIRECTORY\ and copy them locally using standard System.IO classes. It then load those core assemblies through reflection and get some other...
14
6163
by: Mr.KisS | last post by:
Hi, How to change the account that ASP.NET uses for this virtual directory to one that has rights to the SQL Server box. Or how to use impersonation set in the Web.config file for the asp application, referring to an account that has rights to the SQL Server box.
2
2289
by: Rod | last post by:
I have a requirement in which I need to allow the user to log into our ASP.NET application, but also be able to change their Windows password, if it is expired. I had thought that Windows authentication would do the trick, but it appears not to. (If the user's password has expired, it will sit there forever asking the user for their username and password in the Windows login dialog box that pops up.) 1) The way I see it, I have two...
22
3422
by: Bob and Sharon Hiller | last post by:
I have an ASP page that was done in VBScript It is setup to read an Access database and I need to change it to read a Sql 2005 Database. The code that is used to open the Access Database: Set adoConnection = server.CreateObject("ADODB.Connection") Set adoRecordset = server.CreateObject("ADODB.Recordset") adoConnection.Provider = "Microsoft.Jet.OLEDB.4.0" Dim strLocation, iLength
2
4499
by: J | last post by:
Hello. I apologize if this isn't the appropriate group for this question but I was wondering if it's possible to allow regular windows domain users to change their passwords through an .asp page? I'm trying to figure out the best way to handle domain users to log into an .asp application tied with SQL Server 2000 on the back end since I keep reading that windows authentication is better practice to log into SQL Server. Thanks in...
0
2215
by: shellegreen | last post by:
Hello, I need help with some password changes that I have to do in some iPAQs. The company that I work has 3 models of iPAQ and 3 different versions of Windows Mobile (Microsoft Pocket PC 4.20.0, Win Mobile 2003 SE e Win Mobile 5.0). The devices are configured to use Dial up or Cell Phone connection (Bluetooth or infrared). Recently we developed a program that check the user password expiration date in Active Directory Server every...
4
5810
by: =?Utf-8?B?QXZhRGV2?= | last post by:
ASP.Net 2. We are migrating to Windows 2008 64 bit Server with IIS 7 from Windows 2003 32 Bit with IIS 6. A few library classes we wrote uses impersonation in code like explained in this article: http://support.microsoft.com/?id=306158#4 This doesn't work in Windows 2008 Server, we receive the following exception:
8
6334
by: Brett | last post by:
I wrote an ASP.NET application that queries a SQL Server database (on a different box from the web server) and displays the result in a GridView. The datasource for the GridView is a SQLDataSource. Just to get it to work, I hard-coded the username and password of a SQL Server account in the connectionstring in web.config. Once I confirmed that this worked on the web server, I wanted to remove the hard-coded password from web.config, so I...
0
8889
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8099
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3228
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.