2 $monLibrary= dirname(__FILE__) .
"/../library";
3 require_once(
"$monLibrary/cu_top.i");
4 require_once(
"$monLibrary/ck_hticket.i");
6 if (!CheckPerm($link, $Hu, basename($_SERVER[
'SCRIPT_NAME']), $_SERVER[
'REMOTE_ADDR'])) {
9 header(
"Location: /hcuadm/hcu_noperm.prg");
13 $dms_ok=array(
'action'=>
'string',
'Fs'=>
'string',
'Cn'=>
'string',
'Pass'=>
'string',
'Clw'=>
'digits',
'pktdays'=>
'digits',
'maxfail'=>
'digits',
'Tc'=>
'string',
'R1'=>
'string',
'R2'=>
'string',
'R3'=>
'string',
'R4'=>
'string',
'R5'=>
'string',
'Amt'=>
'string');
17 #error_reporting (E_ALL); 18 error_reporting (E_ERROR | E_WARNING | E_PARSE);
19 echo
"<html><LINK REL=stylesheet HREF='/monitor/css/dms.css' TYPE='text/css'>";
20 $action = (empty($action) ?
"Show" : $action);
22 $host = substr($_SERVER[
'SERVER_NAME'], 0,strpos($_SERVER[
'SERVER_NAME'],
"."));
29 # show forms for fetch/post 32 <head><title>ARU Dump</title></head><body bgcolor=#FFFFFF>
33 <div align=
'center' class=
'usu'>$host Live ARU Tester</div>
34 <table width=98% cellpadding=2><tr>
35 <td valign=top align=center width=34%>
36 <form action=
"$PHP_SELF?action='fetch'">
37 <input type=
'hidden' name=
'Fs' value=
'http://192.168.169.53/hculive7/ARS_livedb.mp'>
39 <tr><td
class=
'bar' colspan=2 align=center>Fetch ARU Packet</td></tr>
40 <tr><td
class=
'dtl' align=
"right">Member: </td>
41 <td><input type=text name=
"Cn" size=10></td></tr>
42 <tr><td
class=
'dtl' align=
"right">Password: </td>
43 <td><input type=password name=
"Pass" size=10 MAXLENGTH=
"8"></td></tr>
44 <tr><td
class=
'dtl' align=
"right">Query Delay: </td>
45 <td><input type=text name=
"Clw" size=10 value=1></td></tr>
46 <tr><td
class=
'dtl' align=
"right">Maximum History Days: </td>
47 <td><input type=text name=
"pktdays" size=5 value=
'30'></td>
49 <tr><td
class=
'dtl' align=
"right">Maximum Login Failures: </td>
50 <td><input type=text name=
"maxfail" size=5 value=
'5'></td>
52 <tr><td colspan=2 align=
"center">
53 <input type=submit name=
"action" value=
"Fetch" class=
'bar'>
57 </td><td valign=top align=center width=33%>
58 <form action=
"$PHP_SELF?action='retrieve'">
59 <input type=
'hidden' name=
'Fs' value=
'http://192.168.169.53/hculive7/ARS_livedb.mp'>
61 <tr><td
class=
'bar' colspan=2 align=center>Cross-Accounts</td></tr>
62 <tr><td
class=
'dtl' align=
"right">Member: </td>
63 <td><input type=text name=
"Cn" size=10></td></tr>
64 <tr><td colspan=2 align=
"center">
65 <input type=submit name=
"action" value=
"Retrieve" class=
'bar'></td></tr>
68 </td><td valign=top align=center width=*>
69 <form action=
"$PHP_SELF?action='post'">
70 <input type=
'hidden' name=
'Fs' value=
'http://192.168.169.53/hculive7/ARS_livedb.mp'>
72 <tr><td
class=
'bar' colspan=2 align=center>Post ARU Packet</td></tr>
73 <tr><td
class=
'dtl' align=
"right">Member: </td>
74 <td><input type=text name=
"Cn" size=10></td></tr>
75 <tr><td
class=
'dtl' align=
"right">Transaction Code: </td>
76 <td><select name=
"Tc">
87 <tr><td
class=
'dtl' align=
"right">Ref 1 (From Sfx): </td>
88 <td><input type=text name=
"R1" size=10 value=1></td></tr>
89 <tr><td
class=
'dtl' align=
"right">Ref 2 (To Sfx): </td>
90 <td><input type=text name=
"R2" size=10 value=1></td></tr>
91 <tr><td class=
'dtl' align=
"right">Ref 3 (email): </td>
92 <td><input type=text name=
"R3" size=10 value=1></td></tr>
93 <tr><td class=
'dtl' align=
"right">Ref 4 (To misc): </td>
94 <td><input type=text name=
"R4" size=10 value=1></td></tr>
95 <tr><td class=
'dtl' align=
"right">Ref 5 (To Mem): </td>
96 <td><input type=text name=
"R5" size=10 value=1></td></tr>
97 <tr><td class=
'dtl' align=
"right">Amount: </td>
98 <td><input type=text name=
"Amt" size=10></td></tr>
99 <tr><td colspan=2 align=
"center">
100 <input type=submit name=
"action" value=
"Post" class=
'bar'></td></tr>
104 </tr></table></body></html>
110 if (empty($pktdays)) { $pktdays = 30; }
111 print
"<html><head><title>ARU Fetch</title></head><body bgcolor=#FFFFFF> 112 Fetching packet using parameters<ul> 114 <li>Password: $Pass</li> 115 <li>Fetched from: $Fs</li> 117 <li>Wait between calls: $Clw</li> 118 <li>Last Packet Stamp: $pktstamp</li> 119 <li>Requested Max Days: $pktdays</li> 120 <li>Requested Max Fail: $maxfail</li> 122 fetch_packet($Fs, $Cn, $Clw, $pktstamp, $Pass, $pktdays, $maxfail);
128 print
"<html><head><title>Cross-Account Retrieve</title></head><body bgcolor=#FFFFFF> 129 Retrieving Cross-Account Authorizations using parameters<ul> 131 <li>Fetched from: $Fs</li> 139 $R2 = (trim($R2) ==
"" ?
"NULL" : $R2);
140 $R3 = (trim($R3) ==
"" ?
"NULL" : $R3);
141 $R4 = (trim($R4) ==
"" ?
"NULL" : $R4);
142 $R5 = (trim($R5) ==
"" ?
"NULL" : $R5);
143 print
"<html><head><title>ARU Post</title></head><body bgcolor=#FFFFFF> 144 Posting packet using parameters<ul> 146 <li>Posted to: $Fs</li> 147 <li>Txn Code: $Tc</li> 153 <li>Amount: $Amt</li> 154 <li>URL: $Fs?member=$Cn&type=T&tran_code=$Tc&ref1=$R1&ref2=$R2&ref3=$R3&ref4=$R4&ref5=$R5&amount=$Amt</li> 156 post_packet($Fs, $Cn, $Tc, $R1, $R2, $R3, $R4, $R5, $Amt);
160 function fetch_packet($Fs, $Cn, $Clw, $pktstamp, $Pass, $pktdays, $maxfail) {
162 $pktstamp = (empty($pktstamp) ? 1 : $pktstamp);
163 $pktdate = (empty($pktdate) ? date(
"D M j Y H:i:s T") : $pktdate);
164 $Clw = (($Clw == 0 || is_null($Clw)) ? 300 : $Clw);
166 $threshold = mktime() - $Clw;
167 $fs = date(
"D M j Y H:i:s T",$pktstamp);
168 $ft = date(
"D M j Y H:i:s T",$threshold);
169 if ($pktstamp > $threshold) {
170 print
"Too soon to ask again<br> 172 Threshold: $ft<br></body></html>";
175 # if the last packet was fairly recent only fetch 7 days 176 # "recent" defined as 3 times the packet timeout setting 177 $threshold = mktime() - (3 * $Clw);
178 if (empty($cutoff)) { $cutoff =
'20000101'; }
179 if (empty($histdays)) { $histdays = 0; }
180 # 946710000 is the timestamp for 20000101 181 if ($pktstamp >946710000 && $histdays > 0 && $cutoff == 20000101) {
182 # calculate cutoff as pktstamp - interval($histdays days) 183 if ($pktstamp > $threshold) {
184 # last packet age is less than 3 times the packet timeout setting 185 # set cutoff for 7 days 186 $cutoff = date(
"Ymd",mktime()-604800);
188 $cutoff = date(
"Ymd",$pktstamp-(86400 * $histdays));
191 $URL=
"?member=$Cn&type=I&pktdays=$pktdays&maxfail=$maxfail";
195 $fd = @fopen (
"$Fs$URL",
"r");
198 while ($buff = fread ($fd, 1500)) {
201 $packet = HTMLSpecialChars($packet);
202 print
"<br>URL: $URL<br><pre>$packet</pre></body></html>";
204 print
"Couldn't get a packet!<br>$php_errormsg</body></html>";
210 function fetch_xac($Fs, $Cn) {
212 $URL=
"?member=$Cn&type=X";
213 $fd = @fopen (
"$Fs$URL",
"r");
216 while ($buff = fread ($fd, 1500)) {
220 $packet = HTMLSpecialChars($packet);
221 print
"<br>URL: $URL<br><pre>$packet</pre></body></html>";
223 print
"Couldn't get a packet!<br>$php_errormsg</body></html>";
228 function post_packet($Fs, $Cn, $Tc, $R1, $R2, $R3, $R4, $R5, $Amt) {
231 $URL =
"?member=$Cn&type=T&tran_code=$Tc&ref1=$R1&ref2=$R2&ref3=$R3&ref4=$R4&ref5=$R5&amount=$Amt";
232 $fd = @fopen (
"$Fs$URL",
"r");
235 while ($buff = fread ($fd, 1500)) {
239 $packet = HTMLSpecialChars($packet);
240 print
"<pre>$packet</pre></body></html>";
243 print
"Couldn't get a packet!<br>$php_errormsg<br>";
244 print
"URL=$Fs?member=$Cn&type=T&tran_code=$Tc&ref1=$R1&ref2=$R2&ref3=$R3&ref4=$R4&ref5=$R5&amount=$Amt<br>";
248 function showquoted(&$val) {
249 if (is_array($val)) {
250 array_walk($val,
'showquoted');
253 $val = htmlentities($val);