Skip to content

Instantly share code, notes, and snippets.

chitchcock

Block or report user

Report or block chitchcock

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@samdark
samdark / github-post-receive.php
Last active Oct 11, 2019
Simple GitHub post-receive PHP hook
View github-post-receive.php
<?php
function cidr_match($ip, $ranges)
{
$ranges = (array)$ranges;
foreach($ranges as $range) {
list($subnet, $mask) = explode('/', $range);
if((ip2long($ip) & ~((1 << (32 - $mask)) - 1)) == ip2long($subnet)) {
return true;
}
}
You can’t perform that action at this time.