User '$username' was not found in the database.
";
return -1;
}
if (strlen($cuser[4]) < 5) {
echo "User '$username' doesn't have an email. Impossible to generate password.
";
return -1;
}
if (strcasecmp($cuser[4], $email) != 0) {
echo "
Incorrect email '$email' for user '$username'.
";
return -1;
}
if (CheckFlags("M", $cuser[3])) {
echo "
System Administrators know their passwords.
\n";
return -2;
}
/*
if (CheckFlags("m", $cuser[3])) {
echo "
Chat Masters cannot use this. Contact Tino Didriksen instead.
\n";
return -2;
}
*/
$result = @mysql_query("UPDATE uo_chat_database SET password='".md5($newp)."' WHERE chat='$chatpath' AND username='$username'", $handler);
$username = ucwords($username);
if ($_SERVER['HTTP_HOST']) {
$cpath = "http://".$_SERVER['HTTP_HOST'].ereg_replace("(.*)/common/password.php", "\\1", $_SERVER['PHP_SELF']);
} else {
$cpath = "http://".$_SERVER['SERVER_NAME'].ereg_replace("(.*)/common/password.php", "\\1", $_SERVER['PHP_SELF']);
}
$subject = ucwords($chat).": New password for '$username'";
$message = "New password generated for '$username'\n\n";
$message .= "Chat: $cpath/$chat/\n";
$message .= "Time: ".date("g:ia, F d (T)", time(0))." (".time(0).")\n";
$message .= "Username: $username\n";
$message .= "New password: $newp\n\n";
$message .= "Password is case-sensitive.\n";
$message .= "Keep this email.\n\n";
$message .= "-- Project JJ Automated Services\n";
mail("$username <$email>", $subject, $message, "From: $master_name <$master_email>\nReply-To: $master_name <$master_email>\nBcc: $master_name <$master_email>\nX-pJJ-IP: {$_SERVER['REMOTE_ADDR']}\nX-pJJ-Chat: http://pjj.cc/{$chat}/\nX-pJJ-Auth: {$username}\n");
$fc = fopen("../$chat/register/wizard_locked/actionlog.log", "a");
fwrite($fc, stripslashes(date("F d, Y T - H:i:s").": New password generated for user '$username' - $ip\n"));
fclose($fc);
echo "
New password generated for user '$username', and emailed to $email.
\n";
return 1;
}
if ($_REQUEST['chat'] == "") {
echo "
You must do this from a chat.
";
} else if (($_REQUEST['username'] == "") || ($_REQUEST['email'] == "") || ($_REQUEST['hidden'] == "")) {
echo "
";
} else {
NewPass($_REQUEST['chat'], $_REQUEST['username'], $_REQUEST['email'], $_SERVER['REMOTE_ADDR']);
}
echo "
\n";
?>