Odyssey
demo_ticket.prg
1 <?php
2 $monLibrary= dirname(__FILE__) . "/../library";
3 require_once("$monLibrary/cu_top.i");
4 require_once("$monLibrary/ck_hticket.i");
5 require_once("$monLibrary/cu_pass.i");
6 
7  if (!CheckPerm($link, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
8 
9  // ** Permissions failed
10  // ** redirect to new page
11  header("Location: /hcuadm/hcu_noperm.prg");
12  exit;
13  }
14 
15 $dms_ok=array('orderby'=>'string','action'=>'string','rowid'=>'string');
16 
17 dms_import($dms_ok);
18 
19  if (empty($orderby)) $orderby = 'cu';
20  if ($orderby == 'start')
21  $sql_order = " coalesce(cuadmin.upllaststart, TIMESTAMP '01-01-1970 12:00:00') desc";
22  elseif ($orderby == 'end')
23  $sql_order = " coalesce(cuadmin.upllastend, TIMESTAMP '01-01-1970 12:00:00') desc";
24  else
25  $sql_order = "upper(cuadmin.$orderby)";
26  $sql = "select cu, user_name, vendor, orgname, upllaststat, histtrunc,
27  to_char(upllaststart, 'MM/DD/YYYY HH24:MI:SS') as upllaststart,
28  to_char(upllastend, 'MM/DD/YYYY HH24:MI:SS') as upllastend,
29  offlinestat
30  from cuadmin order by $sql_order";
31 
32  switch ($orderby) {
33  case "user_name":
34  $use_field = "user_name";
35  break;
36  case "vendor":
37  $use_field = "vendor";
38  break;
39  case "orgname":
40  $use_field = "orgname";
41  break;
42  case "cu":
43  $use_field = "cu";
44  break;
45  default:
46  $use_field = "N";
47  }
48 
49  $sth = db_query($sql, $dbh);
50  if ($sth) {
51  cu_header("Server Status");
52 
53  echo "<a name=\"top\"></a>";
54  echo "<table border=0 cellpadding=3 cellspacing=0 align=center width='100%' class='dmsbg'><tr><td>";
55  echo "<table border=0 cellpadding=2 cellspacing=0 align=center width='100%' bgcolor=white>";
56  echo "<tr><td colspan=6 class=bar align=center>SELECT CREDIT UNION</td></tr>";
57  if ($use_field <> "N") {
58  echo "<tr><td colspan='6' align=center>Index: ";
59  for ($adx=ord("A"); $adx <= ord("Z"); $adx++)
60  echo "<a href=#" . chr($adx) . ">" . chr($adx) . "</a> &nbsp;";
61  echo "</td></tr>";
62  }
63  echo "<tr>
64  <td class='hdr'>
65  <a href=$PHP_SELF?action=list&orderby=cu>Credit Union</a></td>
66  <td class='hdr'>
67  <a href=$PHP_SELF?action=list&orderby=orgname>CU Name</a></td>
68  <td class='hdr'>
69  <a href=$PHP_SELF?action=list&orderby=vendor>Vendor</a></td>
70  <td class='hdr'>
71  <a href=$PHP_SELF?action=list&orderby=start>Last Upload Start</a></td>
72  <td class='hdr'>
73  <a href=$PHP_SELF?action=list&orderby=end>Last Upload End</a></td>
74  <td class='hdr'>Status</a></td>
75  </tr>";
76  $RGB = "odd";
77  if ($use_field <> "N") {
78  $cur_ascii = ord("A") - 1; // Start at the character before A
79  $lst_ascii = ord("A") - 1; // Start at the character before A
80  }
81  for ($row=0; list($cu, $user_name, $vendor, $orgname, $upllaststat, $histtrunc, $upllaststart, $upllastend, $offlinestat) = db_fetch_array($sth,$row); $row++) {
82  $cu = trim($cu);
83  $user_name = trim($user_name);
84 
85  if ($use_field <> "N") {
86  $cur_ascii = (ord(strtoupper(substr($$use_field, 0, 1))) > $cur_ascii && ord(strtoupper(substr($$use_field, 0, 1))) <= ord("Z") ? ord(strtoupper(substr($$use_field, 0, 1))) : $cur_ascii);
87  if (($cur_ascii <> $lst_ascii) && (($cur_ascii >= ord("A")) && ($cur_ascii <= ord("Z")))) {
88  //Insert links for missing letters, but display only the current letter
89  printf("<tr><td colspan=6>\n");
90  for ($adx = $lst_ascii + 1; $adx < $cur_ascii; $adx++)
91  printf("<a name=%s></a>\n", chr($adx));
92  // Now print the current
93  printf("<a name=%s>%s</a>&nbsp;&nbsp;<a href=#top>back to top</a></td></tr>\n", chr($adx), chr($adx));
94  $lst_ascii = $cur_ascii;
95  }
96  }
97 
98  // display list w/link to self ?action=fetch and ?action=delete
99  $tr_class = ($upllaststat > 0 ? "error" : $RGB);
100  // Now compensate for the Truncate History flag, this will be a Yellow color
101  $tr_class = ($histtrunc == "1" ? "trunc" : $tr_class);
102  $tr_class = ($offlinestat == "Y" || $offlinestat == "U" ? "offstat" : $tr_class);
103  $vend_show = (trim($vendor) == '' ? "" : "&vc=". trim($vendor));
104  $pos = strpos($_SERVER['HTTP_HOST'],".");
105  $www_show = "&wc=" . substr($_SERVER['HTTP_HOST'],0,$pos);
106  $llink = (trim($upllaststart) == '' ? '' : "<a href='https://" . substr($_SERVER['HTTP_HOST'],0,$pos) .
107  ".homecu.net/hcuadm/tfiles/$user_name/public_html/status.txt'>Last</a>");
108  $hlink = (trim($upllaststart) == '' ? '' : "<a href='https://" . substr($_SERVER['HTTP_HOST'],0,$pos) .
109  ".homecu.net/hcuadm/html_hist?rowid=$user_name'>History</a>");
110 
111  printf("<TR class=\"%s\"><td><A HREF=\"%s/hcuadm/cuindex.prg?action=fetch&rowid=%s%s%s\" target=\"_top\">
112  %s</a></td>
113  <td><font size=2>%s&nbsp;</td>
114  <td><font size=2>%s&nbsp;</td>
115  <td><font size=2>%s&nbsp;</td>
116  <td><font size=2>%s&nbsp;</td>
117  <td><font size=2>%s&nbsp;%s&nbsp;</td>
118  </tr>\n",$tr_class,$infourl,$user_name, $vend_show, $www_show,
119  $user_name, $orgname, $vendor, $upllaststart, $upllastend,$llink,$hlink);
120  $RGB = ($RGB == "odd" ? "even" : "odd");
121  }
122 
123  if ($use_field <> "N") {
124  if ($cur_ascii < ord("Z")) {
125  printf("<tr><td colspan=5>\n");
126  for ($adx = $cur_ascii + 1; $adx <= ord("Z"); $adx++)
127  printf("<a name=%s></a>\n", chr($adx));
128  // Now print the current
129  printf("<a href=#top>back to top</a></td></tr>");
130  }
131  }
132  print <<< print_legend
133  <tr><td colspan="6">&nbsp;</td></tr>
134  <tr><td colspan="6" class='bar'>
135  COLOR LEGEND
136  </td></tr>
137  <tr class="error">
138  <td colspan="6">
139  <font size=2>
140  The 'upllaststat' flag is set to 1 for this credit union. It could indicate an error or an upload is in process.
141  </font>
142  </td>
143  </tr>
144  <tr class="trunc">
145  <td colspan="6">
146  <font size=2>
147  The 'histtrunc' flag is set to 1 for this credit union. The next time an upload occurs the history will be truncated.
148  </font>
149  </td>
150  </tr>
151  <tr class="offstat">
152  <td colspan="6">
153  <font size=2>
154  The credit union has been flagged offline by setting the 'offlinestat' flag.
155  </font>
156  </td>
157  </tr>
158 print_legend;
159  echo "</table>
160  </td></tr></table>";
161  cu_footer();
162  }
163 ?>