11 require_once (
"$admLibrary/ck_aticket.i");
13 $dms_ok=array(
'action'=>
'string',
'FULLREFRESH'=>
'digits',
14 'upload_file_name'=>
'string');
17 $self =
"$PHP_SELF?ft={$ft}";
18 $saved_file =
"$home_path/tmp/$chome";
30 if (file_exists($saved_file .
".dat")) {
35 <h2><font color=
"blue">File Upload Error</font></h2>
37 <h2><font color=
"blue">Your previous upload did not complete, please contact support at DMS, Inc.
for instructions.</font></h2>
40 } elseif (!is_uploaded_file($_FILES[
'upload_file'][
'tmp_name'])) {
43 switch ($_FILES[
'upload_file'][
'error']) {
45 $up_err =
"0: No error, the file was uploaded successfully";
48 $up_err =
"1: The upload is larger than the amount allowable by the upload_max_filesize directive in the php.ini";
51 $up_err =
"2: The upload is larger than the MAX_FILE_SIZE directive that was specified via html";
54 $up_err =
"3: The file was only partially uploaded";
57 $up_err =
"4: no file was uploaded";
62 $up_fe = (!file_exists(
"{$_FILES['upload_file']['tmp_name']}") ?
"True" :
"False");
64 Upload File Error --\n 66 Client Filename: {$_FILES['upload_file']['name']}\n 67 Client Filesize: {$_FILES['upload_file']['size']}\n 68 Client Filetype: {$_FILES['upload_file']['type']}\n 69 Client IP: {$_SERVER['REMOTE_ADDR']}\n\n 70 Web Server Information \n 71 Temp File Name - {$_FILES['upload_file']['tmp_name']} 72 Temp File exist - $up_fe\n 73 Error Reported - $up_err\n\n 77 $notify->line = __LINE__;
78 $notify->file = __FILE__;
79 $notify->callingfunction = __FUNCTION__;
83 $notify->mailto =
"mark@homecu.net";
91 There was an error uploading the file <b>{$_FILES[
'upload_file'][
'name']}</b>.<br>
92 Please retry uploading the file.<br>
93 If the problem persists call DMS and report the problem.
106 $find_ary = array(
"\\",
"/",
" ",
";");
107 $rpl_ary = array(
"",
"",
"",
"");
109 $real_name = str_replace($find_ary, $rpl_ary, $_FILES[
'upload_file'][
'name']);
111 if (!move_uploaded_file($_FILES[
'upload_file'][
'tmp_name'], $saved_file .
".daz")) {
112 unlink ($_FILES[
'upload_file'][
'tmp_name']);
115 $rc = @chmod($saved_file .
".daz", 0644);
122 if (file_exists(
"$home_path/public_html/status.old.txt"))
123 copy (
"$home_path/public_html/status.old.txt",
"$home_path/public_html/status.older.txt");
125 if (file_exists(
"$home_path/public_html/status.txt"))
126 copy (
"$home_path/public_html/status.txt",
"$home_path/public_html/status.old.txt");
133 $sql =
"SELECT role, email 136 AND role in ('upload', 'alert') ";
137 $em_rs = db_query($sql, $dbh);
138 for ($row=0; $em_row = db_fetch_array($em_rs,$row); $row++) {
139 $role = trim($em_row[
'role']);
140 $$role = trim($em_row[
'email']);
142 db_free_result($em_rs);
145 $sql =
"SELECT liveserver 148 $em_rs = db_query($sql, $dbh);
149 list($pgloadcmd) = db_fetch_array($em_rs, 0);
150 db_free_result($em_rs);
151 if (trim($pgloadcmd) ==
'') {
152 $pgloadcmd =
"/usr/local/bin/pgload.pl -h $home_path";
154 $pgloadcmd = (escapeshellcmd(
"$pgloadcmd") .
" >" . escapeshellcmd(
"$home_path/public_html/status.txt") .
" 2>&1 &");
156 $sql =
"SELECT email FROM cuadminusers 157 WHERE cu = '$Cu' AND user_name = '$Cn' ";
158 $em_rs = db_query($sql, $dbh);
159 list($email) = db_fetch_array($em_rs, 0);
160 db_free_result($em_rs);
162 if (trim($email) !=
'')
163 { $upload = no_dupes(
"$email;$upload"); }
165 putenv(
"ADMUSER=$Cn");
166 putenv(
"ADMMAIL=$upload");
167 if (
"$alert" !=
"" ) { putenv(
"ALERTMAIL=$alert"); }
169 if ($full_refresh && ($FULLREFRESH == 1)) {
172 $sql =
"UPDATE cuadmin 176 $hist_rs = db_query($sql, $dbh);
177 db_free_result($hist_rs);
180 #$command = escapeshellcmd("$home_path/bin/pgload.sh") . " >" . escapeshellcmd("$home_path/public_html/status.txt") . " 2>&1 &"; 183 #$rc = exec ($command); 184 $rc = exec ($pgloadcmd);
187 if ($full_refresh && ($FULLREFRESH == 1)) {
188 $refresh_text =
"<span style=\"color: red\">NOTE: You just performed a full refresh of your credit unions' data. <b>If the file you just sent was not a full refresh</b>, you must create and upload a full refresh file now to fix the data!</span><br><br>";
192 HCU_setcookie_env($SYSENV,
"LastFileName", $upload_file_name, time()+60*60*24*30);
200 <h3>Thank You! Your upload file
'{$_FILES['upload_file
']['name
']}' ({$_FILES[
'upload_file'][
'size']} bytes) was received and it is now being processed.</h3>
203 <b>THIS DOES NOT MEAN:</b>
205 <li>That we received the correct file, </li>
206 <li>That
this was the next sequential file,</li>
207 <li>Or that
this it was even a digital banking file.</li>
211 Please review the <a href="/admbin/main.prg/admin/status.html?ft=80" class='link2'>results</a> of
this upload. Within about 30 seconds (or longer
for large files) an email will be sent to confirm the results of
this upload. You should insure that the file processed and there are no missing export files.
214 If you prefer, you can click on the
'Upload History' link at the left. You should see that
this export was processed and no exports are missing. If
this does not show in the list, be sure to check your email so you can see what happened and how to fix it.
234 $dat_path_file =
"/home/{$chome}/tmp/{$chome}.dat";
237 $txt_path_file =
"/home/{$chome}/public_html/status.txt";
239 if (file_exists($dat_path_file)) {
242 $ret_fuser = exec(
"/bin/fuser " . escapeshellcmd($txt_path_file));
243 if ($ret_fuser !=
false) {
251 if (is_readable(
"$home_path/admin/status.html")) {
252 $lastupload = date(
"m/d/y g:i:s A", filemtime(
"$home_path/admin/status.html"));
254 if (!empty($lastupload)) {
255 $lastupl_msg = <<< set_msg
256 <tr><td colspan=
"2" class=
"dtl"><img src=
'/IMAGES/transfer.gif'>
257 <a href=
"/admbin/main.prg/admin/status.html?ft=80">View last upload status</a> dated $lastupload
263 if ($upload_status == 1) {
267 <form method=
"" action=
"">
269 <table cellpadding=
"4" align=
"CENTER" cellspacing=
"0" border=
"0" class=
"dtl">
270 <tr><th align=
"CENTER" colspan=
"2" class=
"bar">$Cu File Upload</th></tr>
271 <tr><td colspan=
"2" align=
'center'>
272 <font color=
"blue">Your previous upload did not complete.</font>
275 <tr><td colspan=
"2">Contact DMS Support
for help on completing the upload.</td></tr>
282 } elseif($upload_status == 2) {
287 <form method=
"" action=
"">
289 <table cellpadding=
"4" align=
"CENTER" cellspacing=
"0" border=
"0" class=
"dtl">
290 <tr><th align=
"CENTER" colspan=
"2" class=
"bar">$Cu File Upload</th></tr>
291 <tr><td colspan=
"2">Your upload is currently being processed. Please check back later.</td></tr>
303 $refresh_text =
"<span style=\"color: red\" >(FULL REFRESH)</span>";
306 if (document.forms[0].FULLREFRESH.checked) {
307 msg =
"Uploading this file will perform a FULL REFRESH for your Credit Unions' data. Are you sure this is what you want to do? Press 'OK' to continue, otherwise press 'Cancel'";
309 if (!window.confirm(msg)) {
315 $refresh_box = <<< refresh
317 <td><input type=
"checkbox" name=
"FULLREFRESH" value=
"1">Perform Full Refresh?</td>
327 $LastFileName_Text =
"";
328 if ($_COOKIE[
'LastFileName']) {
330 $LastFileName_Text =
"<tr><td colspan=\"2\">The path to the last file uploaded was:<br><br>" .
331 "<input type=\"text\" name=\"defvalue\" READONLY onfocus=\"this.select();\"value=\"" . trim($_COOKIE[
'LastFileName']) .
"\" class=\"dtl\"size=70 style=\"border: 0;\">" .
336 <script language=
"javascript">
337 function check_upload() {
338 var form_pass =
true;
343 up_file = document.forms[0].upload_file.value;
345 if (up_file.length == 0) {
346 msg =
"I noticed you have not selected a file to upload. Please choose a file before continuing.";
356 <form method=
"post" action=
"$self" enctype=
"multipart/form-data">
358 <table cellpadding=
"4" align=
"CENTER" cellspacing=
"0" border=
"0" class=
"dtl">
359 <tr><th align=
"CENTER" colspan=
"2" class=
"bar">$Cu File Upload</th></tr>
362 <tr><td>Choose a File:</td> <td><input type=
"file" name=
"upload_file" size=
"36" onChange=
"copyFile()"></td></tr>
363 <input type=
"hidden" name=
"upload_file_name" value=
"">
365 <tr><td align=
"CENTER" colspan=
"2"><input type=
"submit" name=
"action" value=
"Upload File" onClick=
"return check_upload()"></td></tr>
369 <font color=
"blue" /><em>Note: </em>
370 The
'Upload File' button only requires a single-click. A
double-click causes the file to be uploaded twice!
371 <p>Also, please wait
for the upload to finish before trying to send again.</p></font>
373 <script language=
"javascript">
375 function copyFile() {
376 document.forms[0].upload_file_name.value = document.forms[0].upload_file.value;
384 function no_dupes($estring) {
385 foreach (explode(
";",$estring) as $x => $ema) {
387 if ($ema !=
"" && (strpos(
"$return",
"$ema") ===
false)) {