public static function mailer($route, $context = array(), $attachment = null) { return \Routerunner\Mail::mailer($route, $context, $attachment); }
$confirm = 'forgotten/' . implode('/', $user) . '/' . $secret; if (\Routerunner\Crypt::checker($confirm, $crypt_hash, $secret)) { //\Routerunner\Crypt::delete_crypt($crypt_hash, $confirm); $alphabet = "abcdefghijklmnpqrstuwxyzABCDEFGHIJKLMNPQRSTUWXYZ123456789"; $pwd = ""; for ($i = 0; $i < 8; $i++) { $n = rand(0, strlen($alphabet) - 1); $pwd .= substr($alphabet, $n, 1); } $user['pwd'] = $pwd; $input = $user["email"] . ";" . $pwd; $unique_salt = "4pp3t1z3r"; $unique_logarithm = "09"; $unique_method = "CRYPT_BLOWFISH"; $pwd_to_store = \Routerunner\Crypt::crypter($input, null, null, 0, $unique_salt, $unique_logarithm, $unique_method); if (\Routerunner\Mail::mailer('/mail/newpwd', $user)) { $SQL = 'UPDATE member SET pwd = :pwd WHERE id = :id AND email = :email'; $params = array(':pwd' => $pwd_to_store, ':id' => $user['id'], ':email' => $user['email']); \db::query($SQL, $params); $isOk = true; } } } } } if ($isOk) { \runner::now("newpwd", "succeed"); } else { \runner::now("newpwd", "error"); } }