<?php

require "login/login.php";
include 'monitor.inc';
include 'alert_functions.inc';
$message = "\n--------------------------------------------\n";
$message .= "Test  alert for location: " . $status['id'] . "\n";
$message .= "In Queue:\n";
$message .= "Testers:\n";
$message .= "Timestamp:\n";
$message .= "\n--------------------------------------------\n";
$message .= "TEST -- Queue count continues to grow. Please provision more testers or decrease the runrate for this location.";
if (sendEmailAlert($_REQUEST['emailAddress'], $message)) {
    $_SESSION['ErrorMessagePopUp'] = "Email Alert successfully Sent.";
} else {
    $_SESSION['ErrorMessagePopUp'] = "Email Alert Failed.";
}
header("Location: listAlerts.php");
?>
 
<?php

include 'monitor.inc';
include 'alert_functions.inc';
$userName = $_REQUEST['userName'];
$userTable = Doctrine_Core::getTable('User');
$user = $userTable->findOneByUserName($userName);
if (!$user) {
    echo "Invalid user credentials";
    exit;
}
$tempPassword = generatePassword();
$emailAddress = $user['EmailAddress'];
if ($emailAddress = $_REQUEST['emailAddress']) {
    sendEmailAlert($emailAddress, "Your temporary password: "******"Invalid user credentials";
    exit;
}
$user['Password'] = sha1($tempPassword);
$user->save();
echo "Password reset. Please check your email for the temporary password";
exit;
function generatePassword($length = 9, $strength = 0)
{
    $vowels = 'aeuy';
    $consonants = 'bdghjmnpqrstvz';
    if ($strength & 1) {
        $consonants .= 'BDGHJLMNPQRSTVWXZ';
    }
    if ($strength & 2) {