89 $loadedValues[
'lnapphbuser'] = Array();
90 HCU_ImportVars($loadedValues,
"lnapphbuser", array(
"acct" => HCUFILTER_INPUT_STRING,
"applogin" => HCUFILTER_INPUT_STRING,
"hbusername" => HCUFILTER_INPUT_STRING,
"chksecure" => HCUFILTER_INPUT_STRING));
94 $banking_user_id = -1;
100 if (hcu_array_key_exists(
'applogin', $loadedValues[
'lnapphbuser']) || ($hbuser_cookie_user && $DMSAPP_CURRENTUSERID > 0) || $form_code ==
'hbssouser') {
104 if (trim(hcu_array_key_value(
'hbusername', $loadedValues[
'lnapphbuser'])) !=
'' || $DMSAPP_CURRENTUSERID > 0 || $form_code ==
'hbssouser') {
106 if (trim(hcu_array_key_value(
'hbusername', $loadedValues[
'lnapphbuser'])) !=
'' && FALSE) {
108 if (preg_match(
"/\D/", hcu_array_key_value(
'hbusername', $loadedValues[
'lnapphbuser']))) {
110 $userQueryField =
"user_alias ilike '" . save_text(hcu_array_key_value(
'hbusername', $loadedValues[
'lnapphbuser']), 50) .
"' ";
113 $userQueryField =
"user_name = '" . save_text(hcu_array_key_value(
'hbusername', $loadedValues[
'lnapphbuser']), 12) .
"' AND rtrim(coalesce(user_alias, '')) = '' ";
117 $sql =
"SELECT cu, user_name, email, failedremain, passwd, confidence, 120 WHERE cu = '$DMSAPP_CURRENTCUCODE' 121 AND {$userQueryField} ";
123 } elseif ($form_code ==
'hbssouser') {
139 $mbrStatus = Check_Member_Credentials($HB_ENV, HCU_array_key_value(
"Ticket", $_COOKIE));
150 if (!$mbrStatus[
'result']) {
152 header(
"Location: {$self}status=10");
156 $banking_user_id = intval($HB_ENV[
'Uid']);
161 $sql =
"SELECT user_id, group_id, user_name, email, failedremain, passwd, confidence 162 FROM {$DMSAPP_CURRENTCUCODE}user 163 WHERE user_id = {$banking_user_id}; ";
167 if (isset($loadedValues[
'lnapphbuser'][
'acct'])) {
168 $setUserAcct = hcu_decrypturl($loadedValues[
'lnapphbuser'][
'acct'], $HB_ENV[
'historyHash']);
196 $hb_rs = db_query($sql, $dbh);
197 $hb_row = db_fetch_assoc($hb_rs);
212 FROM {$DB_TABLE_PREFIX}user 213 WHERE cu = '$DMSAPP_CURRENTCUCODE' 214 AND userlogintype in ('H', 'N') 215 AND banking_user_id = {$banking_user_id};";
217 $user_rs = db_query($sql, $dbh);
221 if (!VerifyUserAccountAccessForLoan($HB_ENV, $banking_user_id, $setUserAcct)) {
225 if ($user_row = db_fetch_assoc($user_rs)) {
233 if (intval($user_row[
'failedloginattempts']) >= $DMSAPP_FAILEDLOGINATTEMPTS) {
234 if (intval($select_questid) == 0) {
235 header(
"Location: {$self}f=intro&status=8");
244 $sql =
"UPDATE {$DB_TABLE_PREFIX}user 246 email = '" . save_text($hb_row[
'email'], 50) .
"', 248 confidenceword = '" . save_text($hb_row[
'confidence'], 30) .
"', 249 session_account = '" . save_text($setUserAcct, 12) .
"' 250 WHERE userid = " . intval($user_row[
'userid']);
252 if (!$exec_rs = db_query($sql, $dbh)) {
255 header(
"Location: {$self}status=999");
260 $sql =
"INSERT INTO {$DB_TABLE_PREFIX}user 261 (email, cu, failedloginattempts, challenge_quest_id, userlogintype, banking_user_id, confidenceword, session_account) 263 ('" . save_text($hb_row[
'email'], 50) .
"', '$DMSAPP_CURRENTCUCODE', 0, -1, 264 'H', {$banking_user_id}, 265 '" . save_text($hb_row[
'confidence'], 30) .
"', 266 '" . save_text($setUserAcct, 12) .
"');";
268 if (!$exec_rs = db_query($sql, $dbh)) {
271 header(
"Location: {$self}status=999");
276 FROM {$DB_TABLE_PREFIX}user 277 WHERE cu = '$DMSAPP_CURRENTCUCODE' 278 AND userlogintype = 'H' 279 AND banking_user_id = {$banking_user_id}; ";
280 $user_rs = db_query($sql, $dbh);
282 if (!$user_row = db_fetch_assoc($user_rs)) {
284 header(
"Location: {$self}status=999");
294 $l_device_cookie_name = ReturnDeviceCookieName($DMSAPP_CURRENTCUCODE, DMSAPP_CONST_HB_LOGIN, trim($hb_row[
'email']), $user_row[
'userid']);
295 $l_CookieVal = sha1($DMSAPP_SECRET_KEY . trim($user_row[
'pwd']) . trim($hb_row[
'email']) . trim($hb_row[
'confidence']) . trim($hb_row[
'user_id']));
297 if ($form_code !=
'hbssouser') {
298 if ($l_CookieVal == $_COOKIE[$l_device_cookie_name]) {
300 $FORM_SHOW =
"passwd";
303 $FORM_SHOW =
"challenge";
306 if ($user_row[
'challenge_quest_id'] > 0) {
307 $select_questid = $user_row[
'challenge_quest_id'];
314 FROM cuquestselect as u_qs 315 JOIN {$DB_TABLE_PREFIX}user as u on u.cu = u_qs.cu AND u.user_name = u_qs.accountnumber 316 WHERE u.userid = " . intval($user_row[
'userid']) .
" 317 ORDER BY RANDOM() LIMIT 1";
319 $qst_rs = db_query($sql, $dbh);
320 $qst_row = db_fetch_array($qst_rs);
322 $select_questid = $qst_row[
'quest_id'];
324 $sql =
"UPDATE {$DB_TABLE_PREFIX}user 325 SET challenge_quest_id = " . intval($select_questid) .
" 326 WHERE userid = " . intval($user_row[
'userid']);
328 if (!$upd_rs = db_query($sql, $dbh)) {
331 header(
"Location: {$self}f=intro&status=999");
335 if (intval($select_questid) == 0) {
336 header(
"Location: {$self}f=intro&status=7");
348 $sql =
"UPDATE {$DB_TABLE_PREFIX}user 349 SET failedloginattempts = 0 350 WHERE userid = " . intval($user_row[
'userid']) .
" ";
351 $exec_rs = db_query($sql, $dbh);
354 $pSessionCookie = hcu_array_key_value(
'chksecure', $loadedValues[
'lnapphbuser']) !=
"Y";
355 SetLnappDeviceCookie($HB_ENV, $l_device_cookie_name, $l_CookieVal, $pSessionCookie);
358 DMSAppSetCookie($HB_ENV, $user_row[
'userid'], DMSAPP_CONST_HB_LOGIN);
361 $showHBMessage = ( $user_row[
"userlogintype"] ==
"N" ) ?
"&msg=You are now configured as a Home Banking user so use your Home Banking credentials when logging into the Loan App system in the future." :
"";
362 header(
"Location: {$self}f=portal$showHBMessage");
369 header(
"Location: {$self}status=4&o=1");
374 header(
"Location: {$self}status=4&o=2");
377 } elseif (isset($_POST[
'hbconfchallenge'])) {
389 if (preg_match(
"/\D/", hcu_array_key_value(
'hbusername', $loadedValues[
'lnapphbuser']))) {
393 $sql =
"SELECT cu, user_name, email, failedremain, passwd, confidence, 396 WHERE cu = '$DMSAPP_CURRENTCUCODE' 397 AND user_alias ilike '" . save_text(hcu_array_key_value(
'hbusername', $loadedValues[
'lnapphbuser']), 50) .
"' ";
399 $hb_rs = db_query($sql, $dbh);
400 $hb_row = db_fetch_assoc($hb_rs);
404 $postUsername = $hb_row[
'user_name'];
410 $postUsername = hcu_array_key_value(
'hbusername', $loadedValues[
'lnapphbuser']);
420 FROM {$DB_TABLE_PREFIX}user 421 WHERE cu = '{$DMSAPP_CURRENTCUCODE}' 422 AND userlogintype = 'H' 423 AND user_name = '" . save_text($postUsername, $dbFieldLen) .
"' ";
424 $user_rs = db_query($sql, $dbh);
426 if ($user_row = db_fetch_assoc($user_rs)) {
431 WHERE cu = '{$DMSAPP_CURRENTCUCODE}' 432 AND accountnumber = '" . save_text($postUsername, $dbFieldLen) .
"' 433 AND quest_id = " . intval($user_row[
'challenge_quest_id']) .
" ";
435 $qst_rs = db_query($sql, $dbh);
436 $qst_row = db_fetch_assoc($qst_rs);
439 if (strtolower(trim($_POST[
'chg_resp'])) == strtolower(trim($qst_row[
'answer'])) && strtolower(trim($qst_row[
'answer'])) !=
'') {
443 $sql =
"UPDATE {$DB_TABLE_PREFIX}user 444 SET challenge_quest_id = -1 445 WHERE userid = " . intval($user_row[
'userid']) .
" ";
446 $exec_rs = db_query($sql, $dbh);
450 $user_device_cookiename = ReturnDeviceCookieName($DMSAPP_CURRENTCUCODE, DMSAPP_CONST_HB_LOGIN, trim($user_row[
'email']), $user_row[
'userid']);
451 $setCookieVal = sha1($DMSAPP_SECRET_KEY . trim($user_row[
'pwd']) . trim($user_row[
'email']) . trim($user_row[
'confidenceword']) . trim($user_row[
'user_id']));
453 $pSessionCookie = $_POST[
"chksecure"] !=
"Y";
455 SetLnappDeviceCookie($HB_ENV, $user_device_cookiename, $setCookieVal, $pSessionCookie);
458 $FORM_SHOW =
"passwd";
461 $sql =
"UPDATE {$DB_TABLE_PREFIX}user 462 SET failedloginattempts = failedloginattempts + 1 464 cu = '{$DMSAPP_CURRENTCUCODE}' 465 AND userlogintype = '" . DMSAPP_CONST_HB_LOGIN .
"' 466 AND user_name = '" . save_text($postUsername, $dbFieldLen) .
"' ";
468 if (!$exec_rs = db_query($sql, $dbh)) {
470 header(
"Location: {$self}status=999");
474 header(
"Location: {$self}status=5");
480 header(
"Location: {$self}status=999");
483 } elseif (isset($_POST[
'hbconfpassword'])) {
485 if (preg_match(
"/\D/", hcu_array_key_value(
'hbusername', $loadedValues[
'lnapphbuser']))) {
487 $userQueryField =
"user_alias ilike '" . save_text(hcu_array_key_value(
'hbusername', $loadedValues[
'lnapphbuser']), 50) .
"' ";
489 $userQueryField =
"user_name = '" . save_text(hcu_array_key_value(
'hbusername', $loadedValues[
'lnapphbuser']), 12) .
"' ";
493 $sql =
"SELECT cu, user_name, email, failedremain, passwd, confidence 495 WHERE cu = '$DMSAPP_CURRENTCUCODE' 496 AND {$userQueryField} ";
498 $hb_rs = db_query($sql, $dbh);
499 $hb_row = db_fetch_assoc($hb_rs);
503 $password = trim($_POST[
'hbloginpassword']);
504 $savepass = $hb_row[
'passwd'];
506 if ($savepass == crypt($password, $savepass)) {
511 FROM {$DB_TABLE_PREFIX}user 512 WHERE cu = '{$DMSAPP_CURRENTCUCODE}' 513 AND userlogintype = '" . DMSAPP_CONST_HB_LOGIN .
"' 514 AND user_name = '" . save_text($hb_row[
'user_name'], 12) .
"' ";
515 $user_rs = db_query($sql, $dbh);
516 if ($user_row = db_fetch_assoc($user_rs)) {
519 $sql =
"UPDATE {$DB_TABLE_PREFIX}user 520 SET failedloginattempts = 0 521 WHERE userid = " . intval($user_row[
'userid']) .
" ";
522 $exec_rs = db_query($sql, $dbh);
525 DMSAppSetCookie($HB_ENV, $user_row[
'userid'], DMSAPP_CONST_HB_LOGIN);
527 header(
"Location: {$self}f=portal");
532 header(
"Location: {$self}status=4&o=3");
539 $sql =
"UPDATE {$DB_TABLE_PREFIX}user 540 SET failedloginattempts = failedloginattempts + 1 542 cu = '{$DMSAPP_CURRENTCUCODE}' 543 AND userlogintype = '" . DMSAPP_CONST_HB_LOGIN .
"' 544 AND user_name = '" . save_text($hb_row[
'user_name'], 12) .
"' ";
546 if (!$exec_rs = db_query($sql, $dbh)) {
548 header(
"Location: {$self}status=999");
552 header(
"Location: {$self}status=6");
556 header(
"Location: {$self}status=4&o=4");
561 if (hcu_array_key_exists(
'hbusername', $loadedValues[
'lnapphbuser'])) {
562 $form_hbuser = disp_text(hcu_array_key_value(
'hbusername', $loadedValues[
'lnapphbuser']));
563 } elseif (isset($hb_row)) {
568 $form_hbuser = disp_text(($hb_row[
'user_alias'] !=
'' ? $hb_row[
'user_alias'] : $hb_row[
'user_name']));
578 WHERE quest_lang = 'en_US' 579 AND quest_id = " . intval($select_questid) .
"; ";
580 $quest_rs = db_query($sql, $dbh);
581 $quest_row = db_fetch_assoc($quest_rs);
584 $challenge_quest_text = trim($quest_row[
'quest_text']);
586 print <<< challenge_form
587 <div
id=
"summary-container" class=
"validity-summary-container errors" >
588 <p><em>You may not
continue. the following errors were encountered:</em></p>
590 $FORM_VALIDATION_ERROR
593 <script language=
'javascript'>
596 window.alert(
'Public computers are found at libraries, schools, Internet cafes, airports, and many other places. You have no control over who uses public computers. Public computers may be running malicious software like keystroke loggers or be on networks that allow others to get your personal information. We strongly suggest you do NOT use a public computer for home banking. If you decide to use one anyway, you should check the box so we do not save a security token to this public computer.');
600 <form
id=
"app_settings" name=
"app_settings" action=
"{$self}f=hbuser" method=
"post">
601 <input type=
"hidden" name=
"form_set" value=
"$form_code">
602 <input type=
"hidden" name=
"loginemail" value=
"$l_email">
606 We
do not recognize the device you are
using.<br>
607 Please confirm your identity.<br>Please answer the question below to confirm
611 <div
class=
"expandedform">
612 <fieldset
class=
'clearfix'>
613 <legend>Challenge Question</legend>
614 <div
class=
'row'><label
class=
'wide' for=
"chg_resp">$challenge_quest_text</label>
615 <input
id=
"chg_resp" name=
"chg_resp" type=
"text" size=
"30" maxlength=
"100" class=
"text-input"/></div>
617 <div
class=
'row'><label
for=
'chksecureY'>This is my Personal or Business Computer<br> (Save security token on
this computer)</label>
618 <input type=
'radio' id=
'chksecureY' name=
'chksecure' value=
'Y' checked/></div>
619 <div
class=
'row'><label
for=
'chksecureN'>This is a <a onClick=
'whatpub();'>Public Computer</a><br> (DO NOT Save security token on
this computer)</label>
620 <input type=
'radio' id=
'chksecureN' name=
'chksecure' value=
'N' /></div>
623 <label
class=
"submit">
624 <input type=
"hidden" name=
"hbconfchallenge" value=
"Confirm Answer">
625 <input type=
"hidden" name=
"hbusername" value=
"$form_hbuser">
626 <a
class=
"ovalbutton_blue navleft" href=
"#" style=
"margin-left: 6px" id=
'linkFormPost' label=
'Submit'><span>Confirm Answer</span></a>
631 <script type=
"text/javascript">
632 $(document).ready(
function() {
634 \$(
'#app_settings').bind(
"keydown",
function(event) {
636 var keycode = (
event.keyCode ?
event.keyCode : (
event.which ?
event.which :
event.charCode));
639 \$(
'#app_settings').submit();
646 \$(
'#linkFormPost').click(
function() {
647 \$(
"#app_settings").submit();
649 $(
'#chg_resp').focus();
661 $print_confword =
"<label class='wide' for='chg_resp'>Confidence Word:</label><span class='bold'>" . disp_text($user_row[
'confidenceword']) .
"</span></div>";
662 print <<< password_form
663 <div
id=
"summary-container" class=
"validity-summary-container errors" >
664 <p><em>You may not
continue. the following errors were encountered:</em></p>
666 $FORM_VALIDATION_ERROR
669 <form
id=
"app_settings" name=
"app_settings" action=
"{$self}f=hbuser" method=
"post">
670 <input type=
"hidden" name=
"form_set" value=
"$form_code">
671 <input type=
"hidden" name=
"loginemail" value=
"$l_email">
675 <div
class=
"expandedform">
676 <fieldset
class=
'clearfix'>
677 <legend>Enter Password</legend>
678 <div
class=
'row'>$print_confword
679 <label
class=
'wide' for=
"hbloginpassword">Password:</label>
680 <input
id=
"hbloginpassword" name=
"hbloginpassword" type=
"password" size=
"10" maxlength=
"15" class=
"text-input"/></div>
683 <label
class=
"submit">
684 <input type=
"hidden" name=
"hbconfpassword" value=
"Login">
685 <input type=
"hidden" name=
"hbusername" value=
"$form_hbuser">
686 <a
class=
"ovalbutton_blue navleft" href=
"#" style=
"margin-left: 6px" id=
'linkFormPost' label=
'Submit'><span>Login</span></a>
690 <script type=
"text/javascript">
691 $(document).ready(
function() {
693 \$(
'#app_settings').bind(
"keydown",
function(event) {
695 var keycode = (
event.keyCode ?
event.keyCode : (
event.which ?
event.which :
event.charCode));
698 \$(
'#app_settings').submit();
705 \$(
'#linkFormPost').click(
function() {
706 \$(
"#app_settings").submit();
709 $(
'#hbloginpassword').focus();
715 if ($FORM_VALIDATION_ERROR !=
'') {
716 print
"<script language='javascript'>$('#summary-container').css('display', 'inline-block');</script>";