Commit 2b6c3110 authored by Antonio.Suerte's avatar Antonio.Suerte

Domain Whitelisting Feature

parent f912d780
<?php <?php
include_once('../system/lib/config.php'); include_once('../system/lib/config.php');
$sys = new System();
// 変数宣言部
$rtn = array();
$params = array();
$rsStatus = NO_STRING;
$result = NO_STRING;
$ip = NO_STRING;
$referer = NO_STRING;
// POSTデータ
$pNum = $sys -> getDataPost('p_num');
$amount = $sys -> getDataPost('amount');
$fromAccount = $sys -> getDataPost('from_account');
$toAccount = $sys -> getDataPost('to_account');
$debitCurrency = $sys -> getDataPost('debit_currency');
$currency = $sys -> getDataPost('currency');
$message = $sys -> getDataPost('message');
$signature = $sys -> getDataPost('signature');
$debitAmount = NO_COUNT;
// 取得データの生成
if(isset($_SERVER['REMOTE_ADDR'])) {
$ip = $_SERVER['REMOTE_ADDR'];
}
if(isset($_SERVER['HTTP_REFERER'])) {
$referer = $_SERVER['HTTP_REFERER'];
}
$post = http_build_query($_POST, '', '&');
// APIチェック用データ class MoneyRequest extends System {
// シグネチャ生成用のデータを取得する
$row = $sys -> getRowData($sys -> accessSelect('SELECT_API_SIGNATURE_BY_A_ID', array($pNum))); /**
$apiPassword = $sys -> getColumnData($row, COLUMN_PASSWORD); *
$apiUserAccount = $sys -> getColumnData($row, COLUMN_USER_ACCOUNT); * @var string
*/
private $pnum = NO_STRING;
/**
*
* @var string
*/
private $amount = NO_COUNT;
/**
*
* @var string
*/
private $debitAmount = NO_COUNT;
/**
*
* @var string
*/
private $fromAccount = NO_STRING;
/**
*
* @var string
*/
private $toAccount = NO_STRING;
/**
*
* @var string
*/
private $debitCurrency = NO_STRING;
/**
*
* @var string
*/
private $currency = NO_STRING;
/**
*
* @var string
*/
private $signature = NO_STRING;
/**
*
* @var string
*/
private $message = NO_STRING;
// header-filled params
/**
*
* @var string
*/
private $ip = NO_STRING;
/**
*
* @var string
*/
private $referer = NO_STRING;
// end-of-header-filled-params
/**
*
* @var boolean
*/
private $proceedToRemittanceRequest = false;
/**
*
* @var array
*/
private $result = [];
/**
*
* @var array
*/
private $ctransfer = [];
// Case-to-case basis variables
/**
*
* @var string
*/
private $transactionNum = NO_STRING;
/**
*
* @var string
*/
private $toFee = NO_COUNT;
// end-of-case-to-case-basis-variables
public function __construct(){
parent::__construct();
$this -> setParameter();
$this -> validate();
}
private function setParameter(){
$this -> pnum = $this -> getDataPost("p_num");
$this -> amount = $this -> getDataPost('amount');
$this -> fromAccount = $this -> getDataPost('from_account');
$this -> toAccount = $this -> getDataPost('to_account');
$this -> debitCurrency = $this -> getDataPost('debit_currency');
$this -> currency = $this -> getDataPost('currency');
$this -> message = $this -> getDataPost('message');
$this -> signature = $this -> getDataPost('signature');
$this -> ip = $this -> getColumnData($_SERVER, "REMOTE_ADDR");
$this -> referer = $this -> getColumnData($_SERVER, "HTTP_REFERER");
}
public function validate(){
$userAgent = $this -> getColumnData($_SERVER, "HTTP_USER_AGENT");
$checkPassword = $apiUserAccount $whitelisitingValidationPassed = true;
. $apiPassword
. $pNum
. $amount;
$sha = hash('sha256', $checkPassword); // first layer of validation (Whitelisted IP Address)
$isIpInRemittanceDisabled = false;
// POSTのログを取る // second layer of validation (Whitelisted Domains)
$sys -> logPost(); $isDomainInRemittanceDisabled = false;
//check if request is sent to self if($userAgent){
if(($fromAccount != "" && $toAccount != "") && ($fromAccount == $toAccount)){ // this condition will be considered if this was triggered in browser
$rsStatus = 'REJECTED'; if(!$this -> checkSettlementIpAddress($this -> pnum, "allow_ip_in_remittance", $isIpInRemittanceDisabled)){
if(!$isIpInRemittanceDisabled)
$whitelisitingValidationPassed = false;
}
// 返却値生成 if(!$this -> checkSettlementDomain($this -> pnum, "allow_domain_in_remittance", $isDomainInRemittanceDisabled)){
$rtn[PARAM_RESULT] = sprintf('%02d', VAL_INT_93); if(!$isDomainInRemittanceDisabled)
$rtn[PARAM_STATUS] = $rsStatus; $whitelisitingValidationPassed = false;
} }
else{ }else{
if($sys -> checkSettlementIpAddress($pNum)) { // to insist the mandatory checking of IP in case it's triggered using server-to-server processing.
// シグネチャとコチラのデータが一致したら、処理続行 if(!$this -> checkSettlementIpAddress($this -> pnum, "mandatory", $isIpInRemittanceDisabled)){
if($signature == $sha) { if(!$isIpInRemittanceDisabled)
$whitelisitingValidationPassed = false;
}
}
if($whitelisitingValidationPassed){
if(($this -> fromAccount != NO_STRING && $this -> toAccount != NO_STRING)
&& ($this -> fromAccount == $this -> toAccount)){
$this -> result[PARAM_RESULT] = sprintf('%02d', VAL_INT_93);
$this -> result[PARAM_STATUS] = "REJECTED";
}else{
// APIチェック用データ
// シグネチャ生成用のデータを取得する
$row = $this -> getRowData($this -> accessSelect("SELECT_API_SIGNATURE_BY_A_ID", array($this -> pnum)));
$apiPassword = $this -> getColumnData($row, COLUMN_PASSWORD);
$apiUserAccount = $this -> getColumnData($row, COLUMN_USER_ACCOUNT);
$checkSignature = $apiUserAccount
.$apiPassword
.$this -> pnum
.$this -> amount;
$sha = hash("sha256", $checkSignature);
if($this -> signature != $sha){
$this -> result[PARAM_RESULT] = sprintf("%02d", VAL_INT_90);
$this -> result[PARAM_STATUS] = "REJECTED";
}else{
$this -> ctransfer = $this -> checkTransfer(
$this -> fromAccount,
$this -> toAccount,
$this -> currency,
$this -> amount,
$this -> debitCurrency);
if($this -> ctransfer[PARAM_RESULT] == NO_COUNT){
$this -> proceedToRemittanceRequest = true;
}else{
$format = sprintf("%02d", $this -> ctransfer[PARAM_RESULT]);
$this -> result[PARAM_RESULT] = sprintf("%02d", $this -> result[PARAM_RESULT]);
$this -> result[PARAM_STATUS] = "ERROR(CODE:{$format})";
}
}
}
}else{
$this -> result[PARAM_RESULT] = sprintf("%02d", VAL_INT_92);
$this -> result[PARAM_STATUS] = "REJECTED";
}
// 各パラメータのチェックを行う $this -> logPost();
$result = $sys -> checkTransfer($fromAccount }
, $toAccount
, $currency
, $amount
, $debitCurrency);
if($result[PARAM_RESULT] == NO_COUNT) { private function getTransactionalParams(){
$debitAmount = $sys -> getColumnData($result, PARAM_AMOUNT); $this -> debitAmount = $this -> getColumnData($this -> ctransfer, PARAM_AMOUNT);
// 取引番号の生成 // 取引番号の生成
$transactionNum = $sys -> getTransactionNumberCommon(VAR_TRANSACTION_TRANSFER_DEPOSIT); $this -> transactionNum = $this -> getTransactionNumberCommon(VAR_TRANSACTION_TRANSFER_DEPOSIT);
//to fee //to fee
$toFee = $sys -> currencyToInt($sys -> getColumnData($result, PARAM_TO_FEE), $currency); $this -> toFee = $this -> currencyToInt($this -> getColumnData($this -> ctransfer, PARAM_TO_FEE), $this -> currency);
$params = [];
// 送金実行 // 送金実行
$params[] = $fromAccount; // 送金元口座番号 $params[] = $this -> fromAccount; // 送金元口座番号
$params[] = $fromAccount; // 送金元口座番号 $params[] = $this -> fromAccount; // 送金元口座番号
$params[] = $debitCurrency; // 送金通貨 $params[] = $this -> debitCurrency; // 送金通貨
$params[] = $sys -> currencyToInt($sys -> getColumnData($result, PARAM_FROM_FEE), $debitCurrency); // 口座元手数料 $params[] = $this -> currencyToInt($this -> getColumnData($this -> ctransfer, PARAM_FROM_FEE), $this -> debitCurrency); // 口座元手数料
$params[] = $toAccount; // 送金先口座番号 $params[] = $this -> toAccount; // 送金先口座番号
$params[] = $currency; // 送金元通貨 $params[] = $this -> currency; // 送金元通貨
$params[] = $toFee; // 送金先手数料 $params[] = $this -> fee; // 送金先手数料
$params[] = $amount; // 入力金額 $params[] = $this -> amount; // 入力金額
$params[] = NO_COUNT; // 送金方法 $params[] = NO_COUNT; // 送金方法
$params[] = $message; // メッセージ $params[] = $this -> message; // メッセージ
$params[] = $debitCurrency; // 出金通貨 $params[] = $this -> debitCurrency; // 出金通貨
$params[] = $sys -> currencyToInt($debitAmount, $debitCurrency); // 出金金額 $params[] = $this -> currencyToInt($this -> debitAmount, $this -> debitCurrency); // 出金金額
$params[] = $currency; // 送金通貨 $params[] = $this -> currency; // 送金通貨
$params[] = $sys -> currencyToInt($amount, $currency); // 送金金額 $params[] = $this -> currencyToInt($this -> amount, $this -> currency); // 送金金額
$params[] = $sys -> getColumnData($result, PARAM_RATE); // レート $params[] = $this -> getColumnData($this -> ctransfer, PARAM_RATE); // レート
$params[] = NO_COUNT; // 処理種別 $params[] = NO_COUNT; // 処理種別
$params[] = NO_STRING; // 管理者ID $params[] = NO_STRING; // 管理者ID
$params[] = VAL_INT_2; // 処理ステータス $params[] = VAL_INT_2; // 処理ステータス
$params[] = $transactionNum; // 取引番号 $params[] = $this -> transactionNum; // 取引番号
$params[] = date("Y-m-d H:i:s"); // 取引番号 $params[] = date("Y-m-d H:i:s");
$res = $sys -> accessModify('INSERT_TRANSFER', $params, false);
if(!$res){
$rsStatus = 'REJECTED';
// 返却値生成
$rtn[PARAM_RESULT] = sprintf('%02d', VAL_INT_99);
$rtn[PARAM_STATUS] = $rsStatus;
echo json_encode($rtn);
// 登録用パラメータ
$sys -> accessModifyCommon('INSERT_LOG_POST', array($ip,$referer,'[INSERT_DB_ERR]'.json_encode($params)));
exit();
} else {
// 登録用パラメータ
$sys -> accessModifyCommon('INSERT_LOG_POST', array($ip,$referer,'[INSERT_DB]'.json_encode($params)));
//send email to reciever
$emailParams = array();
$emailParams = getSendDataTo($fromAccount, $toAccount, $toFee, $amount, $currency, $debitCurrency, $message, $transactionNum);
$toAccountData = $sys -> getAccountCommon($toAccount);
$language = $sys -> getColumnData($sys -> getRowData($toAccountData), COLUMN_USE_LANGUAGE);
$sys -> sendMailByTmp($language.DIRECTORY_SEPARATOR.'transfer_receive_user.xml'
, $emailParams
, $emailParams[VAL_INT_11]
, VAR_CS_MAIL_ADDRESS);
}
// 通貨が違う場合は、為替コミッションの発生
if($debitCurrency != $currency) {
// 着金額指定の場合 return $params;
$sys -> registCommisionExchange($fromAccount
, $currency
, $debitCurrency
, $sys -> currencyToInt($debitAmount, $debitCurrency));
} }
// echo $fromAccount . ' : ' . $debitCurrency . ' : ' . $sys -> getColumnData($result, PARAM_FROM_FEE) . '<br/>'; private function getFullNameString(Array $rowData){
// echo $toAccount . ' : ' . $currencyromAccount . ' : ' . $sys -> getColumnData($result, PARAM_TO_FEE) . '<br/>'; if($this -> isLoopData($rowData)){
return
// コミッションの集計(送金元) $this -> getColumnData($rowData, COLUMN_FIRST_NAME)
$sys -> registCommision(VAR_TRANSFER .DELIMIT_SPACE
, null .$this -> getColumnData($rowData, COLUMN_LAST_NAME);
, $fromAccount }
, $debitCurrency
, $sys -> getColumnData($result, PARAM_FROM_FEE));
// コミッションの集計(送金先)
$sys -> registCommision(VAR_TRANSFER
, null
, $toAccount
, $currency
, $sys -> getColumnData($result, PARAM_TO_FEE)
, PARAM_TO);
$rsStatus = 'OK';
// 返却値生成(成功時)
$rtn[PARAM_RESULT] = sprintf('%02d', NO_COUNT);
$rtn[PARAM_STATUS] = $rsStatus;
$rtn[PARAM_TRANSACTION_NUMBER] = $transactionNum;
$rtn[PARAM_CURRENCY] = $debitCurrency;
$rtn[PARAM_AMOUNT] = $debitAmount;
$rtn[PARAM_FEE] = $sys -> getColumnData($result, PARAM_FROM_FEE);
// will include account # within API callback - anton
$rtn[PARAM_FROM_ACCOUNT] = $fromAccount;
$rtn[PARAM_TO_ACCOUNT] = $toAccount;
} else {
$rsStatus = 'ERROR(CODE:' . sprintf('%02d', $result[PARAM_RESULT]) . ')';
// 返却値生成 return NO_STRING;
$rtn[PARAM_RESULT] = sprintf('%02d', $result[PARAM_RESULT]);
$rtn[PARAM_STATUS] = $rsStatus;
} }
} else {
$rsStatus = 'REJECTED';
// 返却値生成 private function getSendDataParams() {
$rtn[PARAM_RESULT] = sprintf('%02d', VAL_INT_90); $rtn = [];
$rtn[PARAM_STATUS] = $rsStatus;
$row1 = $this -> getRowData($this -> getAccountCommon($this -> fromAccount));
$row2 = $this -> getRowData($this -> getAccountCommon($this -> toAccount));
$rtn[] = $this -> fromAccount; // ユーザ口座番号
$rtn[] = $this -> getFullNameString($row2); // ユーザ名
$rtn[] = $this -> getUserData(PARAM_USER_ACCOUNT); // 送金先口座番号
$rtn[] = $this -> getFullNameString($row1); // ユーザ名(送金元)
$rtn[] = $this -> getCurrentTimeCommon(); // 現在時刻
$rtn[] = $this -> currency; // 通貨
$rtn[] = $this -> formatCurrency($this -> amount, $this -> currency); // 金額
$rtn[] = $this -> debitCurrency; // 手数料通貨
$rtn[] = $this -> formatCurrency($this -> toFee, $this -> currency); // 手数料
$rtn[] = $this -> message; // メッセージ
$rtn[] = $this -> transactionNum; // 取引番号
$rtn[] = $this -> getColumnData($row2, COLUMN_MAIL); // メールアドレス
return $rtn;
} }
} else {
$rsStatus = 'REJECTED';
// 返却値生成 private function printCallbackResult(){
$rtn[PARAM_RESULT] = sprintf('%02d', VAL_INT_92); $this -> accessModifyCommon('INSERT_LOG_POST',
$rtn[PARAM_STATUS] = $rsStatus; [
$this -> ip,
$this -> referer,
'[REMITTANCE_CALLBACK_RESULT]'.json_encode($this -> result)
]);
echo json_encode($this -> result);
} }
}
// 登録用パラメータ public function listen(){
$sys -> accessModifyCommon('INSERT_LOG_POST', array($ip,$referer,'[SUCCESSFUL]'.json_encode($rtn))); if($this -> proceedToRemittanceRequest){
echo json_encode($rtn); $params = $this -> getTransactionalParams();
//**************************FUNCTIONS****************************************//
/*-------------------------------------------------------------------------
* @function_name: メール送信用のデータを取得(送金先ユーザ)
* @parameter : なし
* @return : メール送信用データ
-------------------------------------------------------------------------*/
function getSendDataTo($fromAccount, $toAccount, $toFee, $amount, $currency, $debitCurrency, $message, $transactionNum) {
global $sys;
// 変数宣言部
$rtn = array();
$data = $sys -> getAccountCommon($fromAccount);
$row = $sys -> getRowData($data);
$data2 = $sys -> getAccountCommon($toAccount);
$row2 = $sys -> getRowData($data2);
$rtn[] = $fromAccount; // ユーザ口座番号
$rtn[] = $sys -> getColumnData($row2, COLUMN_FIRST_NAME)
. DELIMIT_SPACE . $sys -> getColumnData($row2, COLUMN_LAST_NAME); // ユーザ名
$rtn[] = $sys -> getUserData(PARAM_USER_ACCOUNT); // 送金先口座番号
$rtn[] = $sys -> getColumnData($row, COLUMN_FIRST_NAME)
. DELIMIT_SPACE . $sys -> getColumnData($row, COLUMN_LAST_NAME); // ユーザ名(送金元)
$rtn[] = $sys -> getCurrentTimeCommon(); // 現在時刻
$rtn[] = $currency; // 通貨
$rtn[] = $sys -> formatCurrency($amount, $currency); // 金額
$rtn[] = $debitCurrency; // 手数料通貨
$rtn[] = $sys -> formatCurrency($toFee, $currency); // 手数料
$rtn[] = $message; // メッセージ
$rtn[] = $transactionNum; // 取引番号
$rtn[] = $sys -> getColumnData($row2, COLUMN_MAIL); // メールアドレス
return $rtn; $insertNewTransfer = $this -> accessModify('INSERT_TRANSFER', $params, false);
}
if($insertNewTransfer){
$encodedParams = json_encode($params);
/* $this -> accessModifyCommon('INSERT_LOG_POST', [
// コールバック $this -> ip,
$data = array('MerchantTransactionId' => $fromAccount $this -> referer,
, 'Result' => $rsStatus "[INSERT_DB]{$encodedParams}"
); ]);
$data = http_build_query($data, '', '&'); $transactionNum = $params[VAL_INT_18];
$header = array( // send email to receiver
"Content-Type: application/x-www-form-urlencoded", $emailParams = $this -> getSendDataParams();
"Content-Length: ".strlen($data)
);
$opts = array( $toAccountData = $this -> getAccountCommon($this -> toAccount);
'http' =>array('method' => 'POST' $language = $this -> getColumnData($this -> getRowData($toAccountData), COLUMN_USE_LANGUAGE);
, 'header' => implode("\r\n", $header)
, 'content' => $data
)
);
$context = stream_context_create($opts); $this -> sendMailByTmp($language.DIRECTORY_SEPARATOR.'transfer_receive_user.xml'
, $emailParams
, $emailParams[VAL_INT_11]
, VAR_CS_MAIL_ADDRESS);
if($callbackUrl == NO_STRING) { // 通貨が違う場合は、為替コミッションの発生
echo 'OK'; if($this -> debitCurrency != $this -> currency) {
} else {
$file = file_get_contents($callbackUrl, false, $context);
}
// 着金額指定の場合
$this -> registCommisionExchange($this -> fromAccount
, $this -> currency
, $this -> debitCurrency
, $this -> currencyToInt($this -> debitAmount, $this -> debitCurrency));
}
// コミッションの集計(送金元)
$this -> registCommision(VAR_TRANSFER
, null
, $this -> fromAccount
, $this -> debitCurrency
, $this -> getColumnData($this -> ctransfer, PARAM_FROM_FEE));
// 最終の遷移 // コミッションの集計(送金先)
if($rsStatus == 'OK') { // 処理成功時 $this -> registCommision(VAR_TRANSFER
, null
, $this -> toAccount
, $this -> currency
, $this -> getColumnData($this -> ctransfer, PARAM_TO_FEE)
, PARAM_TO);
if($successUrl == NO_STRING) { $this -> result[PARAM_RESULT] = sprintf("%02d", NO_COUNT);
echo $rsStatus; $this -> result[PARAM_STATUS] = "OK";
} else { $this -> result[PARAM_TRANSACTION_NUMBER] = $transactionNum;
header('Location: ' . $successUrl); $this -> result[PARAM_CURRENCY] = $this -> debitCurrency;
$this -> result[PARAM_AMOUNT] = $this -> debitAmount;
$this -> result[PARAM_FEE] = $this -> getColumnData($this -> ctransfer, PARAM_FROM_FEE);
// this brings back memories - anton (2021)
$this -> result[PARAM_FROM_ACCOUNT] = $this -> fromAccount;
$this -> result[PARAM_TO_ACCOUNT] = $this -> toAccount;
}else{
$this -> result[PARAM_RESULT] = sprintf("%02d", VAL_INT_99);
$this -> result[PARAM_STATUS] = "REJECTED";
$this -> accessModifyCommon("INSERT_LOG_POST",
[
$this -> ip,
$this -> referer,
'[INSERT_DB_ERR]'.json_encode($params)
]);
} }
} else if($rsStatus = 'ERROR') { // エラー時
if($errorUrl == NO_STRING) {
echo $rsStatus;
} else {
header('Location: ' . $errorUrl);
} }
} else if($rsStatus = 'REJECTED') {
if($rejectUrl == NO_STRING) { $this -> printCallbackResult();
echo $rsStatus;
} else {
header('Location: ' . $rejectUrl);
} }
} }
*/
?> $request = new MoneyRequest();
$request -> listen();
\ No newline at end of file
<?php <?php
require_once(SITE_LOGICS . 'settlement/config.php'); require_once(SITE_LOGICS . 'settlement/config.php');
class SettlementModelClass extends ModelClassEx { class SettlementModelClass extends ModelClassEx {
...@@ -238,11 +238,23 @@ class SettlementModelClass extends ModelClassEx { ...@@ -238,11 +238,23 @@ class SettlementModelClass extends ModelClassEx {
return false; return false;
} }
$domWhitelistedDisabled = false;
// APIの確認 // APIの確認
if(!$this -> checkSettlementIpAddress($this -> pNum)) { if(!$this -> checkSettlementDomain($this -> pNum, "allow_domain_in_payment", $domWhitelistedDisabled)){
if(!$domWhitelistedDisabled){
$this -> popUpSessionMessage(ERROR, 'E_ERROR_DOMAIN', array());
$rtn = false;
}
}
$ipWhitelistDisabled = false;
// APIの確認
if(!$this -> checkSettlementIpAddress($this -> pNum, "allow_ip_in_payment", $ipWhitelistDisabled)) {
if(!$ipWhitelistDisabled){
$this -> popUpSessionMessage(ERROR, 'E_ERROR_IP_ADDRESS', array()); $this -> popUpSessionMessage(ERROR, 'E_ERROR_IP_ADDRESS', array());
$rtn = false; $rtn = false;
} }
}
// シグネチャのチェック // シグネチャのチェック
if(!$this -> checkSettlementSignature($this -> pNum if(!$this -> checkSettlementSignature($this -> pNum
...@@ -588,7 +600,7 @@ class SettlementModelClass extends ModelClassEx { ...@@ -588,7 +600,7 @@ class SettlementModelClass extends ModelClassEx {
} }
function getAgentCodeURL(){ function getAgentCodeURL(){
$baseUrl = 'https://secure.'.SITE_DOMAIN.'/'. $this -> getLangage() .'/register'; $baseUrl = 'https://'.SITE_DOMAIN_FULL.'/'. $this -> getLangage() .'/register';
if(!empty($this -> pNum)){ if(!empty($this -> pNum)){
$rowData = $this -> getRowData($this -> accessSelect('SELECT_AGENT_CODE_BY_AID', array($this -> pNum))); $rowData = $this -> getRowData($this -> accessSelect('SELECT_AGENT_CODE_BY_AID', array($this -> pNum)));
$AgentCode = $this -> getColumnData($rowData, COLUMN_AGENT_CODE); $AgentCode = $this -> getColumnData($rowData, COLUMN_AGENT_CODE);
......
...@@ -31,9 +31,7 @@ include_once('template/base_head.php'); ...@@ -31,9 +31,7 @@ include_once('template/base_head.php');
</tr> </tr>
<tr> <tr>
<th>Name</th> <th>Name</th>
<td> <td><?php $this -> echoLastName(); ?> <?php $this -> echoFirstName(); ?></td>
<?php $this -> echoLastName(); ?> <?php $this -> echoFirstName(); ?>
</td>
</tr> </tr>
<tr> <tr>
<th>API Signature</th> <th>API Signature</th>
...@@ -47,6 +45,14 @@ include_once('template/base_head.php'); ...@@ -47,6 +45,14 @@ include_once('template/base_head.php');
<th>IP Address</th> <th>IP Address</th>
<td><?php $this -> echoIpAddress(); ?></td> <td><?php $this -> echoIpAddress(); ?></td>
</tr> </tr>
<tr>
<th>Domain Name</th>
<td><?php $this -> echoDomainName(); ?></td>
</tr>
<tr>
<th>Validation Settings</th>
<td><?php $this -> echoWhitelistSettingsCheckboxes(true); ?></td>
</tr>
</table> </table>
<input type="hidden" value="action" id="type" name="type" /> <input type="hidden" value="action" id="type" name="type" />
...@@ -54,6 +60,7 @@ include_once('template/base_head.php'); ...@@ -54,6 +60,7 @@ include_once('template/base_head.php');
<input type="hidden" value="<?php $this -> echoUserName(); ?>" id="user_name" name="user_name" /> <input type="hidden" value="<?php $this -> echoUserName(); ?>" id="user_name" name="user_name" />
<input type="hidden" value="<?php $this -> echoPassword(); ?>" id="password" name="password" /> <input type="hidden" value="<?php $this -> echoPassword(); ?>" id="password" name="password" />
<input type="hidden" value="<?php $this -> echoIpAddress(); ?>" id="ip_address" name="ip_address" /> <input type="hidden" value="<?php $this -> echoIpAddress(); ?>" id="ip_address" name="ip_address" />
<input type="hidden" value="<?php $this -> echoDomainName(); ?>" id="domain_name" name="domain_name" />
<!-- Language Transition Data (Anton) 04/23/2016 --> <!-- Language Transition Data (Anton) 04/23/2016 -->
<input class="lang-trans-data" type="hidden" id="lang_data_action" value="/api_signature"/> <input class="lang-trans-data" type="hidden" id="lang_data_action" value="/api_signature"/>
......
...@@ -52,7 +52,19 @@ include_once('template/base_head.php'); ...@@ -52,7 +52,19 @@ include_once('template/base_head.php');
<tr> <tr>
<th>IP Address</th> <th>IP Address</th>
<td> <td>
<input type="text" id="ip_address" name="ip_address" value="<?php $this -> echoIpAddress(); ?>" class="w30p"> <textarea id="ip_address" name="ip_address" rows="10" cols="50"><?php $this -> echoIpAddress(); ?></textarea>
</td>
</tr>
<tr>
<th>Domain Name</th>
<td>
<textarea id="domain_name" name="domain_name" rows="10" cols="50"><?php $this -> echoDomainName(); ?></textarea>
</td>
</tr>
<tr>
<th>Validation Settings</th>
<td>
<?php $this -> echoWhitelistSettingsCheckboxes(); ?>
</td> </td>
</tr> </tr>
</table> </table>
......
...@@ -53,7 +53,19 @@ include_once('template/base_head.php'); ...@@ -53,7 +53,19 @@ include_once('template/base_head.php');
<tr> <tr>
<th>IP Address</th> <th>IP Address</th>
<td> <td>
<input type="text" id="ip_address" name="ip_address" value="<?php $this -> echoIpAddress(); ?>" class="w30p"> <textarea id="ip_address" name="ip_address" rows="10" cols="50"><?php $this -> echoIpAddress(); ?></textarea>
</td>
</tr>
<tr>
<th>Domain Name</th>
<td>
<textarea id="domain_name" name="domain_name" rows="10" cols="50"><?php $this -> echoDomainName(); ?></textarea>
</td>
</tr>
<tr>
<th>Validation Settings</th>
<td>
<?php $this -> echoWhitelistSettingsCheckboxes(); ?>
</td> </td>
</tr> </tr>
</table> </table>
......
...@@ -17,6 +17,7 @@ $(function() { ...@@ -17,6 +17,7 @@ $(function() {
}); });
$('#btnComplete').click(function() { $('#btnComplete').click(function() {
$(".wl-set-cbox").prop("disabled", false)
$('#type').val('complete'); $('#type').val('complete');
submitForm(); submitForm();
}); });
...@@ -56,6 +57,12 @@ function actionDelete(){ ...@@ -56,6 +57,12 @@ function actionDelete(){
} }
function actionInput(){
$(".wl-set-cbox").prop("disabled", false)
$('#type').val('input');
submitForm();
}
/** /**
* データ修正 * データ修正
*/ */
......
...@@ -1469,17 +1469,14 @@ class Checker extends Chiket { ...@@ -1469,17 +1469,14 @@ class Checker extends Chiket {
* @parameter : 番組コード * @parameter : 番組コード
* @return : 成功:TRUE、失敗:FALSE * @return : 成功:TRUE、失敗:FALSE
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
function checkSettlementIpAddress($pnum) { function checkSettlementIpAddress($pnum, $validationProperty, &$isDisabled = false) {
// 変数宣言部 // 変数宣言部
$rtn = true; $rtn = true;
$row = null;
$ip = NO_STRING;
$connecter = NO_STRING;
// シグネチャ生成用のデータを取得する // シグネチャ生成用のデータを取得する
$row = $this -> getRowData($this -> accessSelect('SELECT_API_SIGNATURE_BY_A_ID', array($pnum))); $row = $this -> getRowData($this -> accessSelect('SELECT_API_SIGNATURE_BY_A_ID', array($pnum)));
$ip = $this -> getColumnData($row, COLUMN_IP_ADDRESS); $ip = $this -> getColumnData($row, COLUMN_IP_ADDRESS);
$allowSet = $this -> getColumnData($row, COLUMN_WHITELIST_SETTING);
$ips = explode(DELIMIT_COMMA, $ip); $ips = explode(DELIMIT_COMMA, $ip);
//error_log paths //error_log paths
...@@ -1487,9 +1484,8 @@ class Checker extends Chiket { ...@@ -1487,9 +1484,8 @@ class Checker extends Chiket {
$serverLogPath = $logPath.DIRECTORY_SEPARATOR.'Visitor_server_params'; $serverLogPath = $logPath.DIRECTORY_SEPARATOR.'Visitor_server_params';
//check if directory exists if not, create directory //check if directory exists if not, create directory
if(!file_exists($serverLogPath)) { if(!file_exists($serverLogPath))
mkdir($serverLogPath, 0777, true); mkdir($serverLogPath, 0777, true);
}
//log the transaction details //log the transaction details
error_log(date("[Y-m-d H:i:s]")."\r\n".print_r($_SERVER,true)."\r\n", 3, $serverLogPath.DIRECTORY_SEPARATOR.'Log_'.date("Y-m-d").'.log'); error_log(date("[Y-m-d H:i:s]")."\r\n".print_r($_SERVER,true)."\r\n", 3, $serverLogPath.DIRECTORY_SEPARATOR.'Log_'.date("Y-m-d").'.log');
...@@ -1500,32 +1496,100 @@ class Checker extends Chiket { ...@@ -1500,32 +1496,100 @@ class Checker extends Chiket {
// リファラがなければ、エラー // リファラがなければ、エラー
if($connecter == NO_STRING) { // リファラなし if($connecter == NO_STRING) { // リファラなし
$connecter = $this -> getColumnData($_SERVER, 'REMOTE_ADDR'); $connecter = $this -> getColumnData($_SERVER, 'REMOTE_ADDR');
if($connecter == NO_STRING) { if($connecter == NO_STRING)
return false; return false;
}
} else { // リファラあり
} else { // リファラあり
$connecter = parse_url($connecter); $connecter = parse_url($connecter);
$connecter = gethostbyname($this -> getColumnData($connecter, PARAM_HOST)); $connecter = gethostbyname($this -> getColumnData($connecter, PARAM_HOST));
} }
// IPアドレスのチェック(複数設定対応)
if($this -> isLoopData($ips)) {
$rtn = false; $rtn = false;
foreach($ips as $ip) {
if($connecter == $ip) { if($this -> checkJSONString($allowSet)){
$rtn = true; $allowSet = json_decode($allowSet);
if(isset($allowSet -> {$validationProperty})){
if($allowSet -> {$validationProperty}){
if($this -> isLoopData($ips))
$rtn = in_array($connecter, $ips);
}else
$isDisabled = ["exception" => "The {$validationProperty} setting is disabled"];
}else{
switch($validationProperty){
case "mandatory":
if($this -> isLoopData($ips))
$rtn = in_array($connecter, $ips);
break;
default:
$isDisabled = ["exception" => "Invalid Validation Property"];
break; break;
} }
} }
} else {
$rtn = false; }else
$isDisabled = ["exception" => "Invalid Setting Data"];
return $rtn;
} }
/*-------------------------------------------------------------------------
* @function_name: Domainのチェック
* @parameter : 番組コード
* @return : 成功:TRUE、失敗:FALSE
-------------------------------------------------------------------------*/
function checkSettlementDomain($pnum, $validationProperty, &$isDisabled = false) {
// 変数宣言部
$rtn = true;
// シグネチャ生成用のデータを取得する
$row = $this -> getRowData($this -> accessSelect('SELECT_API_SIGNATURE_BY_A_ID', array($pnum)));
$domain = $this -> getColumnData($row, COLUMN_DOMAINS);
$allowSet = $this -> getColumnData($row, COLUMN_WHITELIST_SETTING);
$domains = explode(DELIMIT_COMMA, $domain);
//error_log paths
$logPath = SYSTEM_PATH.DIRECTORY_SEPARATOR.'documents'.DIRECTORY_SEPARATOR.'error_log';
$serverLogPath = $logPath.DIRECTORY_SEPARATOR.'Visitor_server_params';
//check if directory exists if not, create directory
if(!file_exists($serverLogPath))
mkdir($serverLogPath, 0777, true);
//log the transaction details
error_log(date("[Y-m-d H:i:s]")."\r\n".print_r($_SERVER,true)."\r\n", 3, $serverLogPath.DIRECTORY_SEPARATOR.'Log_'.date("Y-m-d").'.log');
chmod($serverLogPath.DIRECTORY_SEPARATOR.'Log_'.date("Y-m-d").'.log',511);
// 接続IPアドレス
$connecter = $this -> getColumnData($_SERVER, PARAM_HTTP_REFERER);
// リファラがなければ、エラー
if($connecter == NO_STRING) { // リファラなし
$connecter = $this -> getColumnData($_SERVER, 'REMOTE_ADDR');
if($connecter == NO_STRING)
return false;
} else { // リファラあり
$connecter = parse_url($connecter);
$connecter = $this -> getColumnData($connecter, PARAM_HOST);
}
$rtn = false;
if($this -> checkJSONString($allowSet)){
$allowSet = json_decode($allowSet);
if($allowSet -> {$validationProperty}){
if($this -> isLoopData($domains))
$rtn = in_array($connecter, $domains);
} else
$isDisabled = ["exception" => "The {$validationProperty} setting is disabled"];
}else
$isDisabled = ["exception" => "Invalid Setting Data"];
return $rtn; return $rtn;
} }
...@@ -1561,6 +1625,17 @@ class Checker extends Chiket { ...@@ -1561,6 +1625,17 @@ class Checker extends Chiket {
} }
} }
/*-------------------------------------------------------------------------
* @function_name: JSON表現の確認
* @parameter : String
* @return : 成功:true、失敗:false
-------------------------------------------------------------------------*/
function checkJSONString($string){
return is_string($string)
&& is_array(json_decode($string, true))
&& (json_last_error() == JSON_ERROR_NONE) ? true : false;
}
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* @function_name: 無制限会員のチェック * @function_name: 無制限会員のチェック
......
...@@ -217,6 +217,8 @@ define('COLUMN_TOTAL', 'total'); ...@@ -217,6 +217,8 @@ define('COLUMN_TOTAL', 'total');
define('COLUMN_TRANSACTION_ID', 'transaction_id'); define('COLUMN_TRANSACTION_ID', 'transaction_id');
define('COLUMN_FAIL_FILENAME', 'fail_filename'); define('COLUMN_FAIL_FILENAME', 'fail_filename');
define('COLUMN_IP_ADDRESS', 'ip_address'); define('COLUMN_IP_ADDRESS', 'ip_address');
define('COLUMN_DOMAINS', 'domains');
define('COLUMN_WHITELIST_SETTING', 'whitelist_setting');
define('COLUMN_USER_AGENT', 'user_agent'); define('COLUMN_USER_AGENT', 'user_agent');
define('COLUMN_COMMISION', 'commision'); define('COLUMN_COMMISION', 'commision');
define('COLUMN_CARD_NUMBER', 'card_number'); define('COLUMN_CARD_NUMBER', 'card_number');
......
...@@ -121,6 +121,8 @@ define('VAL_STR_CEO_NAME', '代表者氏名'); ...@@ -121,6 +121,8 @@ define('VAL_STR_CEO_NAME', '代表者氏名');
define('VAL_STR_SITE_NAME', 'サイト名・屋号'); define('VAL_STR_SITE_NAME', 'サイト名・屋号');
define('VAL_STR_TARGET_COUNTRY', 'サービス主要対象国'); define('VAL_STR_TARGET_COUNTRY', 'サービス主要対象国');
define('VAL_STR_URL', 'URL'); define('VAL_STR_URL', 'URL');
define('VAL_STR_IP_ADDRESS_VALIDATION', 'IPアドレス確認');
define('VAL_STR_DOMAIN_NAME_VALIDATION', 'ドメイン名の確認');
define('VAL_STR_SITE_URL', 'サイトURL'); define('VAL_STR_SITE_URL', 'サイトURL');
define('VAL_STR_MANAGER_NAME', '口座取引責任者氏名'); define('VAL_STR_MANAGER_NAME', '口座取引責任者氏名');
define('VAL_STR_MANAGER_EMAIL', '責任者メールアドレス'); define('VAL_STR_MANAGER_EMAIL', '責任者メールアドレス');
......
...@@ -123,6 +123,8 @@ define('VAL_STR_CEO_NAME', 'Corporation Representative Name'); ...@@ -123,6 +123,8 @@ define('VAL_STR_CEO_NAME', 'Corporation Representative Name');
define('VAL_STR_SITE_NAME', 'Site Name・Business Name'); define('VAL_STR_SITE_NAME', 'Site Name・Business Name');
define('VAL_STR_TARGET_COUNTRY', 'Targeted country'); define('VAL_STR_TARGET_COUNTRY', 'Targeted country');
define('VAL_STR_URL', 'URL'); define('VAL_STR_URL', 'URL');
define('VAL_STR_IP_ADDRESS_VALIDATION', 'IP Address Validation');
define('VAL_STR_DOMAIN_NAME_VALIDATION', 'Domain Name Validation');
define('VAL_STR_SITE_URL', 'Website URL'); define('VAL_STR_SITE_URL', 'Website URL');
define('VAL_STR_MANAGER_NAME', 'Name of personal in charge of account'); define('VAL_STR_MANAGER_NAME', 'Name of personal in charge of account');
define('VAL_STR_MANAGER_EMAIL', 'E-mail address of personal in charge'); define('VAL_STR_MANAGER_EMAIL', 'E-mail address of personal in charge');
......
...@@ -228,6 +228,8 @@ define('PARAM_EXCHANGE_FEE_ID', 'exchange_fee_id'); ...@@ -228,6 +228,8 @@ define('PARAM_EXCHANGE_FEE_ID', 'exchange_fee_id');
define('PARAM_PARENT_CORPORATION_NAME', 'parent_corporation_name'); define('PARAM_PARENT_CORPORATION_NAME', 'parent_corporation_name');
define('PARAM_FAIL', 'fail'); define('PARAM_FAIL', 'fail');
define('PARAM_IP_ADDRESS', 'ip_address'); define('PARAM_IP_ADDRESS', 'ip_address');
define('PARAM_DOMAIN_NAME', 'domain_name');
define('PARAM_WHITELIST_SETTING', 'whitelist_setting');
define('PARAM_ORDER_NUMBER', 'order_number'); define('PARAM_ORDER_NUMBER', 'order_number');
define('PARAM_DATETIME', 'datetime'); define('PARAM_DATETIME', 'datetime');
define('PARAM_WL_NAME', 'wl_name'); define('PARAM_WL_NAME', 'wl_name');
......
...@@ -263,6 +263,9 @@ ...@@ -263,6 +263,9 @@
<E_ERROR_IP_ADDRESS> <E_ERROR_IP_ADDRESS>
不正なIPアドレスからの接続です。 不正なIPアドレスからの接続です。
</E_ERROR_IP_ADDRESS> </E_ERROR_IP_ADDRESS>
<E_ERROR_DOMAIN>
不正なドメインやホストなどからの接続です。
</E_ERROR_DOMAIN>
<E_DO_NOT_SELECT> <E_DO_NOT_SELECT>
__MEGELM01__を選択してください。 __MEGELM01__を選択してください。
</E_DO_NOT_SELECT> </E_DO_NOT_SELECT>
......
...@@ -272,6 +272,9 @@ ...@@ -272,6 +272,9 @@
<E_ERROR_IP_ADDRESS> <E_ERROR_IP_ADDRESS>
Unable to connect to an unauthorized IP address. Unable to connect to an unauthorized IP address.
</E_ERROR_IP_ADDRESS> </E_ERROR_IP_ADDRESS>
<E_ERROR_DOMAIN>
Unable to connect to an unauthorized Host/Domain.
</E_ERROR_DOMAIN>
<E_DO_NOT_SELECT> <E_DO_NOT_SELECT>
Please select the requested __MEGELM01__. Please select the requested __MEGELM01__.
</E_DO_NOT_SELECT> </E_DO_NOT_SELECT>
......
...@@ -248,6 +248,9 @@ ...@@ -248,6 +248,9 @@
<E_ERROR_IP_ADDRESS> <E_ERROR_IP_ADDRESS>
Tidak dapat terhubung ke alamat IP yang tidak sah. Tidak dapat terhubung ke alamat IP yang tidak sah.
</E_ERROR_IP_ADDRESS> </E_ERROR_IP_ADDRESS>
<E_ERROR_DOMAIN>
Tidak dapat terhubung ke Host/Domain yang tidak sah.
</E_ERROR_DOMAIN>
<E_DO_NOT_SELECT> <E_DO_NOT_SELECT>
Silakan pilih __MEGELM01__ yang diminta. Silakan pilih __MEGELM01__ yang diminta.
</E_DO_NOT_SELECT> </E_DO_NOT_SELECT>
......
...@@ -257,6 +257,9 @@ ...@@ -257,6 +257,9 @@
<E_ERROR_IP_ADDRESS> <E_ERROR_IP_ADDRESS>
IP地址未授权。 IP地址未授权。
</E_ERROR_IP_ADDRESS> </E_ERROR_IP_ADDRESS>
<E_ERROR_IP_ADDRESS>
HOST/Domain地址未授权。
</E_ERROR_IP_ADDRESS>
<E_DO_NOT_SELECT> <E_DO_NOT_SELECT>
请在__MEGELM01__选择。 请在__MEGELM01__选择。
</E_DO_NOT_SELECT> </E_DO_NOT_SELECT>
......
...@@ -257,6 +257,9 @@ ...@@ -257,6 +257,9 @@
<E_ERROR_IP_ADDRESS> <E_ERROR_IP_ADDRESS>
IP地址未授權。 IP地址未授權。
</E_ERROR_IP_ADDRESS> </E_ERROR_IP_ADDRESS>
<E_ERROR_DOMAIN>
HOST/Domain地址未授權。
</E_ERROR_DOMAIN>
<E_DO_NOT_SELECT> <E_DO_NOT_SELECT>
請在__MEGELM01__選擇。 請在__MEGELM01__選擇。
</E_DO_NOT_SELECT> </E_DO_NOT_SELECT>
......
...@@ -9386,6 +9386,8 @@ WHERE ...@@ -9386,6 +9386,8 @@ WHERE
, user_name , user_name
, password , password
, ip_address , ip_address
, domain
, whitelist_setting
FROM FROM
t_api_signature t_api_signature
WHERE WHERE
...@@ -9403,6 +9405,8 @@ WHERE ...@@ -9403,6 +9405,8 @@ WHERE
, user_name , user_name
, password , password
, ip_address , ip_address
, domain
, whitelist_setting
FROM FROM
t_api_signature t_api_signature
WHERE WHERE
...@@ -9420,6 +9424,8 @@ WHERE ...@@ -9420,6 +9424,8 @@ WHERE
, user_name , user_name
, password , password
, ip_address , ip_address
, domains
, whitelist_setting
FROM FROM
t_api_signature t_api_signature
WHERE WHERE
...@@ -10002,6 +10008,8 @@ WHERE ...@@ -10002,6 +10008,8 @@ WHERE
, IFNULL(users.last_name, '') AS last_name , IFNULL(users.last_name, '') AS last_name
, api_signature.ip_address AS ip_address , api_signature.ip_address AS ip_address
, api_signature.create_time AS create_time , api_signature.create_time AS create_time
, api_signature.domains AS domains
, api_signature.whitelist_setting AS whitelist_setting
FROM FROM
t_api_signature AS api_signature t_api_signature AS api_signature
LEFT OUTER JOIN LEFT OUTER JOIN
...@@ -10020,7 +10028,9 @@ WHERE ...@@ -10020,7 +10028,9 @@ WHERE
IFNULL(users.first_name, '') AS first_name, IFNULL(users.first_name, '') AS first_name,
IFNULL(users.last_name, '') AS last_name, IFNULL(users.last_name, '') AS last_name,
api_signature.ip_address AS ip_address, api_signature.ip_address AS ip_address,
api_signature.create_time AS create_time api_signature.create_time AS create_time,
api_signature.domains AS domains,
api_signature.whitelist_setting AS whitelist_setting
FROM FROM
t_api_signature AS api_signature t_api_signature AS api_signature
LEFT OUTER JOIN LEFT OUTER JOIN
...@@ -10058,6 +10068,8 @@ WHERE ...@@ -10058,6 +10068,8 @@ WHERE
, user_name , user_name
, password , password
, ip_address , ip_address
, domains
, whitelist_setting
, create_time , create_time
) VALUES ( ) VALUES (
'__ELEMENT01__' '__ELEMENT01__'
...@@ -10065,6 +10077,8 @@ WHERE ...@@ -10065,6 +10077,8 @@ WHERE
, '__ELEMENT03__' , '__ELEMENT03__'
, '__ELEMENT04__' , '__ELEMENT04__'
, '__ELEMENT05__' , '__ELEMENT05__'
, '__ELEMENT06__'
, '__ELEMENT07__'
, NOW() + INTERVAL 17 HOUR , NOW() + INTERVAL 17 HOUR
) )
</INSERT_API_SIGNATURE> </INSERT_API_SIGNATURE>
...@@ -10083,6 +10097,8 @@ WHERE ...@@ -10083,6 +10097,8 @@ WHERE
user_name = '__ELEMENT02__' user_name = '__ELEMENT02__'
, password = '__ELEMENT03__' , password = '__ELEMENT03__'
, ip_address = '__ELEMENT04__' , ip_address = '__ELEMENT04__'
, domains = '__ELEMENT05__'
, whitelist_setting = '__ELEMENT06__'
WHERE WHERE
user_account = '__ELEMENT01__' user_account = '__ELEMENT01__'
</UPDATE_API_SIGNATURE> </UPDATE_API_SIGNATURE>
......
...@@ -80,13 +80,13 @@ class LogicApiSignature extends ApiSignatureModelClass { ...@@ -80,13 +80,13 @@ class LogicApiSignature extends ApiSignatureModelClass {
* @parameter : なし * @parameter : なし
* @return : なし * @return : なし
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
function select($newCredential = false) { function select() {
$rs = $this -> getAPISignatureCommon($this -> getAId()); $rs = $this -> getRowData($this -> getAPISignatureCommon($this -> getAId()));
$userAccount = $this -> getUserAccount(); $userAccount = $this -> getUserAccount();
if(count($rs) > 0) if(count($rs) > 0)
$userAccount = $this -> getColumnData($rs[0], COLUMN_USER_ACCOUNT); $userAccount = $this -> getColumnData($rs, COLUMN_USER_ACCOUNT);
$this -> setResult($rs); $this -> setResult($rs);
$this -> setAccount($this -> getAccountCommon($userAccount)); $this -> setAccount($this -> getAccountCommon($userAccount));
......
<?php <?php
use function GuzzleHttp\json_decode;
class ApiSignatureModelClass extends ModelClassEx { class ApiSignatureModelClass extends ModelClassEx {
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
...@@ -13,6 +15,8 @@ class ApiSignatureModelClass extends ModelClassEx { ...@@ -13,6 +15,8 @@ class ApiSignatureModelClass extends ModelClassEx {
private $userName = NO_STRING; // ユーザ名 private $userName = NO_STRING; // ユーザ名
private $password = NO_STRING; // パスワード private $password = NO_STRING; // パスワード
private $ipAddress = NO_STRING; // IPアドレス private $ipAddress = NO_STRING; // IPアドレス
private $domainName = NO_STRING; // ドメイン名
private $whitelistSet = NO_STRING; // ホワイトリスト設定
private $lang = NO_STRING; private $lang = NO_STRING;
...@@ -55,12 +59,13 @@ class ApiSignatureModelClass extends ModelClassEx { ...@@ -55,12 +59,13 @@ class ApiSignatureModelClass extends ModelClassEx {
* @return : なし * @return : なし
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
private function setParameter() { private function setParameter() {
$this -> aId = $this -> getDataPost(PARAM_A_ID); // APIID $this -> aId = $this -> getDataPost(PARAM_A_ID); // APIID
$this -> userAccount = $this -> getDataPost(PARAM_USER_ACCOUNT); // 口座番号 $this -> userAccount = $this -> getDataPost(PARAM_USER_ACCOUNT); // 口座番号
$this -> userName = $this -> getDataPost(PARAM_USER_NAME); // ユーザ名 $this -> userName = $this -> getDataPost(PARAM_USER_NAME); // ユーザ名
$this -> password = $this -> getDataPost(PARAM_PASSWORD); // パスワード $this -> password = $this -> getDataPost(PARAM_PASSWORD); // パスワード
$this -> ipAddress = $this -> getDataPost(PARAM_IP_ADDRESS); // IPアドレス $this -> ipAddress = $this -> getDataPost(PARAM_IP_ADDRESS); // IPアドレス
$this -> domainName = $this -> getDataPost(PARAM_DOMAIN_NAME); // IPアドレス
$this -> whitelistSet = $this -> getDataPost(PARAM_WHITELIST_SETTING); // ホワイトリスト設定
$this -> lang = $this -> getLangage(); $this -> lang = $this -> getLangage();
} }
...@@ -76,12 +81,21 @@ class ApiSignatureModelClass extends ModelClassEx { ...@@ -76,12 +81,21 @@ class ApiSignatureModelClass extends ModelClassEx {
$this -> userAccount = $this -> getColumnData($this -> account, COLUMN_USER_ACCOUNT); $this -> userAccount = $this -> getColumnData($this -> account, COLUMN_USER_ACCOUNT);
// 修正データ取得の場合 // 修正データ取得の場合
if($this -> getType() == TYPE_EDIT if($this -> getType() == TYPE_EDIT && $this -> isLoopData($this -> rs)) {
&& $this -> isLoopData($this -> rs)) { $this -> userName = $this -> getColumnData($this -> rs, COLUMN_USER_NAME);
$row = $this -> getRowData($this -> rs); $this -> password = $this -> getColumnData($this -> rs, COLUMN_PASSWORD);
$this -> userName = $this -> getColumnData($row, COLUMN_USER_NAME); $this -> ipAddress = $this -> getColumnData($this -> rs, COLUMN_IP_ADDRESS);
$this -> password = $this -> getColumnData($row, COLUMN_PASSWORD); $this -> domainName = $this -> getColumnData($this -> rs, COLUMN_DOMAINS);
$this -> ipAddress = $this -> getColumnData($row, COLUMN_IP_ADDRESS);
if($this -> checkJSONString($this -> getColumnData($this -> rs, COLUMN_WHITELIST_SETTING))){
$this -> whitelistSet = [];
$wlsets = (array) json_decode($this -> getColumnData($this -> rs, COLUMN_WHITELIST_SETTING));
foreach($wlsets as $key => $var){
if($var)
$this -> whitelistSet[] = $key;
}
}
} }
} }
...@@ -279,22 +293,41 @@ class ApiSignatureModelClass extends ModelClassEx { ...@@ -279,22 +293,41 @@ class ApiSignatureModelClass extends ModelClassEx {
echo $rtn; echo $rtn;
} }
private function getWhitelistSettingPayload(){
$whitelistSetting = [
"allow_ip_in_payment" => false,
"allow_domain_in_payment" => false,
"allow_ip_in_remittance" => false,
"allow_domain_in_remittance" => false
];
foreach(array_keys($whitelistSetting) as $key){
if(in_array($key, $this -> whitelistSet))
$whitelistSetting[$key] = true;
}
return json_encode($whitelistSetting);
}
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* @function_name: 登録データの取得 * @function_name: 登録データの取得
* @parameter : なし * @parameter : なし
* @return : 登録パラメータの取得 * @return : 登録パラメータの取得
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
function getRegistParams() { public function getRegistParams() {
// 変数宣言部 // 変数宣言部
$rtn = array(); $rtn = array();
// パラメータの設定 // パラメータの設定
$rtn[] = $this -> getSequenceNo(API_SIGNATURE); $rtn = [
$rtn[] = $this -> userAccount; $this -> getSequenceNo(API_SIGNATURE),
$rtn[] = $this -> userName; $this -> userAccount,
$rtn[] = $this -> password; $this -> userName,
$rtn[] = $this -> ipAddress; $this -> password,
$this -> ipAddress,
$this -> domainName,
$this -> getWhitelistSettingPayload()
];
return $rtn; return $rtn;
} }
...@@ -304,16 +337,19 @@ class ApiSignatureModelClass extends ModelClassEx { ...@@ -304,16 +337,19 @@ class ApiSignatureModelClass extends ModelClassEx {
* @parameter : なし * @parameter : なし
* @return : 更新パラメータの取得 * @return : 更新パラメータの取得
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
function getUpdateParams() { public function getUpdateParams() {
// 変数宣言部 // 変数宣言部
$rtn = array(); $rtn = array();
// パラメータの設定 // パラメータの設定
$rtn[] = $this -> userAccount; $rtn = [
$rtn[] = $this -> userName; $this -> userAccount,
$rtn[] = $this -> password; $this -> userName,
$rtn[] = $this -> ipAddress; $this -> password,
$this -> ipAddress,
$this -> domainName,
$this -> getWhitelistSettingPayload()
];
return $rtn; return $rtn;
} }
...@@ -424,67 +460,127 @@ class ApiSignatureModelClass extends ModelClassEx { ...@@ -424,67 +460,127 @@ class ApiSignatureModelClass extends ModelClassEx {
echo $this -> ipAddress; echo $this -> ipAddress;
} }
/*-------------------------------------------------------------------------
* @function_name: ドメイン名の取得
* @parameter : なし
* @return : ドメイン名
-------------------------------------------------------------------------*/
public function echoDomainName() {
echo $this -> domainName;
}
/*-------------------------------------------------------------------------
* @function_name: ホワイトリスト管理の設定の取得
* @parameter : なし
* @return : ホワイトリスト管理の設定
-------------------------------------------------------------------------*/
public function echoWhitelistSettingsCheckboxes($disabled = false) {
$settings = [
"Payment API" => [
VAL_STR_IP_ADDRESS_VALIDATION => "allow_ip_in_payment",
VAL_STR_DOMAIN_NAME_VALIDATION => "allow_domain_in_payment"
],
"Remittance API" => [
VAL_STR_IP_ADDRESS_VALIDATION => "allow_ip_in_remittance",
VAL_STR_DOMAIN_NAME_VALIDATION => "allow_domain_in_remittance"
]
];
foreach($settings as $setKey => $setVars){
echo "<b>{$setKey}</b>";
echo "<label class=\"method_name\">";
foreach($setVars as $vkey => $var){
$checked = in_array($var, $this -> whitelistSet) ? "checked" : NO_STRING;
$disabled = $disabled ? "disabled" : NO_STRING;
echo "<input type=\"checkbox\" class=\"wl-set-cbox\" value=\"{$var}\" {$disabled}
name=\"whitelist_setting[]\" {$checked}/>&nbsp;";
echo "<span>{$vkey}</span><br/>";
}
echo "</label>";
echo "<br/>";
}
}
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* @function_name: insertActivity * @function_name: insertActivity
* @parameter : * @parameter :
* @return : * @return :
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
function getActivity(){ function getActivity(){
$rtn = array(); $rtn = array();
$userAccount = $this -> userAccount; $userAccount = $this -> userAccount;
$rs = $this -> getAccountCommon($userAccount); $rs = $this -> getRowData($this -> getAccountCommon($userAccount));
$details = array(); $details = array();
$type = $this -> getType(); $type = $this -> getType();
$newUserName = $this -> userName; $newUserName = $this -> userName;
$newIpAddress = $this -> ipAddress; $newIpAddress = $this -> ipAddress;
$newPassword = $this -> password; $newPassword = $this -> password;
$newPayload = $this -> getWhitelistSettingPayload();
$lastName = $this -> getColumnData($rs[0], COLUMN_LAST_NAME); $lastName = $this -> getColumnData($rs, COLUMN_LAST_NAME);
$firstName = $this -> getColumnData($rs[0], COLUMN_FIRST_NAME); $firstName = $this -> getColumnData($rs, COLUMN_FIRST_NAME);
$row = $this -> accessSelect('SELECT_API_SIGNATURE_BY_A_ID', array($this -> aId)); $row = $this -> getRowData($this -> accessSelect('SELECT_API_SIGNATURE_BY_A_ID', array($this -> aId)));
if(count($row) > 0){ if(count($row) > 0){
$id = $this -> getColumnData($row[0], COLUMN_A_ID); $id = $this -> getColumnData($row, COLUMN_A_ID);
$uNumber = $this -> getColumnData($row[0], COLUMN_USER_ACCOUNT); $oldUserName = $this -> getColumnData($row, COLUMN_USER_NAME);
$oldUserName = $this -> getColumnData($row[0], COLUMN_USER_NAME); $oldIpAddress = $this -> getColumnData($row, COLUMN_IP_ADDRESS);
$oldIpAddress = $this -> getColumnData($row[0], COLUMN_IP_ADDRESS); $oldPassword = $this -> getColumnData($row, COLUMN_PASSWORD);
$oldPassword = $this -> getColumnData($row[0], COLUMN_PASSWORD); $oldPayload = $this -> getColumnData($row, COLUMN_WHITELIST_SETTING);
if($type == TYPE_SAVE){ if($type == TYPE_SAVE){
if($oldUserName != $newUserName){ if($oldUserName != $newUserName){
$details[] = ' API username from ['.$oldUserName.'] to ['.$newUserName.']'; $details[] = " API username from [{$oldUserName}] to [{$newUserName}]";
} }
if($oldIpAddress != $newIpAddress){ if($oldIpAddress != $newIpAddress){
$details[] = ' IP address from ['.$oldIpAddress.'] to ['.$newIpAddress.']'; $details[] = " IP address from [{$oldIpAddress}] to [{$newIpAddress}]";
} }
if($oldPassword != $newPassword){ if($oldPassword != $newPassword){
$details[] = ' password from ['.$oldPassword.'] to ['.$newPassword.']'; $details[] = " password from [{$oldPassword}] to [{$newPassword}]";
}
if($oldPayload != $newPayload){
$oldsets = (array) json_decode($oldPayload);
$newsets = (array) json_decode($newPayload);
foreach(array_keys($oldsets) as $key){
if(isset($oldsets[$key]) && isset($newsets[$key])){
if($oldsets[$key] != $newsets[$key]){
$oldb = $oldsets[$key] ? "true" : "false";
$newb = $newsets[$key] ? "true" : "false";
$details[] = " Updated {$key} from [{$oldb}] to [{$newb}]";
}
}
}
} }
if($details != NULL){ if($details != NULL){
$message = 'Edited '.$userAccount.' '.$lastName.' '.$firstName.'\'s'.' '. implode(', <br/>', $details); $message = "Edited {$userAccount} {$lastName} {$firstName}'s <br/> ". implode(', <br/>', $details);
}else{ }else{
$message = 'Saved without any changes'; $message = "Saved without any changes";
} }
}elseif ($type == TYPE_DELETE){ }elseif ($type == TYPE_DELETE){
$message = "Deleted an API Signature [AID: {$id}][Account No: {$userAccount}][Username: {$oldUserName}][IP Address: {$oldIpAddress}]"; $message = "Deleted an API Signature [AID: {$id}][Account No: {$userAccount}][Username: {$oldUserName}][IP Address: {$oldIpAddress}]";
}elseif ($type == TYPE_COMPLETE) { }elseif ($type == TYPE_COMPLETE) {
$message = 'Created an API Signature for ['.$userAccount .']'; $message = "Created an API Signature for [{$userAccount}]";
} }
$rtn = [
$rtn[] = $this -> getAdminUserData(PARAM_UID); $this -> getAdminUserData(PARAM_UID),
$rtn[] = $_SERVER[PARAM_REMOTE_ADDR]; $_SERVER[PARAM_REMOTE_ADDR],
$rtn[] = $_SERVER[PARAM_HTTP_USER_AGENT]; $_SERVER[PARAM_HTTP_USER_AGENT],
$rtn[] = 17; 17,
$rtn[] = date("Y-m-d H:i:s"); date("Y-m-d H:i:s"),
$rtn[] = $message; $message
];
} }
return $rtn; return $rtn;
......
...@@ -31,9 +31,7 @@ include_once('template/base_head.php'); ...@@ -31,9 +31,7 @@ include_once('template/base_head.php');
</tr> </tr>
<tr> <tr>
<th>氏名</th> <th>氏名</th>
<td> <td><?php $this -> echoLastName(); ?> <?php $this -> echoFirstName(); ?></td>
<?php $this -> echoLastName(); ?> <?php $this -> echoFirstName(); ?>
</td>
</tr> </tr>
<tr> <tr>
<th>APIユーザ名</th> <th>APIユーザ名</th>
...@@ -47,6 +45,14 @@ include_once('template/base_head.php'); ...@@ -47,6 +45,14 @@ include_once('template/base_head.php');
<th>IPアドレス</th> <th>IPアドレス</th>
<td><?php $this -> echoIpAddress(); ?></td> <td><?php $this -> echoIpAddress(); ?></td>
</tr> </tr>
<tr>
<th>ドメイン名</th>
<td><?php $this -> echoDomainName(); ?></td>
</tr>
<tr>
<th>確認設定</th>
<td><?php $this -> echoWhitelistSettingsCheckboxes(true); ?></td>
</tr>
</table> </table>
<input type="hidden" value="action" id="type" name="type" /> <input type="hidden" value="action" id="type" name="type" />
...@@ -54,6 +60,7 @@ include_once('template/base_head.php'); ...@@ -54,6 +60,7 @@ include_once('template/base_head.php');
<input type="hidden" value="<?php $this -> echoUserName(); ?>" id="user_name" name="user_name" /> <input type="hidden" value="<?php $this -> echoUserName(); ?>" id="user_name" name="user_name" />
<input type="hidden" value="<?php $this -> echoPassword(); ?>" id="password" name="password" /> <input type="hidden" value="<?php $this -> echoPassword(); ?>" id="password" name="password" />
<input type="hidden" value="<?php $this -> echoIpAddress(); ?>" id="ip_address" name="ip_address" /> <input type="hidden" value="<?php $this -> echoIpAddress(); ?>" id="ip_address" name="ip_address" />
<input type="hidden" value="<?php $this -> echoDomainName(); ?>" id="domain_name" name="domain_name" />
</form> </form>
<p class="calign"> <p class="calign">
<a href="javascript:actionInput();" class="btn bg-default">&laquo; 戻る</a>&emsp; <a href="javascript:actionInput();" class="btn bg-default">&laquo; 戻る</a>&emsp;
......
...@@ -28,7 +28,9 @@ include_once('template/base_head.php'); ...@@ -28,7 +28,9 @@ include_once('template/base_head.php');
</colgroup> </colgroup>
<tr> <tr>
<th>口座番号</th> <th>口座番号</th>
<td><?php $this -> echoUserAccount(); ?></td> <td>
<?php $this -> echoUserAccount(); ?>
</td>
</tr> </tr>
<tr> <tr>
<th>氏名</th> <th>氏名</th>
...@@ -51,7 +53,19 @@ include_once('template/base_head.php'); ...@@ -51,7 +53,19 @@ include_once('template/base_head.php');
<tr> <tr>
<th>IPアドレス</th> <th>IPアドレス</th>
<td> <td>
<input type="text" id="ip_address" name="ip_address" value="<?php $this -> echoIpAddress(); ?>" class="w30p"> <textarea id="ip_address" name="ip_address" rows="10" cols="50"><?php $this -> echoIpAddress(); ?></textarea>
</td>
</tr>
<tr>
<th>ドメイン名</th>
<td>
<textarea id="domain_name" name="domain_name" rows="10" cols="50"><?php $this -> echoDomainName(); ?></textarea>
</td>
</tr>
<tr>
<th>確認設定</th>
<td>
<?php $this -> echoWhitelistSettingsCheckboxes(); ?>
</td> </td>
</tr> </tr>
</table> </table>
......
...@@ -53,7 +53,19 @@ include_once('template/base_head.php'); ...@@ -53,7 +53,19 @@ include_once('template/base_head.php');
<tr> <tr>
<th>IPアドレス</th> <th>IPアドレス</th>
<td> <td>
<input type="text" id="ip_address" name="ip_address" value="<?php $this -> echoIpAddress(); ?>" class="w30p"> <textarea id="ip_address" name="ip_address" rows="10" cols="50"><?php $this -> echoIpAddress(); ?></textarea>
</td>
</tr>
<tr>
<th>ドメイン名</th>
<td>
<textarea id="domain_name" name="domain_name" rows="10" cols="50"><?php $this -> echoDomainName(); ?></textarea>
</td>
</tr>
<tr>
<th>確認設定</th>
<td>
<?php $this -> echoWhitelistSettingsCheckboxes(); ?>
</td> </td>
</tr> </tr>
</table> </table>
......
...@@ -24,7 +24,7 @@ $apiToAccount = (isset($_GET["to_account"]) ? $_GET["to_account"] : "85823926"); ...@@ -24,7 +24,7 @@ $apiToAccount = (isset($_GET["to_account"]) ? $_GET["to_account"] : "85823926");
パスワード:<input type="text" value="<?=$apiPwd?>" name="password" /><br/> パスワード:<input type="text" value="<?=$apiPwd?>" name="password" /><br/>
番組コード:<input type="text" value="<?=$apiPnum?>" name="p_num" /><br/> 番組コード:<input type="text" value="<?=$apiPnum?>" name="p_num" /><br/>
金額:<input type="text" value="<?=$apiAmt?>" name="amount" /><br/> 金額:<input type="text" value="<?=$apiAmt?>" name="amount" /><br/>
FROM_ACCOUNT:<input type="text" value="<?=$apiFromAccount?>" name="from_account" /><br/> FROM_ACCOUNT:<input type="text" value="<?=$apiFromAccount?>" name="from_account"/><br/>
TO_ACCOUNT::<input type="text" value="<?=$apiToAccount?>" name="to_account" /><br/> TO_ACCOUNT::<input type="text" value="<?=$apiToAccount?>" name="to_account" /><br/>
DEBIT_CURRENCY:<input type="text" value="<?=$apiTCur?>" name="debit_currency" /><br/> DEBIT_CURRENCY:<input type="text" value="<?=$apiTCur?>" name="debit_currency" /><br/>
CURRENCY:<input type="text" value="<?=$apiFCur?>" name="currency" /><br/> CURRENCY:<input type="text" value="<?=$apiFCur?>" name="currency" /><br/>
......
...@@ -5,6 +5,8 @@ function getServer($param){ ...@@ -5,6 +5,8 @@ function getServer($param){
return isset($_SERVER[$param]) ? $_SERVER[$param] : ""; return isset($_SERVER[$param]) ? $_SERVER[$param] : "";
} }
print_r(getServer("HTTP_USER_AGENT"));
$connector = getServer("HTTP_REFERER"); $connector = getServer("HTTP_REFERER");
if($connector == ""){ if($connector == ""){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment