Existing members

prepare($query); $STMT->execute(); if ($STMT->rowCount() > 0) { if ($row = $STMT->fetch(PDO::FETCH_ASSOC)) { function generatePassword($length = 9, $strength = 4) { $vowels = 'aeuy'; $consonants = 'bdghjmnpqrstvz'; if ($strength & 1) { $consonants .= 'BDGHJLMNPQRSTVWXZ'; } if ($strength & 2) { $vowels .= "AEUY"; } if ($strength & 4) { $consonants .= '23456789'; } if ($strength & 8) { $consonants .= '@#$%'; } $password = ''; $alt = time() % 2; for ($i = 0; $i < $length; $i++) { if ($alt == 1) { $password .= $consonants[(rand() % strlen($consonants))]; $alt = 0; } else { $password .= $vowels[(rand() % strlen($vowels))]; $alt = 1; } } return $password; } $pass = generatePassword(); $passhash = md5($pass); $updquery = "UPDATE `users` SET `password` = '$passhash', `mustchange` = '1' WHERE `id` = '{$row['id']}' LIMIT 1;"; $STMT = $DBH->prepare($updquery); $STMT->execute(); include("includes/emails/forgottenpass.php"); sentmail( $_POST['username'], "Berkshire Scouts Forgotten Password", $message, "From: Berkshire Scouts Web Team \n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1" ); header("Location: login.php?msg=Please check your email for a new, temporary login."); die(); } } else { $error = 1; } } include("forgotten_password.tpl"); ?> No user found with username {$_POST['username']}

"; } ?>