3 $monLibrary= dirname(__FILE__) .
"/../library";
4 $sharedLibrary= dirname(__FILE__) .
"/../../shared/library";
5 require_once(
"$monLibrary/cu_top.i");
6 require_once(
"$monLibrary/ck_hticket.i");
7 require_once(
"$sharedLibrary/cu_flagconst.i");
9 if (!CheckPerm($link, $Hu, basename($_SERVER[
'SCRIPT_NAME']), $_SERVER[
'REMOTE_ADDR'])) {
12 header(
"Location: /hcuadm/hcu_noperm.prg");
16 $dms_ok=array(
'report'=>
'digits',
'ob'=>
'digits',
'csv'=>
'string',
17 'pos'=>
'digits',
'd'=>
'digits',
'jval'=>
'string',
'pm'=>
'digits',
18 'mo'=>
'digits',
's0'=>
'digits',
's1'=>
'digits',
's2'=>
'digits',
19 's3'=>
'digits',
's4'=>
'digits',
's5'=>
'digits',
's6'=>
'digits',
'hit'=>
'digits');
22 $report = (isset($report) ? $report : 0);
33 $strShowingRecords =
"Showing records ";
35 $strPrevious =
"Previous";
40 $strEmptySet =
"No records found";
42 $self = $_SERVER[
'PHP_SELF'];
49 if ($s1 == 1) {array_push($servers,
"www");$q .=
"&s1=1";}
50 if ($s2 == 1) {array_push($servers,
"www2");$q .=
"&s2=1";}
51 if ($s3 == 1) {array_push($servers,
"www3");$q .=
"&s3=1";}
52 if ($s4 == 1) {array_push($servers,
"www4");$q .=
"&s4=1";}
53 if ($s5 == 1) {array_push($servers,
"www5");$q .=
"&s5=1";}
54 if ($s6 == 1) {array_push($servers,
"www6");$q .=
"&s6=1";}
56 if (
sizeof($servers) == 0) {
57 #$servers=array('www2','www','www4','www5','www6'); 58 $servers=array(
'www3',
'www5',
'www6');
64 $sql_query =
"select trim(upper(user_name)) as user_name, trim(www_server) as www_server from cuinfo order by user_name";
65 if (!$result = db_query($sql_query,$dbh)) {
66 pg_die(pg_errormessage($dbh), $sql_query.$sql_order, __FILE__, __LINE__);
68 $num_rows = db_num_rows($result);
69 for ($i_row = 0; $drow=db_fetch_array($result,$row);$row++) {
70 $client_www{$drow[
'user_name']} = $drow[
'www_server'];
74 # select user_name, www_server from cuinfo where client is not closed 75 # build array $client_www{"$user_name" => $www_server} 76 # inside loop, compare retrieved clients to make sure they appear on that server in the array 78 # array_key_exists("$user_name",array_intersect($client_www,array($ask))); 80 if (!isset($ob)) { $ob =
"1";}
82 foreach ($servers as $ask) {
90 $cmd =
"https://$ask.homecu.net/hcuadm/adm_reports.prg?report=$report&csv=raw";
92 curl_setopt($ch,CURLOPT_COOKIE,
"HCUTicket={$_COOKIE['HCUTicket']}");
93 curl_setopt($ch,CURLOPT_USERPWD,
"nobody:no1home");
94 curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); #
get response as
string 95 $rawresp=curl_exec($ch);
100 foreach(explode(
"\r\n",$rawresp) as $get_line) {
101 if (trim($get_line) !=
"") {
102 if ($verify_server) {
104 $content = explode(
"\t",$get_line);
105 if ($i < 3 || array_key_exists(trim($content[0]),array_intersect($client_www,array($ask)))) {
106 $response[] = $get_line;
109 $response[] = $get_line;
114 # $cmd = "https://nobody:no1home@$ask.homecu.net/hcuadm/adm_reports?report=$report&csv=raw"; 115 # $cmd = "/usr/bin/curl " . escapeshellarg("-b HCUTicket={$_COOKIE['HCUTicket']}") . " " . escapeshellarg("$cmd"); 117 ## temporarily pass user credentials for testing remote access 118 ## $cmd = "/usr/bin/curl " . escapeshellarg("-b HCUTicket={$_COOKIE['HCUTicket']}") . " -u nobody:no1home " . escapeshellarg("$cmd"); 120 # // $cmd = escapeshellcmd("/usr/bin/curl -b \"HCUTicket={$_COOKIE['HCUTicket']}\" \"$cmd\""); 121 # // ** Now pass the command to the command line 123 # $response = Array(); // Reset the array 124 # // ** Take the command -- open a pipe -- then retrieve the information -- stuff into an array 125 # if ($handle = popen($cmd, 'r')) { 126 # while (!feof ($handle)) { 127 # $get_line = fgets($handle, 4096); 128 # if (trim($get_line) != "") { 129 # $response[] = $get_line; 133 # // ** Be sure to close the handle 137 if (
sizeof($response)) {
138 $titles = explode(
"\t",rtrim(array_shift($response),
"\r\n"));
139 $ftypes = explode(
"\t",rtrim(array_shift($response),
"\r\n"));
142 array_walk($response,
'save_server',
"$ask");
143 array_push($titles,
"Server");
144 array_push($ftypes,
"char");
146 array_walk($response,
'sort_by', $ob -1);
147 $culist = array_merge($culist, $response);
150 if(is_array($culist) &&
sizeof($culist)) {
151 $culist = array_unique($culist);
152 $sortopt = (eregi(
"int|numeric", $ftypes[$ob - 1]) ? SORT_NUMERIC : SORT_REGULAR);
154 rsort($culist, $sortopt);
156 sort($culist, $sortopt);
158 $title = array_shift($titles);
159 $num_fields =
sizeof($titles);
160 $num_rows =
sizeof($culist);
162 function highlight($line) {
165 if ($pm) $clen = strlen($jval);
166 $row = explode(
"\t",rtrim($line,
"\r\n"));
168 $coloff = (strpos(strtolower($colval), strtolower($jval))===
false ? 0 : strpos(strtolower($colval),strtolower($jval)));
169 if ($pm==2) $colval = substr($colval,$coloff,$clen);
170 if ($pm==1) $colval = substr($colval,0,$clen);
171 return (strtolower(trim($colval)) == strtolower($jval));
175 # if jval is set, search through the ob field until we find a match 176 # set $pos so record is on the page 185 if (isset($jval) && trim($jval) >
'') {
186 $jval = trim(preg_replace(
"/[\"\`;\\\]/",
"",$jval));
187 $matchlines=array_filter($culist,
'highlight');
188 if (
sizeof($matchlines) == 0) {
191 # only reset to record zero if we got here by clicking the form 192 # strNavigation calls send in their own position info 194 if ($hit) $pos = $cfgMaxRows * floor((key($matchlines))/$cfgMaxRows);
197 $culist=array_merge($matchlines);
198 $num_rows =
sizeof($culist);
200 # only reset to record zero if we got here by clicking the form 201 # strNavigation calls send in their own position info 211 if (($csv ==
'csv') && ($num_rows > 1)) {
217 # First record has the field names 219 for ($i_field = 0; $i_field < $num_fields; $i_field++) {
220 $field_name = $titles[$i_field];
221 $ostring .=
"$osep\"$field_name\"";
229 foreach ($culist as $cu) {
232 $row = explode(
"\t",$cu);
234 # throw away the sort column 237 for ($i_field = 0; $i_field < $num_fields; $i_field++) {
238 $field_type = $ftypes[$i_field];
239 if (preg_match(
"/(int|numeric)/i", $field_type)) {
240 $ostring .=
"${osep}${row[$i_field]}";
241 } elseif (preg_match(
"/(text|char)/i", $field_type)) {
242 $ostring .=
"${osep}\"${row[$i_field]}\"";
243 } elseif ($field_type ==
"bool") {
244 $ostring .=
"${osep}\"${row[$i_field]}\"";
246 $ostring .=
"${osep}\"${row[$i_field]}\"";
254 header(
"Content-length: " . strlen( $ostring ) );
255 header(
"Content-type: application/octetstream");
256 header(
"Content-disposition: inline; filename=\"${Cu}report${report}.csv\"");
261 $pos_next = $pos + $cfgMaxRows;
262 $pos_prev = $pos - $cfgMaxRows;
265 $iNumRows = $num_rows;
266 if ($num_rows < $pos_next) {
267 $pos_next = $num_rows;
269 $strNavigation .=
"<table border=0 cellspacing=0 cellpadding=2><tr>\n";
270 $strNavigation .=
"<td align=left>";
271 if ($pos >= $cfgMaxRows) {
273 $strNavigation .=
"<a href=\"$self&report=$report\" onclick=\"jumpto(0,0);return false;\"><< $strPos1 </a> | ";
275 $strNavigation .=
" <a href=\"$self&report=$report\" onclick=\"jumpto($pos_prev,0);return false;\">< $strPrevious </a> | ";
277 $strNavigation .=
" ";
279 $strNavigation .=
"</td>\n";
281 $strNavigation .=
"<td align=center>\n";
284 if (empty($cfgMaxPages)) {
288 $iCount = $pos - ($cfgMaxRows * $cfgMaxPages);
292 $iPageCnt = (int)($iCount / $cfgMaxRows);
293 $iPageStop = $pos + ($cfgMaxRows * ($cfgMaxPages + 1));
295 for (; $iCount < $iNumRows && $iCount < $iPageStop; $iCount += $cfgMaxRows) {
298 if ($iCount != $pos) {
299 $strPages .=
"<a href=\"$self&report=$report\" onclick=\"jumpto($iCount,0);return false;\">$iPageCnt</a> | ";
301 if ($iNumRows > $cfgMaxRows) {
302 $strPages .=
"$iPageCnt | ";
306 $strNavigation .= preg_replace(
"/ \| $/",
"", $strPages);
308 $strNavigation .=
"</td>\n";
310 $strNavigation .=
"<td align=right>";
311 if ($pos_next < $num_rows) {
312 $strNavigation .=
" | <a href=\"$self&report=$report\" onclick=\"jumpto($pos_next,0);return false;\"> $strNext ></a>";
315 $pos_end = $num_rows - $cfgMaxRows;
316 $strNavigation .=
" | <a href=\"$self&report=$report\" onclick=\"jumpto($pos_end,0);return false;\"> $strEnd >></a>";
318 $strNavigation .=
" ";
320 $strNavigation .=
"</td>\n";
321 $strNavigation .=
"</tr></table>\n";
323 header(
"Expires: Sat 20 May 1995 03:32:38 GMT");
324 header(
"Pragma: no-cache");
325 header(
"Cache-Control: no-cache, must-revalidate");
327 # document.location='$self?report=$report&ob=$ob&d=$d&pos=0&jval=' + strJval + '&pm=' + strPm + '&mo=' + strMo + '$q'; 329 <script language=
'javascript'>
330 function jumpto(pos,hit,ob, d)
332 pos = typeof(pos) !=
'undefined' ? pos : $pos;
333 hit = typeof(hit) !=
'undefined' ? hit :
'';
334 ob = typeof(ob) !=
'undefined' ? ob : $ob;
335 d = typeof(d) !=
'undefined' ? d : $d;
336 document.jumpform.ob.value = ob;
337 document.jumpform.d.value = d;
338 document.jumpform.pos.value = pos;
339 document.jumpform.hit.value = hit;
340 document.jumpform.submit();
344 document.jumpform.ob.value = 1;
345 document.jumpform.d.value = 0;
346 document.jumpform.pos.value = 0;
347 document.jumpform.hit.value =
'';
348 document.jumpform.jval.value =
'';
349 document.jumpform.pm[0].checked=
true;
350 document.jumpform.pm[1].checked=
false;
351 document.jumpform.pm[2].checked=
false;
352 document.jumpform.mo.checked=
false;
353 document.jumpform.submit();
359 echo
"<table border=$cfgBorder align=center width='100%' bgcolor=white cellpadding=2 cellspacing=0>";
360 echo
"<tr><td class='dtl' align='left'>";
361 echo
"<a href='$produrl/hcuadm/cuilist.prg'>Credit Union List</a> 362 <a href='$self?report=0'>Report Menu</a> 363 <A HREF='$self?csv=csv&report=$report&ob=$ob&d=$d&jval=" . urlencode($jval) .
"&pm=$pm&mo=$mo$q'>Download CSV</a></td><td class='dtl' align='right'> ";
365 echo
"$strShowingRecords $pos - $pos_next ($num_rows $strTotal)";
367 echo
"</td></tr></table>";
370 if (!isset($pm)) $pm = 0;
371 # if ($iNumRows > $cfgMaxRows) { 372 # show a 'Jump to this value' link for the sorted field only 373 #print "<form name='jumpform' onSubmit='jumpto();return false;'> 374 print
"<form name='jumpform' action='$self'> 375 <input type='hidden' name='report' value='$report'> 376 <input type='hidden' name='pos' value='$pos'> 377 <input type='hidden' name='ob' value='$ob'> 378 <input type='hidden' name='d' value='$d'> 379 <input type='hidden' name='hit' value='$hit'> 380 <input type='hidden' name='s0' value='$s0'> 381 <input type='hidden' name='s1' value='$s1'> 382 <input type='hidden' name='s2' value='$s2'> 383 <input type='hidden' name='s3' value='$s3'> 384 <input type='hidden' name='s4' value='$s4'> 385 <input type='hidden' name='s5' value='$s5'> 386 <input type='hidden' name='s6' value='$s6'> 387 <table border=$cfgBorder align=center width='90%'> 388 <tr><td class='msg'><hr> 389 Click column heading to change sort order and jump value<br> </td></tr> 390 <tr><td class='small' valign='top'>Jump to {$titles[$ob -1]} : 391 <input type='text' name='jval' value='$jval' size='10'> <br> 393 <input type='radio' name='pm' value='0'" .
394 ($pm==0 ?
' checked>' :
'>') .
" Full Match 395 <input type='radio' name='pm' value='1'" .
396 ($pm==1 ?
' checked>' :
'>') .
" Starts With 398 <input type='radio' name='pm' value='2'" .
399 ($pm==2 ?
' checked>' :
'>') .
" Contains<br> 400 <input type='checkbox' name='mo' value='1'" .
401 ($mo==1 ?
' checked>' :
'>') .
" Show Matches Only 402 403 <input type='button' value=' Clear ' onClick='jumpclear();return false;'> 404 405 <input type='button' value=' Go ' onClick='jumpto(0,1);return false;'> 407 if ($nomatch == 1 ) print
"<br><font color='red' align='center'>No Match Found</font>";
408 print
"</td></tr></table></form>";
410 echo
"<table cellspacing=0 border=$cfgBorder align=center width='100%'>";
411 echo
"<tr><td class='hdr' colspan='$num_fields' align='center'>$title</td></tr><tr>";
413 for ($i_field = 0; $i_field < $num_fields; $i_field++) {
414 $field_name = $titles[$i_field];
415 # if (sizeof($culist) > 1) { 417 if (($i_field + 1) == intval($ob) && $d != 1) {
423 $sort_order = ($i_field + 1);
424 echo
"<th class='small' align='left'><A HREF=\"$self?report=$report&pos=$pos&ob={$sort_order}{$desc_ord}{$q}\" onclick=\"jumpto(0,1,$sort_order,$desc_ord);return false;\">$field_name</a></th>\n";
426 # echo "<th class='small' align='left'>$field_name</th>"; 430 if ((
sizeof($culist)) < 1) {
431 echo
"<tr class='odd'><td colspan='$num_fields'>$strEmptySet</td></tr>";
434 for ($i_row = $pos; $i_row < $pos_next; $i_row++) {
435 $row = explode(
"\t",rtrim($culist[$i_row],
"\r\n"));
437 # throw away the sort column 440 if(
sizeof($matchlines) && array_key_exists(
"$i_row",$matchlines)) {
441 $i_row % 2 ? $rbg=
"odd_smhlt" : $rbg =
"even_smhlt";
443 $i_row % 2 ? $rbg=
"odd_small" : $rbg =
"even_small";
446 echo
"<tr class=$rbg>";
447 for ($i_field = 0; $i_field <
sizeof($row); $i_field++) {
448 if (!isset($row[$i_field]))
449 unset($row[$i_field]);
450 $field_type = $ftypes[$i_field];
451 $field_name = $titles[$i_field];
452 if (preg_match(
"/(int|numeric)/i", $field_type)) {
454 echo
"<td align=right valign=top> $row[$i_field] </td>\n";
455 } elseif ($cfgShowBlob ==
false && preg_match(
"/BLOB/i", $field_type)) {
456 echo
"<td align=right valign=top> [BLOB] </td>\n";
457 } elseif (preg_match(
"/(text|char)/i", $field_type)) {
459 if (strlen($row[$i_field]) > $cfgMaxText && !empty($cfgMaxText)) {
460 $strLgText = nl2br(htmlspecialchars(substr($row[$i_field], 0, $cfgMaxText))) .
" <br><b>... $strMore ...</b>";
462 $strLgText = nl2br(htmlspecialchars($row[$i_field]));
464 echo
"<td valign=top> $strLgText</td>\n";
465 } elseif ($field_type ==
"bool") {
466 echo
"<td valign=top> ", bool_YesNo($row[$i_field]),
" </td>\n";
468 echo
"<td valign=top> ", nl2br(htmlspecialchars($row[$i_field])),
" </td>\n";
475 echo
"</tr></table>\n";
478 echo
"</td></tr></table>";
483 print
"No Records Found";
486 # show list of selections 487 header(
"Expires: Sat 20 May 1995 03:32:38 GMT");
488 header(
"Pragma: no-cache");
489 header(
"Cache-Control: no-cache, must-revalidate");
490 cu_header(
"Select Report");
492 <form action=
'$PHP_SELF' method=
'GET'>
493 <table width=
'500' border=
'0' align=
'center' cellpadding=3 cellspacing=0
class=
'dmsbg'><tr><td>
494 <table width=
'100%' border=
'0' align=
'center' bgcolor=white cellpadding2 cellspacing=0>
495 <tr
class=
'barb'><td align=
'center'><font size=+1>Please Select Report</font></td></tr>
496 <tr><td><a href=
"$produrl/hcuadm/cuilist.prg" target=
"parent">Credit Union List</a></td></tr>
497 <tr
class=
'hdr'><td>Home
Banking Settings Reports</td></tr>
498 <tr
class=
'odd_small'><td> <input type=
'radio' name=
'report' value=
'2'> E-Statement Clients</td></tr>
499 <tr
class=
'even_small'><td> <input type=
'radio' name=
'report' value=
'3'> Alpha Check List</td></tr>
500 <tr
class=
'odd_small'><td> <input type=
'radio' name=
'report' value=
'4'> Check Imaging Clients</td></tr>
501 <tr
class=
'even_small'><td> <input type=
'radio' name=
'report' value=
'5'> Download Formats</td></tr>
502 <tr
class=
'odd_small'><td> <input type=
'radio' name=
'report' value=
'6'> Alert Usage Summary</td></tr>
503 <tr
class=
'even_small'><td> <input type=
'radio' name=
'report' value=
'7'> Bill Pay Cross-Authentication Settings</td></tr>
504 <tr
class=
'odd_small'><td> <input type=
'radio' name=
'report' value=
'10'> Trusted Access Settings</td></tr>
505 <tr
class=
'even_small'><td> <input type=
'radio' name=
'report' value=
'8'> Security Method Settings</td></tr>
506 <tr
class=
'odd_small'><td> <input type=
'radio' name=
'report' value=
'14'> Credit Card Settings</td></tr>
507 <tr
class=
'even_small'><td> <input type=
'radio' name=
'report' value=
'9'> Offline Status Settings</td></tr>
508 <tr
class=
'odd_small'><td> <input type=
'radio' name=
'report' value=
'11'> Admin 2-Factor Details</td></tr>
509 <tr
class=
'even_small'><td> <input type=
'radio' name=
'report' value=
'12'> Admin 2-Factor Summary</td></tr>
510 <tr
class=
'odd_small'><td> <input type=
'radio' name=
'report' value=
'13'> Admin
User Login Failure Status</td></tr>
511 <tr
class=
'even_small'><td> <input type=
'radio' name=
'report' value=
'16'> CU TXT
Banking Clients</td></tr>
512 <tr
class=
'odd_small'><td> <input type=
'radio' name=
'report' value=
'17'> CU Alerts Clients</td></tr>
513 <tr
class=
'even_small'><td> <input type=
'radio' name=
'report' value=
'21'> CU Classic Mobile Clients</td></tr>
514 <tr
class=
'odd_small'><td> <input type=
'radio' name=
'report' value=
'22'> CU Mobile Web Clients</td></tr>
515 <tr
class=
'even_small'><td> <input type=
'radio' name=
'report' value=
'18'> Callahan Report Details</td></tr>
516 <tr
class=
'odd_small'><td> <input type=
'radio' name=
'report' value=
'19'> FID Settings</td></tr>
517 <tr
class=
'even_small'><td> <input type=
'radio' name=
'report' value=
'20'> Override MICR Usage</td></tr>
518 <tr
class=
'odd_small'><td> <input type=
'radio' name=
'report' value=
'23'> E-Statement Saturation</td></tr>
519 <tr
class=
'hdr'><td> </td></tr>
520 <tr
class=
'odd_small'><td>Include Data from <br>
521 <!-- <input type=
'checkbox' name=
's1' value=
'1'> www
522 <input type=
'checkbox' name=
's2' value=
'1'> www2
523 <input type=
'checkbox' name=
's4' value=
'1'> www4
524 <br>--> <input type=
'checkbox' name=
's3' value=
'1'> www3
525 <input type=
'checkbox' name=
's5' value=
'1'> www5
526 <input type=
'checkbox' name=
's6' value=
'1'> www6
528 <tr
class=
'hdr'><td> </td></tr>
529 <tr
class=
'odd_small'><td>
530 <input type=
'checkbox' name=
's0' value=
'1'> Include server name in results
532 <tr
class=
'hdrc'><td><input type=
'submit' value=
'Go'></td></tr>
538 function save_server(&$response, $key, $server)
540 $response = rtrim($response,
"\r\n") .
"\t$server\r\n";
543 function sort_by(&$response, $key, $sortcol)
545 $row = explode(
"\t",$response);
546 $response = $row[$sortcol] .
"\t$response";