Now we have the file that needs to be cross-referenced through the $ REMOTE_ADDR variable, so that we can distinguish whether the user who wants to post has been flattened or not. Simple:
<? Php
For ($ counter = 0; $ counter <sizeof ($ banned_array); $ counter ++ ){
If ($ banned_array [$ counter] = $ REMOTE_ADDR ){
Print ("<font color =" red "face =" arial "align =" center "> ".
"You have been banned from this chat </font> ");
Exit;
}
}
?>
The exit command stops script execution immediately. Before processing the passed variables, insert a check for the flat users so that the flat users cannot use the chat room.
Check the range of the IP address block. A simple function can be easily implemented.
<? Php
Function makeMask ($ ip ){
// Remember to escape the. so PHP doesn't think it's a concatenation
$ Ip_array = explode (".", $ ip );
$ Ip_mask = "$ ip_array [0]. $ ip_array [1]. $ ip_array [2]";
Return $ ip_mask;
}
?>
Then we replace the if in the loop
<? Php
For ($ counter = 0; $ counter <sizeof ($ banned_array); $ counter ++ ){
If (makeMask ($ REMOTE_ADDR) = makeMask ($ banned_array [$ counter]) {
Print ("<font color =" red "face =" arial "align =" center "> ".
"You have been banned from this chat </font> ");
Exit;
}
}
?>
We have protective measures for Dynamic IP addresses.
Finally, we need a method to get the IP address that is in trouble first. My implementation is to record $ name and $ REMOTE_ADDR to
Iplist.html file. For a separated, secret URL, I can monitor IP addresses while browsing messages. This can add some unexpected benefits, namely the ability to discover counterfeits-the most common "sin" in these places ".
The methods for creating iplist.html and messages.html are basically the same. First, extract the current value from iplist.html. We will strip the U-turn information, the foot tag and the old IP address record, and then create a new record, new header information, and new foot tag. To make the layout clearer, I used a table.