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
Web Development

Placing an invisible validation link on a page

The HTML validator at http://validator.w3.org is a tremendous resource for web developers, helping us to ensure that our pages validate to the W3C standard.

Creating a Validation Link

Many developers place a link to the validator in the header or footer of their site so that they can demonstrate that their site is compliant.

1
<a href="http:///validator.w3.org/check/referer">Valid XHTML</a>

(The /check/referrer string tells the validator to validate what ever page the visitor came from)

Creating an Invisible Validation Link

Sometimes however, I like the link to be invisible, which I do be creating a link to a single non-breaking space entity. I use CSS to ensure that there is no underline and that the link doesn't stand out against a coloured background when the link is hovered over. Of course this means you have to know that there is an invisible hotspot at a certain point on the page. I often put it right after the text in my footer, as users don't often hover the mouse there. (All of this should be on on one line, I've put hard returns here only to keep it from scrolling out of the box.)

1
2
<a href="http:///validator.w3.org/check/referer" 
style="border-bottom: 0px;background-color:inherit;">&nbsp;</a>

Now there's an invisible validation link that I can have on my site throughout development for fast, easy validation checks. When the site goes live I can decide whether to leave it in or not.

Categories
WordPress

Limiting Revisions in WordPress

If you spend a lot of time revising a page or a post, you can build up quite a number of revisions in the database.

The following line in the wp-config.php file in the root of the site will limit the number of revisions saved to 5. You can use whatever number you want, within reason.

define('WP_POST_REVISIONS', 5);

Other tricks using the wp-config.php file can be found at http://digwp.com/2009/06/wordpress-configuration-tricks/.

Categories
DOS & DOS Scripting

Backup script

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
@echo off
rem :-----------------------------------------------------------------------------
rem : BACKUP SCRIPT
rem : This script was prepared for backing up a Windows XP computer
rem :   to an external hard drive.
rem : It will create a new folder named for the current date in the \backups folder of
rem :   the external drive, then copy the contents of the data folder on the computer.
rem : If the external drive ever fills up - unlikely - simply delete the oldest
rem :   folders from the backup folder to free up room.
rem : The script assumes that the external drive is drive letter K: and the
rem :   data folder on the source computer is "C:\Documents and Settings".
rem :-----------------------------------------------------------------------------

rem Set configuration - change these values if necessary
set backup_drive=K:
set source_folder=C:\Documents and Settings
 
title Data Backup

rem Remind the user to close all applications - open files may interfere
echo.
echo Preparing to backup computer data to external hard drive.
echo.
echo  - This backup may take several hours. It may best be done overnight.
echo  - All applications, including email, should be closed first.
echo.
echo Are you ready to proceed?
 
:loop
set Choice=
set /P Choice=Type [Y]es or [N]o and press Enter:
:: The syntax in the next line extracts the substring
:: starting at 0 (the beginning) and 1 character long
if not '%Choice%'=='' set Choice=%Choice:~0,1%
echo.
:: /I makes the IF comparison case-insensitive
if /I '%Choice%'=='y' goto proceed
if /I '%Choice%'=='n' goto skip
echo "%Choice%" is not valid. Please try again.
goto loop
 
:proceed
 
echo.
echo Proceeding with backup...

rem Change to backup drive and folder
cd /d %backup_drive%\backups

rem Create a folder for the current date and change to that directory
md %date:~-4,4%-%date:~-10,2%-%date:~-7,2%
cd %date:~-4,4%-%date:~-10,2%-%date:~-7,2%

rem Start the file copy
echo start &gt; start.txt
start /wait xcopy "%source_folder%" /E /C /H /R /Y
echo finish &gt; finish.txt

rem Advise user that backup is completed.
echo.
echo Backup is completed.
echo Files are stored at %backup_drive%\backup\%date:~-4,4%-%date:~-10,2%-%date:~-7,2%\
 
echo.
color 2f
 
goto end
 
:skip
echo.
echo All programs should be closed before this starts.
echo Please close all programs and try again.
goto end
 
:end
echo.
pause
Categories
Web Development

Color Schemes

Picking colors schemes (or colour schemes, in the Queen's English) can be difficult, and it's easy to fall into the bad habit of using the colors that have worked in the past.
The trick is to find a source for an online color scheme generator, which will let you browse through sets of complimentary colors to pick a color theme for your site.

Here are some great colour resources to help;

Keywords: color scheme, colour scheme, colour theme, color theme, colour set, colour set.