PK

ADDRLIN : /home/anibklip/aaravpest.in/2021-22/
FLL :
Current File : /home/anibklip/aaravpest.in/2021-22/change_pass.php

<?php 
include "templatic/head.php"; 
include "templatic/header.php";

if($_POST[sbmt_btn]){
	$old_pass=md5($_POST[old]);
	$pass=md5($_POST[n1]);

	$sql="SELECT * from users where username='admin' and password='$old_pass'";
	//echo "$sql <br>";
	$result=mysql_query($sql) or die(mysql_error());
	if($row=mysql_fetch_array($result)){
		$q="update users set password='$pass' where username='admin'";
		//echo "$q<br>";
		mysql_query($q) or die(mysql_error());
		echo "<h3>Password changed successfully</h3>.";
	}else{
		echo "<h3>Old password not matched</h3>";
	}
}
?>
<script type="text/javascript">
	<!--
	function Validate() {
        var password = document.getElementById("n1").value;
        var confirmPassword = document.getElementById("n2").value;
        if (password != confirmPassword) {
            alert("Passwords do not match.");
            return false;
        }
        return true;
    }
	//-->
</script>

<div class="box">
	<h2>Change Password</h2>
	<div style="padding:0px 1px;">
		<form action="" method="post">
			<table border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td align="right">Old Password:</td>
					<td align="left"><input type="password" name="old" id="old" required />
					</td>
				</tr>
				<tr>
					<td align="right">New Password:</td>
					<td align="left"><input type="password" name="n1" id="n1" required /></td>
				</tr>
				<tr id="parent_cert">
					<td align="right">Confirm New Password:</td>
					<td align="left"><input type="password" name="n2" id="n2" required /></td>
				</tr>
				<tr>
					<td colspan="2" align="center">
						<center>
							<input type="submit" value="&raquo; Change &raquo" name="sbmt_btn" class="amo-submit" onclick="return Validate()">
						</center>
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>
<?php
include "templatic/footer.php";
?>


PK 99