Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion UnitPay.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ private function getMd5sign($params)
return md5(join(null, $params).$this->secretKey);
}

/**
* Return IP address
*
* @return string
*/
protected function getIp()
{
return $_SERVER['REMOTE_ADDR'];
}

/**
* Get URL for pay through the form
*
Expand Down Expand Up @@ -145,7 +155,7 @@ public function api($method, $params = array())
*/
public function checkHandlerRequest()
{
$ip = $_SERVER['REMOTE_ADDR'];
$ip = $this->getIp();
if (!isset($_GET['method'])) {
throw new InvalidArgumentException('Method is null');
}
Expand Down