Skip to content

Instantly share code, notes, and snippets.

@jiskanulo
Created September 28, 2011 03:19
Show Gist options
  • Save jiskanulo/1246906 to your computer and use it in GitHub Desktop.
Save jiskanulo/1246906 to your computer and use it in GitHub Desktop.
apc_clear_cache()をwebからたたく的な
<?php
$ip = (isset($_SERVER['REMOTE_ADDR'])) ? $_SERVER['REMOTE_ADDR'] : '';
$allowed_ips = array(
'127.0.0.1',
'192.168.11.*',
);
$validate = false;
foreach ($allowed_ips as $allowed_ip) {
if (preg_match('/^' . $allowed_ip . '$/', $ip)) {
$validate = true;
break;
}
}
if (!$validate) {
die('You are not allowed to access this file.');
}
apc_clear_cache();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment