mirror of
https://github.com/standardebooks/web.git
synced 2025-07-21 06:45:14 -04:00
Limit ebook downloads per IP address
This commit is contained in:
parent
6c69ee0bdf
commit
0a71382a25
4 changed files with 58 additions and 9 deletions
|
@ -149,6 +149,17 @@ class Formatter{
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a valid IPv4 address to IPv6. Other strings are unchanged.
|
||||
*/
|
||||
public static function ToIpv6(?string $ipAddress): ?string{
|
||||
if(filter_var($ipAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)){
|
||||
return '::ffff:' . $ipAddress;
|
||||
}
|
||||
|
||||
return $ipAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a float into a USD currency string. The result is prepended with `$`.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue