239 lines
8.0 KiB
PHP
239 lines
8.0 KiB
PHP
<?php
|
|
include('techsyn_header.php');
|
|
include('log_entry.php');
|
|
|
|
|
|
?>
|
|
<link rel="stylesheet"
|
|
href="assets/font-awesome/4.5.0/css/font-awesome.min.css" />
|
|
|
|
<!-- page specific plugin styles -->
|
|
<link rel="stylesheet" href="assets/css/jquery-ui.custom.min.css" />
|
|
<link rel="stylesheet" href="assets/css/chosen.min.css" />
|
|
<link rel="stylesheet" href="assets/css/bootstrap-datepicker3.min.css" />
|
|
<link rel="stylesheet" href="assets/css/bootstrap-timepicker.min.css" />
|
|
<link rel="stylesheet" href="assets/css/daterangepicker.min.css" />
|
|
<link rel="stylesheet"
|
|
href="assets/css/bootstrap-datetimepicker.min.css" />
|
|
<link rel="stylesheet" href="assets/css/bootstrap-colorpicker.min.css" />
|
|
<script type="text/javascript" src="js/typeahead.bundle.js"></script>
|
|
<script src="assets/js/jquery-ui.custom.min.js"></script>
|
|
<script src="assets/js/jquery.ui.touch-punch.min.js"></script>
|
|
<script src="assets/js/chosen.jquery.min.js"></script>
|
|
<script src="assets/js/spinbox.min.js"></script>
|
|
<script src="assets/js/bootstrap-datepicker.min.js"></script>
|
|
<script src="assets/js/bootstrap-timepicker.min.js"></script>
|
|
<script src="assets/js/jquery.dataTables.min.js"></script>
|
|
<script src="assets/js/jquery.dataTables.bootstrap.min.js"></script>
|
|
<script src="assets/js/dataTables.buttons.min.js"></script>
|
|
<script src="assets/js/buttons.flash.min.js"></script>
|
|
<script src="assets/js/buttons.html5.min.js"></script>
|
|
<script src="assets/js/buttons.print.min.js"></script>
|
|
<script src="assets/js/buttons.colVis.min.js"></script>
|
|
<script src="assets/js/dataTables.select.min.js"></script>
|
|
|
|
|
|
<script src="assets/js/moment.min.js"></script>
|
|
<script src="assets/js/daterangepicker.min.js"></script>
|
|
<script src="assets/js/bootstrap-datetimepicker.min.js"></script>
|
|
<script src="assets/js/bootstrap-colorpicker.min.js"></script>
|
|
<script src="assets/js/jquery.knob.min.js"></script>
|
|
<script src="assets/js/autosize.min.js"></script>
|
|
<script src="assets/js/jquery.inputlimiter.min.js"></script>
|
|
<script src="assets/js/jquery.maskedinput.min.js"></script>
|
|
<script src="assets/js/bootstrap-tag.min.js"></script>
|
|
<script src="assets/js/ace-elements.min.js"></script>
|
|
<?php
|
|
error_log("hid".$hid."frmacn:".$POST['frmacn']);
|
|
if (isset ( $hid ) && $hid == '1') {
|
|
$msg = "";
|
|
//if ($POST['frmacn'] == "Update") {
|
|
$userid = $_SESSION ['user_id'];
|
|
$sql = "SELECT user_password FROM $TABLENAME WHERE user_id='" . $userid . "'";
|
|
$res = @mysqli_query($conn,$sql );
|
|
$row = @mysqli_fetch_array ( $res );
|
|
@extract ( $row );
|
|
if ($POST['old_pass'] == $row ['user_password']) {
|
|
$cont = strlen ( $new_pass );
|
|
if (($new_pass == $conf_pass) && ($cont > 4)) {
|
|
$result = mysqli_query($conn,"UPDATE tbl_users SET user_password = '" . $new_pass . "' WHERE user_id='" . $userid . "'" ) or die ( mysqli_error($conn) );
|
|
$msg = "Password Changed Successfully";
|
|
if (! $result) {
|
|
$msg = 'Error';
|
|
error_log("Failed to change the password.");
|
|
}
|
|
error_log("Password changed.");
|
|
echo "<script>BootstrapDialog.alert('Password Changed. Please Login Again.')</script>";
|
|
//header("Location: index.php", true, 301);exit();
|
|
} else {
|
|
echo "<script>BootstrapDialog.alert('Password and Confirm Password must be same OR Password length is less than 8.')</script>";
|
|
$msg = "Password and Confirm Password must be same OR Password length is less than 8 .";
|
|
error_log("Failed to change the password.");
|
|
}
|
|
} else {
|
|
error_log("Passwords doesnt match.Current Password:".$POST['old_pass'].", DB OLD Password:". $row ['user_password']);
|
|
$msg = "Old Password didnt match";
|
|
echo "<script>BootstrapDialog.alert('Invalid Current Password. Please Try Again.')</script>";
|
|
|
|
}
|
|
//}
|
|
}
|
|
?>
|
|
|
|
<!-- Main Content Container for side bar and body-->
|
|
<style>
|
|
#message {
|
|
|
|
background: #f1f1f1;
|
|
color: #000;
|
|
|
|
display: table;
|
|
margin-right: auto;
|
|
margin-left: 500px;
|
|
|
|
}
|
|
|
|
#message p {
|
|
padding:2px;
|
|
font-size: 12px;
|
|
}
|
|
|
|
</style>
|
|
<div class="main-container ace-save-state" id="main-container">
|
|
<script type="text/javascript">
|
|
try{ace.settings.loadState('main-container')}catch(e){}
|
|
</script>
|
|
<?php include('techsyn_sidebar.php'); ?>
|
|
|
|
<!--breadcrumb-->
|
|
<div class="main-content">
|
|
<div class="main-content-inner">
|
|
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
|
|
<ul class="breadcrumb">
|
|
|
|
<li class="active">Patient Visit</li>
|
|
<li class="active">Employees</li>
|
|
</ul>
|
|
</div>
|
|
<!-- End of breadcrumb -->
|
|
|
|
<div class="page-content">
|
|
<div id="flexigridDiv" class="well-sm table-responsive"
|
|
style="margin-right: 5px; margin-left: 5px; height: auto; width: 100%">
|
|
<form name="f1" id="f1" method="post" action="<?php echo $this_script?>">
|
|
<table width="100%" border="0" cellspacing="0" cellpadding="4"
|
|
class="table table-bordered">
|
|
<tr>
|
|
<td colspan="2" align="center" class="bg2"> <span
|
|
class="txt">
|
|
<?php
|
|
if ($msg)
|
|
echo $msg;
|
|
?>
|
|
</span></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="40%" align="right" class="bg3">Old Password:</td>
|
|
|
|
<td align="left" class="bdr_td"><input type="password"
|
|
name="old_pass" id="old_pass" class="form-control" maxlength="45" ></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="right" class="bg3">New Password:</td>
|
|
|
|
<td align="left" class="bdr_td"><input type="password"
|
|
name="new_pass" id="new_pass" class="form-control" maxlength="45"
|
|
onkeypress="return AvoidSpace(event)"></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="right" class="bg3">Confirm Password:</td>
|
|
|
|
<td align="left" class="bdr_td"><input type="password"
|
|
name="conf_pass" id="conf_pass" class="form-control" maxlength="45"></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="right" class="bg3"><input type="hidden" name="hid"
|
|
value="1"></td>
|
|
<td align="left" class="bdr_td"><input type="button"
|
|
name="frmacn" id="btnUpdate" value="Update">
|
|
<!--<input type="submit" name="frmacn" id="btnUpdate"value="Update" onclick="document.forms[0].hid.value=1">-->
|
|
|
|
</td>
|
|
</tr>
|
|
|
|
</table>
|
|
<div id="message">
|
|
<h3 style="font-size: 15px">Password must contain the following:</h3>
|
|
<p> A <b>lowercase</b> letter</p>
|
|
<p> A <b>capital (uppercase)</b> letter</p>
|
|
<p>A <b>special character</b></p>
|
|
<p>A <b>number</b></p>
|
|
<p>Minimum <b>8 characters</b> and Maximum <b>20 characters</b></p>
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
<!-- /.page-content -->
|
|
</div>
|
|
</div>
|
|
<!-- /.main-content -->
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){
|
|
$("#flexigridDiv").click();
|
|
|
|
});
|
|
|
|
$(function () {
|
|
|
|
$("#btnUpdate").click(function () {
|
|
var password = $("#new_pass").val();
|
|
var regularExpression=/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,20}$/;
|
|
if(regularExpression.test(password)==false)
|
|
{
|
|
BootstrapDialog.alert('Enter a valid password!!!');
|
|
return false;
|
|
}
|
|
// if (password.length < 8) {
|
|
// BootstrapDialog.alert("Password should contain atleast 8 character");
|
|
// return false;
|
|
// }
|
|
|
|
// var regularExpression = /^[a-zA-Z0-9]$/;
|
|
|
|
// if (regularExpression.test(password)) {
|
|
// BootstrapDialog.alert("Password should contain atleast one number and one special character");
|
|
// return false;
|
|
// }
|
|
|
|
var confirmPassword = $("#conf_pass").val();
|
|
|
|
if (password != confirmPassword) {
|
|
BootstrapDialog.alert("Password and the confirm password must match.");
|
|
return false;
|
|
}
|
|
$("#f1").method="post";
|
|
$("#f1").submit();
|
|
|
|
});
|
|
});
|
|
|
|
function AvoidSpace(event) {
|
|
var k = event ? event.which : window.event.keyCode;
|
|
if (k == 32){
|
|
alert("Spaces are not allowed in password")
|
|
return false;
|
|
}
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
</script>
|
|
|
|
<?php include('techsyn_footer.php'); ?>
|