Skip to content

Commit a16e315

Browse files
committed
Minor fix
Added x_forwarded_for, x_real_ip
1 parent 7022a59 commit a16e315

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cleantalk.class.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ class CleantalkRequest {
295295
* @var int
296296
*/
297297
public $submit_time = null;
298+
299+
public $x_forwarded_for = '';
300+
public $x_real_ip = '';
298301

299302
/**
300303
* Is enable Java Script,
@@ -715,11 +718,15 @@ private function httpRequest($msg) {
715718
if(method_exists($request,'server'))
716719
{
717720
$si['remote_addr']=$request->server('REMOTE_ADDR');
721+
$msg->x_forwarded_for=$request->server('X_FORWARDED_FOR');
722+
$msg->x_real_ip=$request->server('X_REAL_IP');
718723
}
719724
}
720725
else
721726
{
722727
$si['remote_addr']=$_SERVER['REMOTE_ADDR'];
728+
$msg->x_forwarded_for=@$_SERVER['X_FORWARDED_FOR'];
729+
$msg->x_real_ip=@$_SERVER['X_REAL_IP'];
723730
}
724731
$msg->sender_info=json_encode($si);
725732
if (((isset($this->work_url) && $this->work_url !== '') && ($this->server_changed + $this->server_ttl > time()))

0 commit comments

Comments
 (0)