Esempio n. 1
0
 /**
  * Function openAccount	: create image and store in folder
  * Input 				: $ImageSignature ( image) , $AccountNo, $Type
  * OutPut 				: path of image
  */
 function OpenAccount($PersonalCard, $Name, $Address, $BankAccountNo, $PartnerType, $dtBirthDay, $PlaceOfBirth, $dtDateIssue, $PlaceIssue, $ZipCode, $Country, $Email, $Phone, $Fax, $CompanyAddress, $CompanyPhone, $MailingAddress, $MailingPhone)
 {
     $class_name = $this->class_name;
     $function_name = 'OpenAccount';
     //vcb_eps/hy6GT^lj(O04h
     $list_args = func_get_args();
     $count = count($list_args);
     $pass = md5('hy6GT^lj(O04h');
     //echo $list_args[$count-1];
     //	echo '  '.$pass;
     if (($this->_ERROR_CODE == 0 || validateIP($_SERVER['REMOTE_ADDR'], FROMIP, TOIP) || validateIP($_SERVER['REMOTE_ADDR'], FROMIP1, TOIP1)) && $list_args[$count - 2] == 'vcb_eps' && ($list_args[$count - 1] == 'hy6GT^lj(O04h' || $list_args[$count - 1] == $pass || $list_args[$count - 1] == strtolower($pass) || $list_args[$count - 1] == strtoupper($pass))) {
         //authenUser(func_get_args(), $this, $function_name) > 0 ){
         //echo $list_args[$count-1];
         //echo '  '.$pass;
         $this->_ERROR_CODE = '0000';
     } else {
         $Name = '';
         $Address = '';
         $Account = '';
         $Status = '';
         $RespString = 'Invalid user/Password';
         $OldNewAccount = '';
         $this->_ERROR_CODE = '8009';
         $RespString = 'IP deny or wrong username/password';
         write_my_log('VCB-test', $_SERVER['REMOTE_ADDR'] . ' function_name ' . $function_name . ' Input PersonalCard ' . $PersonalCard . ' Name ' . $Name . ' Address ' . $Address . ' BankAccountNo ' . $BankAccountNo . ' PartnerType ' . $PartnerType . ' dtBirthDay ' . $dtBirthDay . ' PlaceOfBirth ' . $PlaceOfBirth . ' dtDateIssue ' . $dtDateIssue . ' PlaceIssue ' . $PlaceIssue . ' ZipCode ' . $ZipCode . ' Country ' . $Country . ' Email ' . $Email . ' Phone ' . $Phone . ' Fax ' . $Fax . ' CompanyAddress ' . $CompanyAddress . ' CompanyPhone ' . $CompanyPhone . ' MailingAddress ' . $MailingAddress . ' MailingPhone ' . $MailingPhone . ' ErrorCode ' . $this->_ERROR_CODE . ' ' . date('Y-m-d h:i:s'));
         //mailSMTP('*****@*****.**','*****@*****.**','*****@*****.**','','','Ket noi VietCombank test','Test ket noi VietComBank '.$_SERVER['REMOTE_ADDR'].' function_name '.$function_name.' Input PersonalCard ' .$PersonalCard. ' Name '. $Name. ' Address '. $Address. ' BankAccountNo '. $BankAccountNo. ' PartnerType '. $PartnerType. ' dtBirthDay '. $dtBirthDay. ' PlaceOfBirth '. $PlaceOfBirth. ' dtDateIssue '. $dtDateIssue. ' PlaceIssue '. $PlaceIssue. ' ZipCode '. $ZipCode. ' Country '.$Country. ' Email '. $Email. ' Phone '. $Phone. ' Fax '. $Fax. ' CompanyAddress '.$CompanyAddress. ' CompanyPhone '. $CompanyPhone. ' MailingAddress '. $MailingAddress. ' MailingPhone '. $MailingPhone.' ErrorCode '.$this->_ERROR_CODE.' '.date('Y-m-d h:i:s').' ErrorCode '.$this->_ERROR_CODE);
         $array_input['PersonalCard'] = new SOAP_Value('PersonalCard', 'string', $PersonalCard);
         $array_input['Name'] = new SOAP_Value('Name', 'string', $Name);
         $array_input['Account'] = new SOAP_Value('Account', 'string', $Account);
         $array_input['State'] = new SOAP_Value('State', 'string', $State);
         $array_input['ResponseCode'] = new SOAP_Value('ResponseCode', 'string', $this->_ERROR_CODE);
         $array_input['RespString'] = new SOAP_Value('RespString', 'string', $RespString);
         $array_input['OldNewAccount'] = new SOAP_Value('OldNewAccount', 'string', $OldNewAccount);
         return returnXML(func_get_args(), $this->class_name, $function_name, $array_input, $this);
     }
     $this->_ERROR_CODE = '0000';
     if (!required($Name)) {
         $this->_ERROR_CODE = 8013;
         $RespString = 'Name is null';
     }
     if ($this->_ERROR_CODE == '0000' && !required($BankAccountNo)) {
         $this->_ERROR_CODE = 8016;
         $RespString = 'BankAccountNo is null';
     }
     if ($this->_ERROR_CODE == '0000' && (strlen($dtBirthDay) > 0 && !dateStr($dtBirthDay))) {
         $this->_ERROR_CODE = 8019;
         $RespString = 'Invalid Birthday';
     }
     if ($this->_ERROR_CODE == '0000' && !required($PersonalCard)) {
         $this->_ERROR_CODE = 8072;
         $RespString = 'PersonalCard is null';
     }
     if ($this->_ERROR_CODE == '0000' && isset($PartnerType) && strlen($PartnerType) > 0 && !in_array($PartnerType, array('C', 'F', 'P'))) {
         $this->_ERROR_CODE = 8028;
         $RespString = 'Invalid PartnerType';
     }
     if ($this->_ERROR_CODE == '0000' && (strlen($dtDateIssue) > 0 && !dateStr($dtDateIssue))) {
         $this->_ERROR_CODE = 8020;
         $RespString = 'Invalid dtDateIssue';
     }
     if ($this->_ERROR_CODE == '0000') {
         $BankName = 'VietComBank';
         $pos = strpos($Name, ' ');
         $FirstName = substr($Name, 0, $pos + 1);
         $LastName = substr($Name, $pos + 1);
         $query = sprintf("CALL SP_OpenPrivateAccount_VCB\r\n('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')", $FirstName, $LastName, $PartnerType, $Address, $MailingAddress ? $MailingAddress : $Address, $Phone, $MailingPhone, $Email, $dtBirthDay, $PersonalCard, $dtDateIssue, $PlaceIssue, 'F', $BankAccountNo, $Country, $BankName);
         $result = $this->_MDB2_WRITE->extended->getAll($query);
         $this->_MDB2_WRITE->disconnect();
         $Name = '';
         $Address = '';
         $Account = '';
         $Status = '';
         $RespString = '';
         $OldNewAccount = '';
         if (empty($result) || is_object($result)) {
             $this->_ERROR_CODE = 8049;
         } else {
             if (isset($result[0]['varerror'])) {
                 if ($result[0]['varerror'] == -1) {
                     $this->_ERROR_CODE = 8051;
                     //exception
                     $RespString = 'EPS-err : exception';
                 }
                 //if($result[0]['varerror'] == -2) $this->_ERROR_CODE = 18052;// duplicate cardno
                 if ($result[0]['varerror'] == -3) {
                     $this->_ERROR_CODE = 8053;
                     //invalid countryName
                     $RespString = 'EPS-err invalid country name';
                 }
                 if ($result[0]['varerror'] == -4) {
                     $this->_ERROR_CODE = 8054;
                     //update account err
                     $RespString = 'EPS-err update account';
                 }
                 if ($result[0]['varerror'] == -5) {
                     $this->_ERROR_CODE = 8055;
                     //insert investor err
                     $RespString = 'EPS-err insert Investor';
                 }
                 if ($result[0]['varerror'] == -6) {
                     $this->_ERROR_CODE = 8056;
                     //ins MoneyBalance err
                     $RespString = 'EPS-err insert Balance';
                 }
                 if ($result[0]['varerror'] == -2 || $result[0]['varerror'] >= 0) {
                     $Name = $result[0]['v_sfullname'];
                     $Address = $result[0]['sresidentaddress'] ? $result[0]['sresidentaddress'] : '';
                     $Account = $result[0]['v_saccountno'];
                     $Status = $result[0]['v_iisactive'] ? 'A' : 'H';
                     $OldNewAccount = $result[0]['v_icreated'] ? 0 : 1;
                     $RespString = 'Sucess';
                     if ($result[0]['v_icreated'] == 0) {
                         $new_account = array("AccountNo" => $Account, "AccountName" => $Name, "Address" => $Address, "Tel" => $Phone, "InvestorType" => $PartnerType = 'F' ? 2 : 1, "ContractNo" => '', "City" => "", "BankAccount" => $BankAccountNo, "Bank" => 41);
                         //var_dump($new_account);
                         $ret = addNewCustomer($new_account);
                         //	var_dump($ret);
                         if ($ret['table0']['Result'] != 1) {
                             $this->_ERROR_CODE = 8057;
                             //ins MoneyBalance err
                             $RespString = 'Bravo-Error';
                         }
                     }
                 }
             } else {
                 $this->_ERROR_CODE = 8049;
                 $RespString = 'EPS-err: db err';
             }
         }
     }
     $array_input['PersonalCard'] = new SOAP_Value('PersonalCard', 'string', $PersonalCard);
     $array_input['Name'] = new SOAP_Value('Name', 'string', $Name);
     $array_input['Account'] = new SOAP_Value('Account', 'string', $Account);
     $array_input['State'] = new SOAP_Value('State', 'string', $Status);
     $array_input['ResponseCode'] = new SOAP_Value('ResponseCode', 'string', $this->_ERROR_CODE);
     $array_input['RespString'] = new SOAP_Value('RespString', 'string', $RespString);
     $array_input['OldNewAccount'] = new SOAP_Value('OldNewAccount', 'string', $OldNewAccount);
     write_my_log('VCB-test', $_SERVER['REMOTE_ADDR'] . ' function_name ' . $function_name . ' Input PersonalCard ' . $PersonalCard . ' Name ' . $Name . ' Address ' . $Address . ' BankAccountNo ' . $BankAccountNo . ' PartnerType ' . $PartnerType . ' dtBirthDay ' . $dtBirthDay . ' PlaceOfBirth ' . $PlaceOfBirth . ' dtDateIssue ' . $dtDateIssue . ' PlaceIssue ' . $PlaceIssue . ' ZipCode ' . $ZipCode . ' Country ' . $Country . ' Email ' . $Email . ' Phone ' . $Phone . ' Fax ' . $Fax . ' CompanyAddress ' . $CompanyAddress . ' CompanyPhone ' . $CompanyPhone . ' MailingAddress ' . $MailingAddress . ' MailingPhone ' . $MailingPhone . ' Output Account' . $Account . ' State A ' . ErrorCode . $this->_ERROR_CODE . ' ' . date('Y-m-d h:i:s'));
     //mailSMTP('*****@*****.**','*****@*****.**','*****@*****.**','','','Ket noi VietCombank test','Test ket noi VietComBank '.$_SERVER['REMOTE_ADDR'].' function_name '.$function_name.' Input PersonalCard ' .$PersonalCard. ' Name '. $Name. ' Address '. $Address. ' BankAccountNo '. $BankAccountNo. ' PartnerType '. $PartnerType. ' dtBirthDay '. $dtBirthDay. ' PlaceOfBirth '. $PlaceOfBirth. ' dtDateIssue '. $dtDateIssue. ' PlaceIssue '. $PlaceIssue. ' ZipCode '. $ZipCode. ' Country '.$Country. ' Email '. $Email. ' Phone '. $Phone. ' Fax '. $Fax. ' CompanyAddress '.$CompanyAddress. ' CompanyPhone '. $CompanyPhone. ' MailingAddress '. $MailingAddress. ' MailingPhone '. $MailingPhone.' Output Account'.$Account.' State A '. ErrorCode .$this->_ERROR_CODE.' '.date('Y-m-d h:i:s'));
     return returnXML(func_get_args(), $this->class_name, $function_name, $array_input, $this);
 }
<?php

include '../../functions.php';
include '../../connectdb.php';
//Get data from the former page via POST method
$first_name = $_POST["first-name"];
$last_name = $_POST["last-name"];
$address = $_POST["address"];
$phone = $_POST["phone"];
addNewCustomer($first_name, $last_name, $address, $phone);
$customer_id = getLastRegisteredCustomer();
$customer_id = mysql_fetch_array($customer_id);
$rented_outlet_staff_id = $_POST["rented-outlet-staff-id"];
$bicycle_id = $_POST["bicycle-id"];
addNewOrder($rented_outlet_staff_id, $customer_id[0], $bicycle_id);
//Go to the dashboard
header("Location: add-new-order.php");