

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!--style sheets-->
<link rel="stylesheet" href="../window/dhtmlwindow.css" type="text/css" />
<link rel="stylesheet" href="../window/modal.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../css/main.css" />
<!--jscript-->
<script language="JavaScript" src="../jscript/alert_message.js"  type="text/javascript"></script>
<script type="text/javascript" src="../jscript/jquery.1.4.2.js"></script>
<script type="text/javascript" src="../window/dhtmlwindow.js"></script>
<script type="text/javascript" src="../window/modal.js"></script>
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<script type="text/javascript">
function removeWhitespaces() {
            var txtbox = document.getElementById('old_password_text');
            txtbox.value = txtbox.value.replace(/\s/g, "");
			var txtbox2 = document.getElementById('user_password_text');
            txtbox2.value = txtbox2.value.replace(/\s/g, "");
			var txtbox3 = document.getElementById('user_password_text2');
            txtbox2.value = txtbox2.value.replace(/\s/g, "");
        }
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
</script>
<script language="JavaScript" src="../jscript/lower_case.js"  type="text/javascript"></script>

<?php
include('../include/session.php');
$page = $_GET['page'];
$m = $_GET['m'];
?>
</head>

<body onload="<?php if ($m==2) { ?>alertMessage(1, '', 'You failed changing your password.<br><br>You can try again or contact<br><br>the system manager to reset your password.'); <?php } ?> ;">

<?php
include ("../navigation/header.php");
include('../navigation/blank_sidebar.php');
//$username = $_GET['user_name'];



$table_name = "man_users";
$user_query = "SELECT username, userid, password FROM $table_name WHERE username ='".$_SESSION['username']."' ";
$user_result = mySQL_query($user_query);
$user_name = mysql_result($user_result, 0, "username");
$user_id = mysql_result($user_result, 0, "userid");
$password = mysql_result($user_result, 0, "password");

if ($page=='hr_main.php') {$page="../hr_module/hr_main.php?period=day";}
if ($page=='hire_main.php') {$page="../hire/hire_main.php?period=day";}
if ($page=='user_list.php') {$page="../admin_module/user_list.php";}
 
?>

<div class="main_frame">
  <div class="page_head_frame">
    <table width="809" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="385"><label class="label_page_head">Change password</label></td>
      </tr>
    </table>
</div>

  
<div class="page_middle_frame">
<?php if ($m!=1) { ?>
<div class="page_inside_frame">
<form action="save_change_password.php" method="GET" name="form1" target="_top" id="form1">
<table width="290" border="0" align="center" cellpadding="0" cellspacing="0" class="list2">
  <tr>
    <td width="290" align="center"><label class="label_std">Change password for user:<b> <?php echo $user_name ?></b></label>
          
      <table width="300" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="79"><label class="std">old password:</label>
            <input type="hidden" name="user_id" id="user_id"  value="<?php echo $user_id ?>"/>
            <input type="hidden" name="return_page" id="return_page" value="<?php echo $page ?>" /></td>
          <td><input type="password" name="old_password_text" id="old_password_text" onkeyup="removeWhitespaces(); ToLower(this)"/></td>
        </tr>
        <tr>
          <td width="127" height="40"><label class="std">new password:</label>
            <br /></td>
          <td width="173"><input type="password" name="user_password_text" id="user_password_text" onkeyup="removeWhitespaces(); ToLower(this)"/></td>
        </tr>
        <tr>
          <td height="40"><label class="std">confirm password:</label>
            &nbsp;<br /></td>
          <td><input type="password" name="user_password_text2" id="user_password_text2" onkeyup="removeWhitespaces(); ToLower(this)"/></td>
        </tr>
        <tr>
          <td height="19" colspan="2" align="center"></td>
        </tr>
      </table>
      </td>
  </tr>
  <tr>
    <td align="center"><br />
      <input name="input" type="submit" value="Change" class="imagebutton"  />
      <input name="Reset" type="reset" class="imagebutton" id="button" onclick="MM_goToURL('parent','../<?php echo $_SESSION['location']?>');return document.MM_returnValue"  value="Cancel" />
    
    </td>
  </tr>
</table>
</form>
</div>
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("old_password_text","req","- current password.");
  frmvalidator.addValidation("user_password_text","req","- a password.");
  frmvalidator.addValidation("user_password_text2","req","- confirm password.");
  frmvalidator.addValidation("user_password_text","minlen=6","- mininum length for a password is 6 characters.");
  frmvalidator.addValidation("user_password_text","eqelmnt=user_password_text2","- confirmed password is not same as password");
</script>
</div>
<?php }
else {
	?>
    <div class="page_inside_frame">
    <div class="lay_out_frame_small" style="border:hidden; font-size:18px; font-weight:bold;">
      <img src="../images/check_mark_green.png" width="32" height="32" />
      Your password was succesfully changed.
      </div>
       </div>
       </div>
    <?php
}
?>
</div>

<?php include ('../navigation/side_bar.php'); ?>
</body>
</html>