#include
#include
bool isSet(char *bitarray, int num)
{
int index = num / 8;
int offset = num % 8;
return bitarray[index] & (char)(1 << offset);
}
void set(char *bitarray, int num)
{
int index = num / 8;
int offset = num % 8;
bitarray[index] |= (char)(1 << offset);
}
void printMissingNum(int *array, int arraysize, int N)
{
int bitarraysize = (N + 7) / 8;
char *bitarray = (char*)calloc(bitarraysize, 1);
for(int i = 0; i < arraysize; ++i) {
... 阅读全帖
Use the following, some percentage (<10%) of the chance, REMOTE_ADDR only
gives the internal IPs.
$VISITORIP = $_SERVER["REMOTE_ADDR"];
if(isset($_SERVER["HTTP_X_FORWARDED_FOR"])){
$realiparray = $_SERVER["HTTP_X_FORWARDED_FOR"];
$realiparray = explode(',',$realiparray);
$VISITORIP=trim($realiparray[count($realiparray) - 1]);
}
We are little creatures;
all of us have different features.
One of us in glass isset;
one of us you'll find in jet.
Another you may see in tin,
and the fourth is boxed within .
If the fifth you should pursue,
it can never fly from you.
What are we?
理论上是个好主意,但总觉得这个功能不至于用table.
找到一个,有空试试。
if (!isset($_SESSION)) {
session_start();
}
// anti flood protection
if($_SESSION['last_session_request'] > time() - 2){
// users will be redirected to this page if it makes requests faster
than 2 seconds
header("location: https://google.com");
exit;
}
$_SESSION['last_session_request'] = time();
?>