IpAddress.php
Gesponsorde koppelingen
PHP script bestanden
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
class IpAddress {
private $_sIpAddress;
public function __construct() {
$this->_sIpAddress = $_SERVER['REMOTE_ADDR'];
}
public function getIpAddress() {
if(filter_var($this->_sIpAddress, FILTER_VALIDATE_IP)) {
return (string) $this->_sIpAddress;
} else {
throw new SessionException('Global ip-address is not valid.', SessionException::E_CORE_ERROR);
return false;
}
}
}
?>
class IpAddress {
private $_sIpAddress;
public function __construct() {
$this->_sIpAddress = $_SERVER['REMOTE_ADDR'];
}
public function getIpAddress() {
if(filter_var($this->_sIpAddress, FILTER_VALIDATE_IP)) {
return (string) $this->_sIpAddress;
} else {
throw new SessionException('Global ip-address is not valid.', SessionException::E_CORE_ERROR);
return false;
}
}
}
?>