Odyssey
setverifybulk.prg
1 <?php
2  $monLibrary= dirname(__FILE__) . "/../library";
3  require_once("$monLibrary/cu_top.i");
4  require_once("$monLibrary/ck_hticket.i");
5 
6 if (isset($w) == false || $w > 2)
7  $w = "1";
8 
9 $dbh = $link;
10 
11 if (!CheckPerm($link, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
12  // ** Permissions failed
13  // ** redirect to new page
14  header("Location: /hcuadm/hcu_noperm.prg");
15  exit;
16 }
17 
18 $dms_ok = array('cu' => 'string', 'w' => 'string', 'msg' => 'string');
19 
20 dms_import($dms_ok);
21 $cu = isset($cu) ? strtoupper($cu) : "";
22 
23 switch ($w):
24 
25  case "1":
26  cu_header("Force Member Email Verification");
27 
28  $sql = "SELECT COUNT(user_name) FROM {$cu}user";
29  $cnt_rs = db_query($sql, $dbh);
30  list($memcount) = db_fetch_array($cnt_rs);
31  db_free_result($cnt_rs);
32  ?>
33  <form action="<?php echo $_SERVER['PHP_SELF']; ?>?cu=<?php echo $cu; ?>" method="post">
34  <input type="hidden" value="2" name="w">
35  <table border=0 align=center cellpadding=3 cellspacing=0 width=500 class="dmsbg"><tr><td>
36  <table border=0 cellpadding=1 cellspacing=0 width="100%" bgcolor=white>
37  <tr>
38  <td class='bar' align=center>
39  Force Email Verification
40  </td>
41  </tr>
42  <?php if ($memcount == 0): ?>
43  <tr>
44  <td class='dtl' align=center>
45  <br>No members found!<br>Please check CU code and try again
46  </td>
47  </tr>
48  <?php else: ?>
49  <?php if (isset($msg)): ?>
50  <tr>
51  <td class='dtl' align=center>
52  <br><?php echo $msg; ?>
53  </td>
54  </tr>
55  <?php else: ?>
56  <tr>
57  <td align=center class='dtl'>
58  <font size="3" color="red">
59  WARNING!<br>
60  This will force email verification for members at <?php echo $cu; ?>. <br>Be sure this is what you want to do.
61  </font>
62  </td>
63  </tr>
64  <tr>
65  <td class='dtl' align=center>
66  <table border=0 cellpadding=0 cellspacing=0>
67  <tr>
68  <td class="dtl" align="left">
69  &nbsp;Current Members:&nbsp;
70  </td>
71  <td class="dtl" align="right">
72  &nbsp;<?php echo $memcount; ?>&nbsp;
73  </td>
74  </tr>
75  </table>
76  </td>
77  </tr>
78  <tr>
79  <td class='dtl' align=center>
80  <hr>
81  </td>
82  </tr>
83  <tr>
84  <td class='dtl'>
85  Are you sure you want to force email verification for members at <?php echo strtoupper($cu); ?>?
86  </td>
87  </tr>
88  <tr>
89  <td class='dtl'>
90  <input type="submit" value="Yes, please do it NOW!!" name="btnVerify">
91  </td>
92  </tr>
93  <?php endif; ?>
94  <?php endif; ?>
95  </table>
96  </td></tr></table>
97  </form>
98  </body>
99  </html>
100 
101  <?php
102  break;
103  case "2":
104 
105  // *** SANITY CHECK THE CREDIT UNION ID
106  $sql = "SELECT trim(cu) FROM cuadmin WHERE cu = '" . prep_save($cu) . "'";
107  $cu_rs = db_query($sql, $dbh);
108  list($cu_code) = db_fetch_array($cu_rs);
109  db_free_result($cu_rs);
110 
111  if ($cu_code != "") {
112  // ** I HAVE THE CODE -- UPDATE THE [cu]user table
113  $upd_sql = "UPDATE {$cu_code}user SET msg_tx = COALESCE((msg_tx | 512::smallint), 512)";
114 
115  if ($upd_rs = db_query($upd_sql, $dbh)) {
116  $upd_msg = "I have flagged " . db_affected_rows($upd_rs) . " members for email verification. I hope this helped.";
117  } else {
118  $upd_msg = "The members were NOT updated. Please contact a system administrator to update the members.";
119  }
120  } else {
121  // *** CU CODE NOT VALID
122  $upd_msg = "The credit union code is NOT valid. Please contact a system administrator to update the members.";
123  }
124 
125  header("Location: {$_SERVER['PHP_SELF']}?cu={$cu}&msg=" . urlencode($upd_msg));
126  exit;
127  break;
128 endswitch;
129 ?>