Skip navigation

You don't need to ConvertToPHP just to use includes

I have seen countless threads on the various forums from people who are asking for help because their member lists don't show in whatever popular fanlisting script they're currently using. When asked for their code, 9 times out of 10 it looks like this:

if(!$_SERVER['QUERY_STRING']) { ?>

Here are all my members!!!!
[Insert member list code here]

<? } include(''); ?>

Can you spot what's wrong with that?

If you can't, here's the answer. Most fanlisting scripts use the query string (that's the bit that comes after a ? in a URL, such as country=USA in a URL like members.php?country=USA) to display members from different countries. The code there includes a line which says if (!$_SERVER['QUERY_STRING']) { which means "if there is no query string, do the following..." ... and the person has stuck their member code in the "do the following" bit (signified by the { and }). The members list WILL fail here, because it relies on the query string. If you tell the members to only show when there is no query string, it will break when you attempt to go to a country.

Now the reason this is happening so often is because it seems that people think "ooh I need a PHP page... How do I do that? Ah, NL-ConvertToPHP." This is wrong, people! All you need to have a "PHP page" is to give it a .php extension. If you want headers and footers (which NL-Convert uses as well), there are millions of tutorials on how to do this online. Don't assume that just because that script is called "ConvertToPHP" it is the be-all and end-all of how to make PHP pages.

Oh yeah, and I have internet again. Just in case anyone was wondering.

How to change your WordPress username

Sick of using the name 'admin' to login to your WP installation? Have a user with the login 'PiNkbUnNiEz!1" but want to change it without that user losing all their posts/creating a new account etc.? Tried to do it but found the field disabled in your WP admin panel?
Here is what you need to do.

  1. Before you do anything, backup your database. If you don't know how to do this, ask at the WP forums or Google it - there are some plugins that will do this for you if you don't have access to things like phpMyAdmin (a MySQL tool which can be used to backup your database - Jem has a tutorial on this which may be useful)

  2. Paste this into a file. Name it anything you like, as long as it has a .php extension:

    $existing_username = 'admin';
    $new_username = 'MY_NEW_USERNAME';

    // —————

    if (!file_exists('wp-config.php')) exit('Could not find wp-config.php, please make sure you place this file in the same directory as all your WP files.');

    require 'wp-config.php';

    $link = @mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD);
    if (!$link) exit('Could not connect to MySQL');
    mysqli_select_db($link, DB_NAME) or exit('Could not connect to MySQL');

    if (mysqli_query($link, 'UPDATE `' . $table_prefix . "users` SET `user_login` = '" . mysqli_real_escape_string($link, $new_username) . "' WHERE `user_login` = '" . mysqli_real_escape_string($link, $existing_username) . "' LIMIT 1")) echo 'Username updated, your username is now ' . $new_username . '.';
    else echo 'Could not update your username. MySQL said: ' . mysqli_error($link);


    Change the first two lines (excluding the one that says '<?php', obviously :P ) to your existing username (probably admin) and your new desired username. Save the file, then upload it to your WordPress directory. Make sure this file is in the same place as wp-config.php.

  3. Go to the file in your browser, e.g. yoursite/wordpress/the-file.php and voilà! :D

Akismet for Guestblock

I'm not sure if anyone else has done this or not, but since my Guestblock started getting ridiculously spammed yesterday (I've only had it about 2 weeks!), I decided to do something about it. The built-in spam protection wasn't working, and blocking IP addresses is about as useful as telling those spammers how naughty they are for leaving their messages all over your site. Tut.

Sooo. After successfully implementing Akismet into my CMS a while ago, I wondered whether I'd be able to do the same for Guestblock (the main site is kind of dead right now). Lo and behold, I have successfully done it.

If anyone is interested in the modification for their guestblocks, let me know. Please note that in order to use the Akismet anti-spam system you must have an account at


Older Entries | Newer Entries