Odyssey
makecu.prg
1 <?php
2  $monLibrary= dirname(__FILE__) . "/../library";
3  require_once("$monLibrary/cu_top.i");
4  require_once("$monLibrary/ck_hticket.i");
5 
6 
7  if (!CheckPerm($link, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
8  // ** Permissions failed
9  // ** redirect to new page
10  header("Location: /hcuadm/hcu_noperm.prg");
11  exit;
12  }
13 
14 $dms_ok=array('Cu'=>'string','Cl'=>'string','cu_name'=>'string','Cv'=>'string','Cr'=>'string','Cs'=>'string');
15 
16 dms_import($dms_ok);
17 
18  cu_header("HomeCU - Credit Union Implementation");
19 // ** SET UP GENERAL INFORMATION for cuset
20  $cuset = "/usr/local/bin/cuset";
21 
22  // If the batch type is 'W', then always set vendor to WEBONLY
23  if ($Cl == 'W') {
24  $set_vend = "WEBONLY";
25  $opt_val = " -w";
26  $t_val = "W";
27  } else {
28  if ( $Cv == 'ST-BSDC' ||
29  $Cv == 'ST-DSOT' ||
30  $Cv == 'ST-GBS' ||
31  $Cv == 'ST-NDS' ) {
32  $set_vend = "SHARETEC";
33  } else {
34  $set_vend = $Cv;
35  }
36  $opt_val = "";
37  $t_val = ($Cl == "L" ? "L" : "B");
38  }
39 
40 
41 print "<LINK REL=stylesheet HREF='/monitor/css/monitor.css' TYPE='text/css'>
42 <form>
43 <center>
44 <table width='500' border=0 cellpadding=3 cellspacing=0 class='dmsbg'>
45 <tr><td>
46 <table width='100%' border=0 cellpadding=2 cellspacing=0 bgcolor='white'>
47  <tr>
48  <td colspan=2 class='bar' align='center'>
49  <font size='5'>Create Credit Union User</font>
50  </td>
51  </tr>
52  <tr>
53  <td align=right width='30%' class='hdr'>
54  CU User Name:
55  </td>
56  <td width='70%' class='dtl'>" .
57  htmlspecialchars(trim($Cu)) .
58  "</td>
59  </tr>
60  <tr>
61  <td align=right width='30%' class='hdr'>
62  Name:
63  </td>
64  <td width='70%' class='dtl'>" .
65  htmlspecialchars(trim($cu_name)) .
66  "</td>
67  </tr>";
68  $err = "";
69  // Check for the creation of the credit union already,
70  // If the home directory exists on this server, OR
71  // the record exists in this cuadmin table, then
72 
73  if (!isset($cu_name) || strlen($cu_name) == 0) {
74  $err .= "<li>The name of the credit union code. Be sure the information was saved.<br>";
75  }
76  if (!isset($Cu) || strlen($Cu) == 0) {
77  $err .= "<li>The credit union code is missing. Be sure the information was saved.<br>";
78  }
79  if (!isset($Cl) || strlen($Cl) == 0) {
80  $err .= "<li>The credit union CU Type is missing. Be sure the information was saved.<br>";
81  }
82  if (!isset($Cv) || strlen($Cv) == 0) {
83  $err .= "<li>The credit union vendor is missing. Be sure the information was saved.<br>";
84  } else {
85  if ($Cl == 'B') {
86  // ** Validate the Vendor has a .pi file
87  // *** Use set_vend as this script will be adjusted for Sharetec and webonly $vend_file = "/home/cuskel/bin/{$Cv}.pi";
88  $vend_file = "/home/cuskel/bin/{$set_vend}.pi";
89  if (!is_file($vend_file)){
90  // The file was not found, report this error so they no that it still needs to be setup
91  $err .= "<li>The vendor does not have an upload script. One must be created before this credit union can be used.<br>";
92  }
93  }
94  }
95  $sql = "SELECT cu, user_name
96  FROM cuadmin
97  WHERE user_name = '" . prep_save($Cu) . "' ";
98 
99  $cu_rs = db_query($sql, $link);
100  if ($cu_row = db_fetch_array($cu_rs, 0)) {
101  // Only fetch the first row
102  // There is already a record
103  $err .= "<li>The credit union {$Cu} already has a record in the credit union table.<br>";
104  } else {
105  // There was no record, so this is good,
106  // Now we want to take the current home directory and see if it exists
107  $cu_home_dir = "/home/{$Cu}";
108  if (is_dir($cu_home_dir)) {
109  // the directory exists, report an error here
110  $err .= "<li>The credit union {$Cu} already has a home directory.<br>";
111  }
112  }
113  db_free_result($cu_rs);
114 
115  if (strlen($err) > 0) {
116  $err = "The credit union you selected can not be setup at this time.<br>
117  This is the reason it can not be setup.<br>$err<br><br>
118  Please see the Credit Union Admininstrator if this information is incorrect.<br>
119  Thank you for using this utility<br><br>
120  <a href='$infourl/hcuadm/imp_menu.prg'>Return to the Implementation Menu</a>";
121  print "<tr>
122  <td colspan='2' align='center' class='err'>$err
123  </td>
124  </tr>";
125 
126 
127  } else {
128  $field_val = "";
129  switch($Cl) {
130  case "B":
131  $field_val = "Batch";
132  break;
133  case "L":
134  $field_val = "Live";
135  break;
136  case "W":
137  $field_val = "Web ONLY";
138  break;
139  case "I":
140  $field_val = "IVR";
141  break;
142  default:
143  $field_val = "UNKNOWN";
144  break;
145  }
146  print "<tr>
147  <td align=right class='hdr'>
148  Home CU Type:
149  </td>
150  <td class='dtl'>
151  $field_val
152  </td>
153  </tr>
154  <tr><td align=right class='hdr'>Home Page URL: </td>
155  <td class='dtl'>" .
156  htmlspecialchars(trim($Cr)) .
157  "</td>
158  </tr>
159  <tr><td align=right class='hdr'>Vendor: </td>
160  <td class='dtl'>" .
161  htmlspecialchars(trim($Cv)) .
162  "</td>
163  </tr>
164  <tr>
165  <td colspan='2' class='ahd'>
166  Login into the server <b> {$Cs} </b>
167  <br>
168  You will need to be root to setup the credit union.
169  <br>
170  This is the command to setup credit union <b> {$Cu} </b>
171 <br><br><nobr>";
172 
173  $domain = $Cr;
174  $domain = preg_replace("/^http[s]?:\/\//i","",$domain);
175  $domain = preg_replace("/^www./i","",$domain);
176  $domain = trim($domain);
177 
178  $param = " -u {$Cu} -n \"" . $cu_name . "\"" ;
179  if ($domain > '') {
180  $param .= " -d $domain";
181  }
182  $param .= " -v $set_vend"
183  . " -t $t_val"
184  . $opt_val;
185 
186  $command = $cuset . " " . $param;
187  print "$command
188  </nobr></td>
189  </tr>
190  <tr>
191  <td colspan='2'>
192  <a href='$infourl/hcuadm/imp_menu.prg'>Return to Implementation Menu</a><br>
193  <a href='$infourl/hcuadm/imp_main.prg?cuid={$Cu}'>Return to information on {$Cu} </td></tr>";
194  }
195 print "</table>
196  </td></tr></table>
197  </form>
198  </body>
199  </html>";
200 ?>