ONLINE NESCAFE OF COLLEGE CAMPUS-16
(FORM OF CHANGING DATABASE OF ADMIN)
CHANGE_PASSWORD.ASP
This page shows you the how the form is created for changing the password of administrator in the database ADMIN.

<html>
<body>
<form method=”post” action=”Validate_Password.asp”>
<table align=”center” cellpadding=”0″ cellspacing=”0″ border=”0″>
<tr>
<td>Current Password:</td>
<td><input value=”"></td>
</tr>
<tr>
<td>New Password:</td>
<td><input value=”"></td>
</tr>
<tr>
<td>Confirm Password:</td>
<td><input value=”"></td>
</tr>
<tr>
<td align=”center” colspan=”2″><input value=”Change Password”></td>
</tr>
</table>
</form>
</body>
</html>
(ASP SCRIPT OF CHANGING PASSWORD FROM DATABASE)
VALIDATE_PASSWORD.ASP
As you can see in CHANGE_PASSWORD.ASP that the values of the form have been sent to VALIDATE_PASSWORD .asp. In this script, the connectivity is done with the database, validations are performed and PASSWORD is CHANGED from it with the help of UPDATE method.
If every validation is successful, then the following window will appear and database will be updated. Before the execution of the following script, the password was phg, now it will be changed to hardik
<%@Language=”VBScript”%>
<%Option Explicit%>
<!–#include virtual=”/adovbs.inc”–>
<html>
<body>
<center>
<%
Dim MPath
MPath=Server.MapPath(“Storage.mdb”)
Dim objConn
Set objConn=Server.CreateObject(“ADODB.Connection”)
objConn.Mode=adModeReadWrite
objConn.Provider=”Microsoft.Jet.OLEDB.4.0″
objConn.Open (MPath)
Dim Current_Password
Dim New_Password
Dim Confirm_Password
Current_Password=Request.Form(“Current_Password”)
New_Password=Request.Form(“New_Password”)
Confirm_Password=Request.Form(“Confirm_Password”)
If Current_Password=”" OR New_Password=”" OR Confirm_Password=”" Then
Response.Write “<br><br><br><font color=’#FF0000′ face=’Verdana, Arial, Helvetica, sans-serif’ size=’+3′>No field can be left blank.<br><br><br>”
Response.Write “<a href=’Change_Password.asp’>Back</a></font>”
Else
Dim strSQL
strSQL=”SELECT Password FROM Admin WHERE Administrator=’admin’”
Dim objRS
Set objRS=Server.CreateObject(“ADODB.Recordset”)
objRS.Open strSQL,objConn,,adLockOptimistic
If Current_Password<>objRS(“Password”) Then
Response.Write “<br><br><br><font color=’#FF0000′ face=’Verdana, Arial, Helvetica, sans-serif’ size=’+3′>Current Password entered by You is not valid.<br><br><br>”
Response.Write “<a href=’Change_Password.asp’>Back</a></font>”
Else
If Not(New_Password=Confirm_Password) Then
Response.Write “<br><br><br><font color=’#FF0000′ face=’Verdana, Arial, Helvetica, sans-serif’ size=’+3′>New Password and confirm password does not match.<br><br><br>”
Response.Write “<a href=’Change_Password.asp’>Back</a></font>”
Else
objRS(“Password”)=New_Password
objRS.Update
Response.Write “<br><br><br><font color=’#FF0000′ face=’Verdana, Arial, Helvetica, sans-serif’ size=’+3′>Password hase been successfully changed.<br><br><br>”
Response.Write “<a href=’Change_Password.asp’>Back</a></font>”
End If
End If
objRS.Close
Set objRS=Nothing
objConn.Close
Set objConn=Nothing
End If
%>
</center>
</body>
</html>
Now, the database will look as follows: