<?
/*
//||||||||||||||||||||||||||||||||||||||||||||||||\\
\\*          SUPER HERO MOD WEB STATS 3.0         //
//                                                \\
\\  Written By ShadowLeader aka 123 (Tim Hansen)  //
//                                                \\
\\              http://SH-MOD.TK                  //
//          Email: shadowleader@jubii.dk          \\
\\          MSN: shadowleader11@hotmail.com       //
//                                                \\
\\   You are allowed to edit anything in these    //
//     files, as long as these lines remain.      \\
\\                                                //
//   If you have any trouble with the system,     \\
\\       go to www.SH-MOD.TK to get help.         //
//                                                \\
\\   Thanks to:                                   //
//   AlleyKat - Help with Template system         \\
\\   MajesticM00se - A little code                //
//   Vittu - Finding bugs                         \\
\\||||||||||||||||||||||||||||||||||||||||||||||||//
*/

require "include/header.php";

dbconn(true);

stdhead("Change username/password");
/////////START/////////
?>
<?
// Reset Lost Password ACTION
if ($thestring OR $CURUSER['class'] >= UC_ADMINISTRATOR){

if ($HTTP_SERVER_VARS["REQUEST_METHOD"] == "POST")
{
 $username = trim($_POST["username"]);
   $res = mysql_query("SELECT * FROM users WHERE username=" . sqlesc($username) . " ") or sqlerr();
$arr = mysql_fetch_assoc($res);


$id = $arr['id'];
$wantpassword="resetthisnow";
$secret = mksecret();
$wantpasshash = md5($secret . $wantpassword . $secret);
mysql_query("UPDATE users SET passhash ='$wantpasshash' where id=$id");
mysql_query("UPDATE users SET secret = '$secret' where id=$id");
write_log("Password Reset For $username by $CURUSER[username]");
 if (mysql_affected_rows() != 1)
   stderr("Error", "Unable to RESET PASSWORD on this account.");
 stderr("Success", "The account <b>$username</b> Password Reset To resetthisnow please inform User of this change.");

}

?>

<form method=post action=resetpassword.php>
<table width=100%>
    <tr>
      <td width="20%" align=left>Current Username:</td>
      <td width=80% align=left valign=top><input size=40 name=username class=input></td>
    </tr>
    <tr>
      <td align=left colspan="2"><input type=submit class=input value='Next ->'></td>
    </tr>
  </table>
</form>
<?
}else{
echo"You do not have access to this page.";
}
?>
<?
/////////END/////////
stdfoot();
?>