
PK 
<?php
include("header.php");
if($_SESSION["aid"]=='')
{
echo "<script>window.location='index.php';</script>";
}
@extract($_POST);
if(isset($_POST['submit']))
{
$old = $_POST['oldpassword'] ;
$new = $_POST['newpassword'];
$event_sql = "select password from jeff_login where id='".$_SESSION["aid"]."'";
$result = mysqli_query($conn,$event_sql);
$rslt=mysqli_fetch_array($result);
$pass= $rslt['password'];
if($pass == $old)
{
$updqry="UPDATE jeff_login SET password='".$new."' where id='".$_SESSION["aid"]."'";
mysqli_query($conn,$updqry);
$flug = "success";
}
else
{
$flag = "error";
}
}
$event_sql=mysqli_query($conn,"select * from jeff_login where id='1' ");
$rslt=mysqli_fetch_array($event_sql);
$id=$rslt['id'];
$password=$rslt['password'];
?>
<body>
<!------===============---- Change Password Styles -----================----------->
<style>
#setPasswordMessage.lowPassword{
color: red;
font-weight: bold;
}
#setPasswordMessage.stilllowPassword {
color: red;
font-weight: bold;
}
#setPasswordMessage.mediumPassword {
color: #EFCE01;
font-weight: bold;
}
#setPasswordMessage.averagePassword {
color: green;
font-weight: bold;
}
#setPasswordMessage.strongPassword {
color: green;
font-weight: bold;
}
#setPasswordMessage.goodpass {
color: green;
font-weight: bold;
}
.showPass{
color: #fff;
}
#showHide{margin:5px 0 0 5px;}
.setLabel{color: #fff;
}
</style>
<script type="text/javascript">
//<!----=================-- Change Password Validation =========
$(document).ready(function() {
var newpassword = $('#newpassword'); //id of first password field
var rnewpassword = $('#rnewpassword'); //id of second password field
var pwdIdSet = $('#setPasswordMessage'); //id of indicator element
setCheckPasswordStrength(newpassword,rnewpassword,pwdIdSet); //call password check function
});
function setCheckPasswordStrength(newpassword, rnewpassword, pwdIdSet)
{
/*=========== Start: Set Password Cretria Regular Expression ===================*/
//Password must contain 5 or more characters
var lowPassword = /(?=.{3,}).*/;
//Password must contain at least one digit and lower case letters .
var mediumPassword = /^(?=\S*?[a-z])(?=\S*?[0-9])\S{3,}$/;
//Password must contain at least one digit, one upper case letter and one lower case letter.
var averagePassword = /^(?=\S*?[A-Z])(?=\S*?[a-z])(?=\S*?[0-9])\S{3,}$/;
//Password must contain at least one digit, one upper case letter and one lower case letter.
var strongPassword = /^(?=\S*?[A-Z])(?=\S*?[a-z])(?=\S*?[0-9])(?=\S*?[^\w\*])\S{3,}$/;
/*=========== End: Set Password Cretria Regular Expression ===================*/
// test() method is used to test match in a string whether the value is matched in a string or not.
$(newpassword).on('keyup', function(e) {
document.getElementById("setPasswordMessage").style.display="block";
if(strongPassword.test(newpassword.val()))
{
pwdIdSet.removeClass().addClass('strongPassword').html("Very Strong");
}
else if(averagePassword.test(newpassword.val()))
{
pwdIdSet.removeClass().addClass('averagePassword').html("Strong");
}
else if(mediumPassword.test(newpassword.val()))
{
pwdIdSet.removeClass().addClass('mediumPassword').html("Good");
}
else if(lowPassword.test(newpassword.val()))
{
pwdIdSet.removeClass().addClass('stilllowPassword').html("Weak");
}
else
{
pwdIdSet.removeClass().addClass('lowPassword').html("");
}
});
$(rnewpassword).on('keyup', function(e) {
if(newpassword.val() !== rnewpassword.val())
{
pwdIdSet.removeClass().addClass('lowPassword').html("Password do not match!");
}else{
pwdIdSet.removeClass().addClass('goodpass').html("Password Matches");
}
});
}
function validate()
{
document.getElementById("id_oldpassword").innerHTML='';
document.getElementById("id_oldpassword").innerHTML='';
document.getElementById("id_oldpassword").innerHTML='';
if(document.change_password.oldpassword.value=="")
{
document.getElementById('id_oldpassword').innerHTML='<p>Enter old password</p>';
document.change_password.oldpassword.focus();
return false;
}
if(document.change_password.newpassword.value=="")
{
document.getElementById('id_oldpassword').innerHTML='<p>Enter new password</p>';
document.change_password.newpassword.focus();
return false;
}
/* if(document.change_password.newpassword.value.length<7)
{
document.getElementById("id_oldpassword").innerHTML='<span><font color="#FF0000">Minimum 7 Character</font></span>';
document.change_password.newpassword.focus();
return false;
} */
if(document.change_password.oldpassword.value == document.change_password.newpassword.value)
{
document.getElementById('id_oldpassword').innerHTML='<p>New Password and Old Pasword are same Please Change It</p>';
document.change_password.newpassword.value="";
document.change_password.rnewpassword.value="";
document.change_password.newpassword.focus();
return false;
}
if(document.change_password.rnewpassword.value=="")
{
document.getElementById('id_oldpassword').innerHTML='<p>Enter Re-Type password</p>';
document.change_password.rnewpassword.focus();
return false;
}
if(document.change_password.rnewpassword.value != document.change_password.newpassword.value)
{
document.getElementById('id_oldpassword').innerHTML='<p>New Password and re-typepassword not same</p>';
document.change_password.rnewpassword.focus();
return false;
}
}
</script>
<!--------==========-- End Change Password Validation -----=============================----------->
<style type="text/css">
.error
{
font-size:13px;
}
#name_error
{
color:#FF0000;
}
#form2 .short{
color:#FF0000;
}
#form2 .weak{
color:#E66C2C;
}
#form2 .good{
color:#2D98F3;
}
#form2 .strong{
color:#006400;
}
.right-content .form-horizontal .form-control{
border: 1px solid grey !important;
}
.gg:hover
{
background-color:#000 !important;
}
</style>
<!------================== Hover Style ========================---------->
<style>
#header_hover:hover{
background-color:#000 ! important;
}
</style>
<div id="wrapper">
<?php
include('sidebar.php');
?>
<div id="page-wrapper" class="gray-bg">
<?php include('afterlog_top.php'); ?>
<div class="row wrapper border-bottom white-bg page-heading">
<div class="col-lg-10">
<h2>Change Password</h2>
<ol class="breadcrumb">
<li>
<a href="dashboard.php">Home</a>
</li>
<li class="active">
<strong>Change Password</strong>
</li>
</ol>
</div>
<div class="col-lg-2">
</div>
</div>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title">
<a href="" class="btn btn-danger btn-xs" id="header_hover" ><h5 >Change Password</h5></a>
<div class="pull-right tooltip-demo ibox-tools">
<a class="collapse-link">
<i class="fa fa-chevron-up"></i>
</a>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<!---============== Password Change Form==================----->
<div class="ibox-content">
<div class="row">
<div class="col-lg-1"></div>
<div class="col-lg-10">
<span id="id_oldpassword" style="text-align:center;color:#FE2805;font-size:14px; font-weight:600;"> </span>
<?php
if(isset($flag)=="error")
{
?>
<div class="form-group" style="color:#FECB05;text-align:center;"> <b>Error :</b> Old Password is Incorrect. </div>
<?php
}
?>
<?php
if(isset($flug)=="success")
{
?>
<div class="albox succesbox" style="color:#419641;text-align:center;"> <b>Success :</b> Changed Password Sucessfully. </div>
<?php
}
?>
<form class="form-horizontal" id="change_password" name="change_password" method="post" action="" onsubmit="return validate();">
<div class="form-group">
<label style="text-align:left;" class="col-lg-4 control-label">Old Password<span style="color:#FF0000;">*</span></label>
<div class="col-lg-8">
<input style="color:#777;" name="oldpassword" id="oldpassword" placeholder="Old Password" type="password" class="form-control" value="" onblur="validate1(this.value)"/>
</div>
</div>
<div class="form-group">
<label style="text-align:left;" class="col-lg-4 control-label">New Password<span style="color:#FF0000;">*</span></label>
<div class="col-lg-8">
<input style="color:#777;" name="newpassword" id="newpassword" type="password" placeholder="New Password" class="form-control" value="" ><span id="password_strength" /><span id="result"></span>
</div>
</div>
<div class="form-group">
<label style="text-align:left;" class="col-lg-4 control-label">Re-Type New Password<span style="color:#FF0000;">*</span></label>
<div class="col-lg-8">
<input style="color:#777;" name="rnewpassword" id="rnewpassword" type="password" placeholder="Re-Type New Password" class="form-control" value=""/>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-4 col-lg-12">
<input class="btn btn-danger" type="button" value="Back" onclick="window.history.back();">
<input class="btn btn-success" type="submit" name="submit" value="Update">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!---============== Footer==================----->
<?php include("footer.php");?>
</div>
</div>
</body>
</html>


PK 99