Blog | Admin | Archives

Tweakage

Props to whoever discovers and identifies the recent changes to the ‘blog. I’m looking for two items.

Seamless PHP 5

Unfortunately as I learned about a week ago, PHP 4 and PHP 5 don’t happily co-habitate. However, the switch between the two is about as seemless as possible. Compiling PHP 5 with the same config string as I used for PHP 4, I was able to switch over by simply changing a comment in my httpd.conf file from:

LoadModule php4_module modules/libphp4.so
# LoadModule php5_module modules/libphp5.so

to

#LoadModule php4_module modules/libphp4.so
LoadModule php5_module modules/libphp5.so

Linux isn’t always great, but sometimes it sure rocks my socks.

Referer Spam Countermeasures

Like all spam, referer spam takes what could be useful – in this case, information where people come from to a site – and make it mostly useless – just more links for google to index. However, one of the unique aspects of referer spam also makes it easier to counter than many other types of spam. Generally, referer spam must surpass a threshold – usually, the top ten referrers, to be listed at all on a site. This means that instead of spreading out the referrers, referrer spam generally all points to one place. Which makes it easy to implement a simple anti-referer-spam script like the one I came up with to help fight referer spam on Theo’s blog:

// Ryan's anti-spam hack starts here
$spam_words = file('spam_words');
if(isset($_SERVER['HTTP_REFERER']))
{
foreach($spam_words as $spam_word)
{
if(stristr($_SERVER['HTTP_REFERER'],rtrim($spam_word)) !== false)
{
die("You look like you're trying to refer spam this site with this word: $spam_word".
'If not, sorry for the inconvenience and please '.
'<a href="'.$_SERVER['PHP_SELF'].'">click here to continue</a>');
}
}
}
// End Ryan's anti-spam hack

Then, as a companion, a post-facto script that can be called from the command line or from the web:

<?php
require('./conf/_config.php');
mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
mysql_select_db(DB_NAME);
$spam_words = file('spam_words');
foreach($spam_words as $spam_word)
{
// echo $spam_word;
$spam_word = rtrim($spam_word);
$sql = "DELETE FROM `evo_hitlog` WHERE `referingURL` LIKE '%$spam_word%'";
echo $sql . "n";
mysql_query($sql);
}
?>

Then, the admin can simply periodically check their top referer output, and if they see a bad guy creeping up, add an appropriate word to their spam_words file and run the killoldspam.php script. The bad stuff goes away and can never come back. Best of all, its not very intrusive to the average visitor, even when they are accidently flagged. Javascript or a meta or http redirect could make it less annoying still.

Double-O-Seven (0:07)

Ok, I just noticed something really wierd. All my posts on the main page say they were make 7 minutes after the top of the hour. Then every post made in June says it was 6 minutes after the hour… and May is five minutes… so, um, yeah. When did that happen?

UPDATE

With some timely help from the great and humble Theo, I was able to quickly track down the problem in my options. Somehow, I ended up with months for minutes and didn’t realize it. I haven’t changed those options, that I remember, for quite some time, so I must have really missed something or recently screwed it up without realizing it.

But now the mystery is solved. Thanks for tuning in.

For a while there, I guess everyone just believed that I was a crazy-consistent blogger of some sort. Ha.

Left Side Menu

I finally got down to it and moved the menu to the left side. It was a gradual process actually, but I think I finally did it in a good manner. Bernie’s comment on my last post on this subject led me to believe that I was indeed attempting the right solution when I was using float: left; in my CSS file, but that I had simply overlooked something. After some careful bookkeeping, I discovered the problem, and went on to make the index file more robust while I was at it. So now the menu is happily on the left, and I think it looks pretty good over there if I could say so myself. Thanks, Bernie!

Room for the Future

I recently added an old 30gb 5400 rpm drive to sf2, giving me room to upload many of my photographs. This allows two important possibilities straight off – first, it is a good way to back up my several gigabytes of pictures. Second, it provides a more accessible, nicer interface with which to view these pictures than does Windows.

If you want to take a peek, head to the Gallery.

CSS woes

If web standards really are all they are cracked up to be, then why is it that only Internet Explorer does what I expect when I try to adjust the layout of this site? Why will I have to spend frustrated hours reading through examples to get the menu on the left? What am I missing about positioning?