Categories
Uncategorized

Deleting or renaming the Admin account in WordPress

The admin account in WordPress is an inherent weakness because it's the first thing a hacker will go after.

There are a couple of ways to solve this, both involving replacing the 'admin' user with something not quite so obvious.

The Expert Way

If you're comfortable entering an SQL query in phpMyAdmin or another MySQL interface tool, the following query will deal with it lickety-split by renaming the account.

UPDATE tableprefix_users
SET user_login='newuser'
WHERE user_login='admin';

The Not So Expert Way

It that makes your eyes glaze over, the alternate is almost as easy.

  • From the dashboard where you edit your profile or create posts, select Add New from Users menu.
  • Create your replacement account. Pick a name that works for you. 'Hippo', 'Aardvark', whatever. Create the account, assigning it Administrator privileges.
  • Log out and log back in with your new account.
  • Go back to the Users menu, click Authors & Users, and hover the mouse over the admin account row.
  • Select Delete from the menu that appears when you hover over Admin.

That's it.  You've replaced your admin account with something that's not going to be so easy to guess, and closed a security weakness for your blog.

Categories
Uncategorized

Use Synergy instead of a KVM Switch

If you've ever wanted a KVM switch, forget about it.  Synergy, an open source tool, replaces a KVM with a free software solution.

A software-only solution, it communicates across the network instead of through dedicated cables, so you can reduce your cable clutter.

Simply tell the configuration where the computers are located relative to each other (i.e. "laptop is to the left of desktop and desktop is to the right of laptop.)

As soon as the mouse passes the edge of the screen, it goes to the other computer mouse and keyboard now act on that machine.  As I write this post my laptop's external monitor is to the left of my desktop, and my server monitor is to the right of my desktop monitor.  One sweep of my hand and my mouse passes across all three monitors.

You can even cut and paste across computers.  That feature is a little buggy, but that's the worst thing I can think of to say about this little gem.

If you're using Vista, be sure to set AutoStart to "When You Log In" instead of "When Computer Starts".  You may also need to disable UAC.  I haven't tried it on Windows 7 yet, but I'm going to guess that the same would hold true.

This would be worth real money, but as open source, it's free, so just enjoy it.

You can download Synergy for free here.

Categories
Uncategorized

Using an associative array to replace text in PHP

Imagine you have to write out some attribute names from your database, but want to replace them with more user-friendly versions. For instance, "First Name: " rather than "fname".

An assocative array in PHP will do the trick nicely.

For instance:

1
2
3
// labels array will be used to replace the database attribute names with field labels
$labels = array("lname"=>"Last Name","fname"=>"First Name");
echo "This line displays the ".$labels["lname"];

returns

This line displays the Last Name
Categories
Uncategorized

PHP's empty() Function

This code snippet from http://php.net/empty illustrates a very useful function that helps eliminate some of the ambiguity we sometimes encounter with variables that have no value or boolean zero value.  The comments in the snippet explain it pretty well.

 

1
2
3
4
5
6
7
8
9
10
11
$var = 0;
 
// Evaluates to true because $var is empty
if (empty($var)) {
    echo '$var is either 0, empty, or not set at all';
}
 
// Evaluates as true because $var is set
if (isset($var)) {
    echo '$var is set even though it is empty';
}

[ad]

Categories
Uncategorized

ActiveX Error in Microsoft Outlook Signature Blocks

Signature files in Microsoft Outlook can pick up an aggravating ActiveX error, which I have associated with editing the signature file in MS Word but may also have other causes. A little edit to HTML source file will chase the message away without compromising the formatting of your signature file. Here's the Error Message:

One or more ActiveX controls could not be displayed because either:
1) Your current security settings prohibit running ActiveX controls on this page, or
2) You have blocked a publisher of one of the controls.
As a result, the page may not display correctly.

 

The Solution:

Start by opening the folder that contains your signature files.

  • For Vista:
    • %userprofile%\AppData\Roaming\Microsoft\Signatures
  • For XP and Windows 2003:
    • %userprofile%\Application Data\Microsoft\Signatures

Copy the appropriate line, click Start > Run, then Ctrl–V or otherwise paste the text onto the Run line and press Enter.

You'll see 3 versions of your signature file (in .htm, .txt and .rtf formats). Open the .htm signature file in Notepad or your preferred text editor (never in a Word Processor such as MS Word.) Then go to Edit > Find and type in “<object”.

You're looking for a line of code that resembles the following:

<OBJECT id=ieooui classid=clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D></OBJECT>

Just remove that <OBJECT tag, everything from <OBJECT to /OBJECT> and save the file.

Optionally, to make sure that the ActiveX object doesn’t come back you can make the file read only (In Windows Explorer select the file and Right-Click > Properties > Read Only), but this might limit your ability to edit your signature block from within Outlook, so I'd wait and see if this fix holds before I do that.