Category Archives: CMS

Hello to Sam Hamilton and James Dee

So I was looking at the comments awaiting moderation. Two showed up on this post: Why Facebook sucks, a rollicking read about over-bearing security dialogues just to use Facebook’s video application.

Here’s the first comment — I’ve zapped the email address, but one was left:

Sam Hamilton 76.243.71.190
Submitted on 2009/05/29 at 9:37am

If you are tired of facebook but want a way to connect with artists and musicians
then you should check out http://www.putiton.com
If you are tired of facebook but still want to connect with your friends then pick up the phone…

Fair enough.

Here’s the second:

James Dee 75.85.9.225
Submitted on 2009/06/03 at 3:16pm

I’m an artist and I haven’t been satisfied using facebook or myspace to promote myself… too slow and too much junk. I’ll give putiton a try… it looks clean

The problem here is that the first comment is still awaiting moderation. (Yes, it’s several days old. I don’t check as often as I should.)

So why would “James” decide to try putiton, a social networking site which basically nobody has heard of (well at least I haven’t) if nobody else has suggested it (eg the first comment isn’t visible to anyone)?

Curiously, “Sam” and even “James” have left similar messages on other, similar posts on other blogs.

(Sam has a profile on the offending site.)

Slowing down WordPress spam

I noticed a lot of my WordPress spam is coming from a handful of IP address ranges. I’ve checked, and in the five-ish years I’ve been using WordPress, no valid comments seem to be coming from there. (Just tap the relevant IP address into the WP comment admin search box.)

Time for a little .htaccess magic, I think.

order allow,deny
deny from 194.8.75.
deny from 194.8.74.
deny from 87.118.112.
deny from 194.8.75.
deny from 194.8.74.
deny from 87.118.112.
deny from 61.18.170.
deny from 196.12.36.
deny from 219.64.175.
deny from 69.59.137.
deny from 80.88.242.
allow from all

By the way, in cPanel File Manager, to see .htaccess you have to switch on the option to view hidden files on the options page when you go in.

Anyway, the result is less spam, though there appears to be a rash of new attacks from a wide variety of IP addresses, with a shirtload of embedded links to upcoming.yahoo.com

Has my WordPress blog been hacked?

At some stage, some weird text seems to have inserted itself into a bunch of my links on my personal blog… a Get parameter referencing phpMyAdmin and a long hexadecimal string, which appears to be the same every time.

So for instance the link:
<a href=”/1995/12/22/the-bill/”>

became:
<a href=”/1995/12/22/the-bill/?phpMyAdmin=3bceb1b20913e8babce341325e13bf76″>

And this one:
<a href=”http://www.ptua.org.au/myths/energy.shtml”>

became:
<a href=”<a href=?phpMyAdmin=3bceb1b20913e8babce341325e13bf76″http://www.ptua.org.au/myths/energy.shtml”>

A Google search suggests that this specific parameter appears to be unique to my blog.

It mainly appears to have hit internal relative links, but has hit some external ones too. But it hasn’t affected all the links, by any means. Maybe a few dozen posts. And for the most part they are like the first example, above, and don’t actually break the links.

At first I thought it was a hack back at some time when I might have had a vulnerable version of WordPress on my blog. Though I’ve been unable to find any other examples of it (not that it’s the easiest thing to search for), and now I’m wondering if it was some mistake during a migration of the database.

Weirdness.

Something I don’t like about WordPress

I love WordPress.

But not 100%.

Something I don’t like is how it decides arbitrarily when to decide to re-authenticate you.

I had logged in here to write a post, and it happily let me type it all out, until I hit the Publish button, when it decided to double-check who I was. Which was fine, but by the time it had done that, it revealed that the draft of the post that had been saved was from several minutes before I’d hit Publish, and I’d lost a couple of links I’d put in which now I’ll have to find again.

Blargh.

The Triple J question

Trust Josh to ask a curly question for the StackOverflow podcast: “Why did the Stack Overflow schedule blow out?” and quoting back Jeff and Joel's own previous forecasts at them.

Made for an interesting discussion though. I certainly agree with the point that until you're actually working on something, you d

on't have a great deal of confidence in just how much there is to do … that becomes apparent as you go.

Transcript.

(So I can find it later: WordPress URL parameters, for example for showing all posts by Josh.)

zp8497586rq

Recent finds

Ever wonder how they fitted an entire computer language into just a few kilobytes, back in the 80s? Documented disassembly of BBC Basic 4.

How to highlight author comments in WordPress … but it relies on the author being user ID 1, so it won’t work here, where we have several people posting. Could easily be customised to look for other user IDs though.

Some developers are throwing in the towel and running Vista as Admin.

The excellent Secret Life of Machines not only has a web site, but is available freely (and legally) via BitTorrent. And the theme tune is available on iTunes.

Setting up Joomla on Windows

I had to do this recently. It’s not excessively difficult.

You can use this thing, but it’s really for dev environments.

WampServer installs Apache, MySQL and PHP. Easy.

Once it’s running, go into PhpMyAdmin and change the root password from the default (blank). You’ll need to update the PhpMyAdmin config too: this is in C:\wamp\apps\phpmyadmin2.10.1\config.inc.php — remember that this, like most of the files, is in Unix format, so you need to use a Unix-aware file editor. (Wordpad seems to be okay for this if you have nothing else installed, at least on Windows Server 2003.)

Download Joomla and chuck it into the root directory (default is c:\wamp\www)

Browse to http://localhost/

