I wanted to see if I could improve the famous 1kB Forum. The most important thing seemed to be some kind of crowd control - so I added DNSBL checking, IP logging, fixed some E_NOTICE errors in the script. The size is now 1013 characters.
If you want to know what IP's have been posting the most threads (or causing the most trouble), you can run the following query:
SELECT COUNT(a), INET_NTOA(a) AS IP FROM `t` GROUP BY IP;
If you just want to see the IP's of each topic's poster you can run this:
SELECT *, INET_NTOA(a) AS IP FROM `t`;
IP's are only logged for threads - not comments, this is to insure backwards-compatibility with any current installs as it uses the un-used "a" column of the thread table. So you can replace your script with this one without any problems!
I had to remove the wrapping
<html><body> tags to make room. However, the script doesn't really need them, and now it can be included into a full layout better anyway. See the
index.php example below.
- removed unneeded
action="f.php"since browser default is "same-page".
I looked into using a "proper" test instead of the "A" name record check.
I thought about using PDO so we could get prepared-statements so that when PHP strip_slashes is off everything will still work fine.