Cleaning up A**hole Spam in PHPNuke

When setting up PHPNuke, you really have to remember to turn on captcha checking for registrations first thing in config.php (gfx_chk). If you don’t, you’ll get pummeled with comment spam in a matter of hours.

If, like me, you messed up and forgot to, you’ll have to delete those bogus accounts, and delete the comments. Deleting the comments can be tedious. So instead, run a command from a unix shell to generate some html content that will make your life easier…

mysql -u dbusername -pdbpassword dbname -e ‘SELECT tid,sid FROM nuke_comments;’ | grep -v tid | awk ‘{print "<a href=\"http://yourdomain.com/admin.php?op=RemoveComment&tid=" $1 "&sid=" $2 "&ok=1\">http://yourdomain.com/admin.php?op=RemoveComment&tid=" $1 "&sid=" $2 "&ok=1</a>"}’

This will output a bunch of HTML that you can insert into a page. Click on each of those links to delete a comment. Much quicker than searching for them all.

Now, I suppose someone could write a PHP module for Nuke that would automate this. I’m just too lazy to ;-)

Windows is Bad for Bind Zone Files

A buddy of mine was recently setting up bind on his linux box and had an issue. His zone files wouldn’t load without spewing out errors:

Jun 8 10:33:05 server named: hisdomain.com:18: unknown RR type ‘host1’
Jun 8 10:33:05 server named: hisdomain.com:19: unknown RR type ‘host2’
Jun 8 10:33:05 server named: hisdomain.com:20: unknown RR type ‘host3’
Jun 8 10:33:05 server named: hisdomain.com:23: unknown RR type ‘host4.hisdomain.com.’
Jun 8 10:33:05 server named: dns_master_load: hisdomain.com:24: isc_lex_gettoken() failed: unexpected end of input
Jun 8 10:33:05 server named: dns_master_load: hisdomain.com:24: unexpected end of input
Jun 8 10:33:05 server named: hisdomain.com: file does not end with newline
Jun 8 10:33:05 server named: zone hisdomain.com/IN: loading from master file hisdomain.com failed: unknown class/type
Jun 8 10:33:05 server named: _default/hisdomain.com/in: unknown class/type

Fun stuff. After messing around with his domain files for about an hour, I realized something. There were all these excessive spaces after each line. So I opened vi and proceeded to remove them all, as well as replacing spaces in the doc where a tab should be. Lo and behold, it loaded fine.

It appears the the root of the problem were those "spaces" at the end of the line. I figure they were probably DOS carriage returns created my some lame windows text editor. Once removed, the file loads fine.