If Joomla tells you to change anything in the PHP setup, you’ll find it in C:\wamp\bin\php\php5.2.5\php.ini — though it seemed to take no notice when I changed magic_quotes_gpc as requested. Odd. I eventually found you can reset it using the WAMP5 tray icon: Left-click, PHP, PHP Settings. It then automatically restarts Apache to make it take effect. Neato.

The rest is easy… go through the Joomla install pages and it does it all for you. Then start figuring out your template and structure.

Still to figure out:

  • Contact page/email doesn’t work. Probably some hiccup with Apache not figuring out how to send emails from Windows… maybe I need to make sure the Windows IIS SMTP server is running or something.
  • Issues with .htaccess, needed to switch on friendly URLs (well, friendlier than those default Joomla/Mambo monstrousities)

Twitter to WordPress to Facebook

(Skip the lecture, go straight to the instructions — but note the update.)

I’m yet to be convinced that microblogging (eg Twitter, or those status updates in Facebook) is genuinely useful. Maybe, maybe not. But I’m willing to try it out.

Problem is of course that if you use multiple services, you don’t want to be having to update them all individually. If such a concept is going to work, you’ve got to be able to update once and have it cascade to everywhere.

Facebook has an app to push updates out to Twitter. Which would be fine, but for those outside North America, you can’t update your Facebook status from anywhere except within Facebook. (North Americans can use SMS from a mobile, but others can’t.) Okay, so maybe you’d want to do it mostly when in front of a computer anyway, but I do like about Twitter than you can update from anywhere… anybody can SMS a number (it’s based in the UK, so for me it’s costing 50 cents… so I’d better not go mad using it) so no fiddling with mobile web access just to post an update. Twitter also takes updates via IM (such as GTalk and Jabber). I also like that it’s open; people can see what’s going on without registering.

I normally hate words like synergy and leverage and convergence, but that’s what’s gone on here. Alex King has written code that updates WordPress from Twitter every 15 minutes. Christian Flickinger has written code that updates Facebook using PHP, with a hack using the Curl library (since Facebook doesn’t actually accept inputs like this) that logs into Facebook’s mobile web page and does the business.

And Blake Brannon has put the two together, so a Tweet (that’s Web 2.0 talk for a Twitter post) will cascade to your WordPress blog, and then on to your Facebook status.

Neato, huh? Now that really is leverage. If it works. Which it does for many people, but it didn’t for me. I was having problems with Blake’s code; probably an issue with my Web ISP’s configuration. I ended up splitting it off to a separate WP plugin, which was messy, but allowed me to use the code in isolation, and figure out the problem.

It may be an issue that only affects particular versions of PHP or Apache or something — I’m no expert — but the problem was the Curl call couldn’t write to the cookies file. Creating the my_cookies.txt file and making it writable (777) and modifying the code slightly to specify where the file lived solved it. Another issue involved Curl being unable to use the FollowLocation flag, but it turned out this wasn’t needed.

I also ended up with Blake’s (modified) code in a separate file to Alex’s, rather than inserted into it as Blake intended.

So in summary

Update 2007-08-31: Blake’s been told that automated access into Facebook is against the Terms of Service. It’s unclear if Facebook will actively go chasing those who use or distribute code like this, but it would seem to pay to be cautious. Sorry.

  1. Download Alex King’s Twitter Tools and put in your wp-content/plugins directory
  2. Download twitter-wp-fb.txt. Put your Facebook details in where shown, then put it into your wp-content/plugins directory
  3. Create an empty wp-content/plugins/my_cookies.txt file and make it writable (777)
  4. Go into your WP Plugins page and activate both Twitter Tools and WP/Twitter to Facebook
  5. Go into the Twitter Tools config page and enter your Twitter credentials
  6. Cross your fingers and post something in Twitter

I think that’s all the steps. Good luck.

Thanks to Blake for his assistance on this. And to Alex and Christian, whose code this is all built on.

Easy ways to save bandwidth

After reading Jeff Atwood’s terrific post about saving bandwidth on web sites I’ve moved the Geekrant RSS feeds over to Feedburner, using Steve Smith’s mavellous WordPress Feedburner plugin, which works in WP 2.0x and 1.5x.

I also turned on HTTP compression, which in WordPress is as easy as clicking a checkbox. It not only saves you bandwidth, but users get your pages served quicker, since the bottleneck is bound to be their bandwidth, not their browser’s ability to decompress.

We’ll see how it goes. Bandwidth has been growing recently: January 2.8Gb; February 2.7Gb; March 3.4Gb. It’s not at ludicrous levels, but if it keeps climbing, I’ll end up paying more for the hosting. Hopefully this will help bring it back down.

Update 8:40pm. First thing I notice is that when reading the feed from within the Feedburner site, it doesn’t treat relative paths to images properly. I guess I’ll have to put absolute paths, ‘cos at the moment in the previous post it’s trying to load http://feeds.feedburner.com/files/2007/mediagate-mg35.jpg instead of http://www.geekrant.org/files/2007/mediagate-mg35.jpg. I wonder how it treats relative links?

Counting things in WordPress

A couple of MySql queries to count up your 2006 blog stats (as I did on my personal blog).

Count the number of posts since…

select count(*) from wp_posts
where
post_status = ‘publish’
and wp_posts.post_date >= ‘2006-01-01’

Count the post with the most comments since…

select wp_posts.ID, count(*) as wpc, wp_posts.post_title, wp_posts.post_date from wp_comments, wp_posts
where
wp_comments.comment_approved = ‘1’
and wp_comments.comment_post_ID = wp_posts.ID
and wp_posts.post_date >= ‘2006-01-01’
group by comment_post_ID
order by wpc desc