<?
###################################################
#Copyright (C) 2001 Stuart Wigley (hide@address.com)
#
#resetpwd.php 16/10/2001
#
#This file is part of workbench.
#
#workbench is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#workbench is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with workbench; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#####################################################
session_start();
require_once("../config.php");
#if user has logged in get $login from session
if (($HTTP_SESSION_VARS["group"] == "1") && session_is_registered("login")){
$login = $HTTP_SESSION_VARS["login"];
require_once("$path/connect.php");
require_once("$path/general.php");
if ($HTTP_POST_VARS["theUser"] && $HTTP_POST_VARS["password2"] && $HTTP_POST_VARS["password3"]){
if ($HTTP_POST_VARS["password2"] != $HTTP_POST_VARS["password3"]){
$theError = "<li>You didn't enter the same new password in both fields.</li>";
}
if (!$theError){
$thePassword = md5($HTTP_POST_VARS["password2"]);
mysql_query("update users set password='$thePassword' where login='".$HTTP_POST_VARS["theUser"]."'") or die (mysql_error());
#header("Location: $relative/admin/resetpwd.php");
#exit;
}
}
include("$path/header.php");
?>
<form method="post" action="resetpwd.php" name="resetpwd" onSubmit="return validateForm('resetpwd')">
<table cellspacing="0" class="table3">
<tr class="rowtitle">
<td colspan="2"><h5>Reset Password</h5></td>
</tr>
<tr>
<td colspan="2"><p>This Administration tool allows you to reset the password of any user.</p></td>
</tr>
<tr>
<td colspan="2"><hr></td>
</tr>
<tr>
<td>User</td>
<td>
<select name="theUser">
<option value="Choose">Choose
<?
$query = mysql_query("select * from users where isHidden != 'Y' order by sName") or die(mysql_error());
while ($result = mysql_fetch_array($query)){
echo("<option value=\"$result[login]\">$result[sName], $result[fName]");
}
?>
</select>
</td>
</tr>
<tr>
<td>New Password</td>
<td><input type="password" name="password2" size="20" maxlength="50"></td>
</tr>
<tr>
<td>Confirm Password</td>
<td><input type="password" name="password3" size="20" maxlength="50"></td>
</tr>
<tr>
<td class="center" colspan="2"><input type="Submit" value="Submit" onfocus="this.blur()"><input type="Reset" value="Reset" onfocus="this.blur()"></td>
</tr>
<?
if ($theError){
echo("<tr><td colspan=\"2\"><h5>$theError<h5></td></tr>");
}
?>
</table>
</form>
<?
include("$path/footer.php");
}
else{
include("$path/login.php");
#exit;
}
?>