| Current Path : /home/bolconlineco/public_html/aaaaaa/coordinator/ |
| Current File : /home/bolconlineco/public_html/aaaaaa/coordinator/changepassword.php |
<?php
ob_start();
session_start();
include('includes/header.php');
if(!isset($_SESSION['coordinator']) || $_SESSION['coordinatorrole'] != 2)
{
header("location:../index.php");
exit();
} ?>
<script language="javascript" src="includes/jquery.js"></script>
<h3 class="page-title">Change Password</h3>
<ul class="page-breadcrumb breadcrumb">
<li><i class="fa fa-home"></i> <a href="dashbord.php"> Home </a> <i class="fa fa-angle-right"></i> </li>
<li class="active">Change Password</li>
</ul>
<?php
if(isset($_GET['rollno']))
{
$rollno=sql_strip($_GET['rollno']);
}
?>
<?php
if(isset($_GET['error']))
{
echo "Your new new password and confirm password must be match";
}else if(isset($_GET['ex']))
{
echo "Enter your old password";
}else if(isset($_GET['ok']))
{
echo "Password change Successfully";
}
?>
<form action="" method="post" class="form-horizental">
<div class="form-group clearfix">
<label for="oldpassword" class="col-sm-2 control-label">Old Password:</label>
<div class="col-sm-6">
<input type="password" name="oldpassword" class="form-control"/>
</div>
</div>
<div class="form-group clearfix">
<label for="newpassword" class="col-sm-2 control-label">New Password:</label>
<div class="col-sm-6">
<input type="password" name="newpassword" class="form-control"/>
</div>
</div>
<div class="form-group clearfix">
<label for="confirmpassword" class="col-sm-2 control-label">Confirm Password:</label>
<div class="col-sm-6">
<input type="password" name="confirmpassword" class="form-control"/>
</div>
</div>
<div class="form-group clearfix">
<div class="col-sm-6 col-sm-offset-2">
<input class="add2 btn btn-success" type="reset" value="cancel" style="margin-right:10px;" />
<input class="add2 btn btn-success" type="submit" name="update-pass" value="Update " />
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div> <!-- end content -->
</div><!-- end wrapper -->
<?php
if(isset($_POST['update-pass']))
{
$old = md5(sql_strip($_POST['oldpassword']));
$new = md5(sql_strip($_POST['newpassword']));
$newconfirm = md5(sql_strip($_POST['confirmpassword']));
if($new != $newconfirm)
{
header("location:changepassword.php?error");
exit();
}
else
{
$sql="select adminId from admin where userPass = '$old'";
$result=mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($result) == 1)
{
$sql="update admin set userPass='$new' where userPass='$old'";
$result=mysql_query($sql) or die(mysql_error());
header("location:changepassword.php?ok");
exit();
}
else
{
header("location:changepassword.php?ex");
exit();
}
}
}
?>
<?php include('../includes/footer.php');?>