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

<link href="../css/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<script language="JavaScript" src="../jscript/cancel_confirmation.js"  type="text/javascript"></script> 
<script type="text/javascript">
        function removeWhitespaces() {
            var txtbox = document.getElementById('user_password_text');
            txtbox.value = txtbox.value.replace(/\s/g, "");
        }
</script>
    
<?php
include('../include/session.php');

$table_name = "man_users";
$select_query = "SELECT userid, username FROM $table_name WHERE username <> 'system_manager' ";
	$arrId = array ();
	$arrName = array ();
	$select_result = execsql($select_query);
	$select_num = mysql_num_rows($select_result);
	$a = 0;
	while ($a < $select_num) {
		$arrId[$a] = mysql_result($select_result, $a, "userid");
		$arrName[$a] = mysql_result($select_result, $a, "username");
		$a++;
	}

?>

</head>


<body>
<?php
include ("../navigation/header.php");
$page_name = "AD-reset password";
include ("../navigation/access.php");
if ($permission_num==1) {
	include ("../navigation/admin_sidebar.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">Reset password</label></td>
        <td align="right">&nbsp;</td>
      </tr>
    </table>
  </div>
  
  <div class="page_middle_frame">
  <div class="page_inside_frame">
    <form id="form1" name="form1" method="post" action="save_reset_password.php">
      <label class="label_std">Select a user to reset password for &nbsp;&nbsp;&nbsp;&nbsp;</label>
      <select name="user_select" class="select_light">
        <option value=""></option>
        <?php
        	for ($i = 0; $i < count($arrId); $i++) {
    		echo "<option value=" . "\"" . $arrId[$i] . "\"" . ">" . $arrName[$i] . "</option>";
	   ?>
       
       <?php }
?>
      </select>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <label class="label_std"><br />
        
        <br />
        Enter new password here:</label>
      <br />
      <table width="300" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="127" height="40"><label class="label_std">password:</label>
            <br /></td>
          <td width="173"><input type="password" name="user_password_text" id="user_password_text" onkeyup="nospaces(this); ToLower(this)"/></td>
        </tr>
        <tr>
          <td height="40"><label class="label_std">confirm password:</label>
            &nbsp;<br /></td>
          <td><input type="password" name="user_password_text2" id="user_password_text2" onkeyup="nospaces(this); ToLower(this)"/> </td>
        </tr>
        <tr>
          <td colspan="2" align="center"><br />
            <br />
            <input name="button" type="submit" class="imagebutton" id="button" value="Change password" onclick="needToConfirm = false; "/>
            &nbsp;&nbsp;&nbsp;
<input name="button2" type="reset" class="imagebutton" id="button2" value="Cancel"  onClick="cancel_confirmation(3, '../admin_module/user_list.php');"/></td>
        </tr>
      </table>
    </form>
    <script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("user_select","req","Please select user.");
  frmvalidator.addValidation("user_password_text","req","Please enter a password.");
  frmvalidator.addValidation("user_password_text2","req","Please re-type the 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","The confirmed password is not same as password");
  
  </script>
  </div>
  </div>
</div>


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

<?php } else {
    $_SESSION['denied_return'] = "admin_module/user_list.php";	
    include ("../navigation/admin_sidebar.php");?>
	<body onLoad="accessdenied(); return false">	
	</body>
<?php }
?>
</body>
</html>