Odyssey
FlagEStmt.prg
1 <?php
2  /*
3  File: FlagEStmt
4  Purpose: Set estmt_flag for LIVE home banking members who have signed up
5  for estatements on a paper form at the CU. User record may or
6  may not exist. If it exists, update to set estmt_flag = 'Y'.
7  If it doesn't, insert a record with password 'NULL PASSWORD'
8  so auto-activation will still work.
9 
10  States of this form:
11  Enter Accounts: This will allow the entry of account numbers. Screen
12  will contain a large text box to accept space delimited account
13  numbers.
14  Save Settings: This will be the code to save the flag settings.
15 
16  *** Don't Forget about security for me...
17 
18  the main value for setting up the form is 'act' it's options are
19  'E' - Enter Accounts
20  'S' - Save Settings
21 
22 
23 **** NOTE FOR FUTURE CHANGES ***
24  06/13/2007 - future changes about this script were discussed. The following
25  list is the conclusion..
26  1. Modify this script so it may be used on our Batch CU's
27  2. To do this, we want to skip over inserting members that were NOT found
28  3. Also, change the message on the display screen so it does not state to
29  Batch CU's the member will be inserted if not found.
30  4. Be sure the script displays members that were NOT found and all other
31  messages are appropriate for Batch CU's
32  */
33 
34 require_once("dms_imp_val.i");
35 
36 $dms_ok=array('act'=>'string','accts'=>'string','save_msg'=>'string');
37 dms_import($dms_ok);
38 
39  $act = (isset($act) ? $act : "E");
40 
41  $save_msg = "";
42 
43  if ($act == "S") {
44  // SAVE OPTION
45 
46  // Replace common delimiter characters with a space,
47  // Separate each of the accounts into an array, then
48  // loop through the array and build the sql
49 
50  $sql="select coalesce(retrylimit,5), coalesce(gracelimit,5)
51  from cuadmin where cu='$Cu'";
52  $sth = db_query($sql,$dbh);
53  list($retry, $grace) = db_fetch_array($sth,0);
54  $retry = (($retry == 0 || trim($retry) == "") ? 5 : $retry);
55  $grace = (($grace == 0 || trim($grace) == "") ? 5 : $grace);
56 
57  $form_accts = array();
58  $delims=array("\r\n","\t",";",",");
59  $form_accts = explode(" ",str_replace($delims, " ", $accts));
60 
61  for ($idx = 0; $idx < count($form_accts); $idx++) {
62  $member = $form_accts[$idx];
63  if (strlen(trim($member)) > 0 && preg_match("/^\d\d*$/",$member) ) {
64  if ($Cl == 'L') {
65  $showtx = ", show_livetx('$Cu','$member') ";
66  } else {
67  $showtx = ", show_txacct('$Cu','$member') ";
68  }
69 
70  $rec_save = "Member $member updated";
71  $sql = "insert into cuauditusers
72  (chdate, admuser, action,
73  cu, user_name, user_alias, passwd, pktdate, pktstamp, email,
74  estmt_flag, egenl_flag, failedremain, forcechange,
75  forceremain, lastlogin, priorlogin, failedlogin,
76  pwchange, msg_tx, billpayid, employee, txlist,
77  depositlimit, userflags,challenge_quest_id)
78  select now(), '$Cn', 'EST_F',
79  cuusers.cu, cuusers.user_name, cuusers.user_alias,
80  cuusers.passwd,
81  cuusers.pktdate, cuusers.pktstamp, cuusers.email,
82  cuusers.estmt_flag, cuusers.egenl_flag,
83  cuusers.failedremain, cuusers.forcechange,
84  cuusers.forceremain, cuusers.lastlogin, cuusers.priorlogin,
85  cuusers.failedlogin, cuusers.pwchange, cuusers.msg_tx,
86  cuusers.billpayid, cuusers.employee $showtx,
87  cuusers.depositlimit, cuusers.userflags,
88  coalesce(cuusers.challenge_quest_id,0)
89 
90  from cuusers where cu='$Cu' and user_name = '$member';
91  update cuusers set estmt_flag='Y' where cu='$Cu'
92  and user_name='$member';";
93  $sql .= "insert into cuauditusers
94  (chdate, admuser, action,
95  cu, user_name, user_alias, passwd, pktdate, pktstamp, email,
96  estmt_flag, egenl_flag, failedremain, forcechange,
97  forceremain, lastlogin, priorlogin, failedlogin,
98  pwchange, msg_tx, billpayid, employee, txlist,
99  depositlimit,userflags,challenge_quest_id)
100  select now(), '$Cn', 'EST_T',
101  cuusers.cu, cuusers.user_name, cuusers.user_alias,
102  cuusers.passwd,
103  cuusers.pktdate, cuusers.pktstamp, cuusers.email,
104  cuusers.estmt_flag, cuusers.egenl_flag,
105  cuusers.failedremain, cuusers.forcechange,
106  cuusers.forceremain, cuusers.lastlogin, cuusers.priorlogin,
107  cuusers.failedlogin, cuusers.pwchange, cuusers.msg_tx,
108  cuusers.billpayid, cuusers.employee $showtx,
109  cuusers.depositlimit, cuusers.userflags,
110  coalesce(cuusers.challenge_quest_id,0)
111  from cuusers where cu='$Cu' and user_name = '$member'; ";
112  $sth = db_query($sql, $dbh);
113  if (!$sth) {
114  $rec_save = "Update Member $member FAILED";
115  } else {
116  if (db_affected_rows($sth) == 0) {
117  $rec_save = "Member $member inserted";
118  $sql="insert into cuusers (
119  cu, user_name, passwd, pktstamp, pktdate, forcechange,
120  forceremain, failedremain, pwchange, estmt_flag)
121  values ('$Cu','$member',
122  'NULL PASSWORD',1, '" . date("D M j Y H:i:s T") . "',
123  'Y',$grace, $retry, now(), 'Y');";
124  $sql .= "insert into cuauditusers
125  (chdate, admuser, action,
126  cu, user_name, user_alias, passwd, pktdate, pktstamp, email,
127  estmt_flag, egenl_flag, failedremain, forcechange,
128  forceremain, lastlogin, priorlogin, failedlogin,
129  pwchange, msg_tx, billpayid, employee, txlist,
130  depositlimit,userflags,challenge_quest_id)
131  select now(), '$Cn', 'EST_A',
132  cuusers.cu, cuusers.user_name, cuusers.user_alias,
133  cuusers.passwd,
134  cuusers.pktdate, cuusers.pktstamp, cuusers.email,
135  cuusers.estmt_flag, cuusers.egenl_flag,
136  cuusers.failedremain, cuusers.forcechange,
137  cuusers.forceremain, cuusers.lastlogin, cuusers.priorlogin,
138  cuusers.failedlogin, cuusers.pwchange, cuusers.msg_tx,
139  cuusers.billpayid, cuusers.employee $showtx,
140  cuusers.depositlimit, cuusers.userflags,
141  coalesce(cuusers.challenge_quest_id,0)
142  from cuusers where cu='$Cu' and user_name = '$member'; ";
143  $sth = db_query($sql,$dbh);
144  if (!$sth) {
145  $rec_save = "Insert Member $member FAILED";
146  }
147  }
148  }
149  $save_msg .= "$rec_save <br>\n";
150  } else {
151  $save_msg .= "Invalid member $member<br>\n";
152  }
153  }
154  }
155 ?>
156  <form action="/admbin/main.prg?ft=45" method="post">
157  <input type="hidden" name="act" value="S">
158  <br>
159  <div align="center">
160  <table width="100%" border=0 cellpadding=4 cellspacing=0>
161  <tr><td class="bar" colspan="3" align="center">Manual eStatement Signup</td></tr>
162  <?php if (strlen($save_msg) > 0): ?>
163  <tr><td class="msg" colspan="3"><?php echo $save_msg; ?></td></tr>
164  <?php endif; ?>
165  <tr><td valign="top" class="dtl" align="left" colspan="2"><br>
166  <textarea name="accts" cols="35" rows="15"></textarea></td>
167  <td class="dtl" valign="top"><br>Insert the account numbers into this entry field, separated by a space or new line. <br><br>
168 If the member record exists, the eStatement flag will be set. If the member record does not exist, one will be created.
169 </td></tr>
170  <tr>
171  <td align="left" class="hdr" colspan="3"><input type="submit" value="Submit" name="btnEval"></td>
172  </tr>
173 
174  </table>
175  </div>
176  </form>