Created
November 25, 2015 21:57
-
-
Save ConnorMcF/fc5d3a789125a2909fd0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require('../class/ratelimiter.php'); | |
$rateLimiter = new RateLimiter(new Memcached(), $_SERVER["REMOTE_ADDR"],"registration"); | |
try { | |
// allow a maximum of 100 requests for the IP in 5 minutes | |
$rateLimiter->limitRequestsInMinutes(1, 1); | |
} catch (RateExceededException $e) { | |
header("HTTP/1.0 529 Too Many Requests"); | |
exit; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment