A Must With Any Windows System

You should NEVER use a machine with Admin privileges for everyday use. You should always use you computer using a restricted account and certainly not use the machine using your Admin Account unless you need to install software that you know and trust.

Using a restricted account vastly decreases your chances of being compromised with spyware/adware and other nasties as these generally need admin privileges to run. Although you must always remember that you are not entirely safe and you still need to run the appropriate anti-malware virus detection software but it goes a long long way to securing your Windows system.

Basic Windows Security

Windows is a magnet for viruses, spyware and other types of malware more than any other operating system.

Why you may ask?

Well the simple answer is numbers, Windows is by far the most popular operating system in the world and with this in mind it has become a magnet for organised crime to make money. Most malware that we are seeing at the moment is designed to make money, be it by stealing your bank account information or hijacking your machine to use as part of a ‘bot-net’ in order to attack other web sites or to spew out SPAM.

Many will argue that using Linux or Apple OSx is a far more secure way to go about your everyday surfing, whilst this is true because people tend to ignore them as avenues of attack it doesn’t mean they are totally secure Operating Systems! If your lucky enough to using an Apple Mac (I do recommend them over Windows – I have been won over!) then you can skip the next few paragraphs although I would read the Safer Browsing paragraph below. Windows users please please read on!

You really must have 3 basic applications installed with your windows setup

  1. A Firewall
  2. Virus Protecton
  3. Anti Spyware / Malware program


Windows XP service Pack 2 comes with its own built in firewall which is enabled by default. However the one snag is that it does not check out going connections from your computer. As such it is advisable to obtain a third party firewall or internet security package.

There are many on the market with the four big commercial products being:

McAfee Internet Security Suite

Norton Internet Security 2007

Trend Micro Internet Security

A Excellent Free Firewall

The Comodo Firewall is a great free bit of software that does just a good job as any of the paid for Firewalls. Here are two good reviews one from mbalat’s blog and another one from PC Magazine.

Virus Checkers

All of the above packages come bundled with Virus Checkers as well but you can also get a free virus checker from AVG

I have just discovered Avira AntiVir which seems an excellent package and didn’t take up to much of my system resources something which McAfee seemed to do on a regular basis!

Anti Spyware Packages

The major Security suits come bundles with anti spyware software (McAfee, Norton and Trend) but AVG also have a free anti spyware offering as well as their Virus Checker. Commercially Spysweeper from Webroot is a good product to look at.

You must bare in mind though that having anti-virus, spyware and firewall software does not mean that you are immune to attack. You still need to exercise caution when opening potentially harmful files and remember be on your guard and don’t fall fowl of social engineering tricks. Never open an email attachment that is delivered unexpectantly and most of all always always look at an extension of a file which can be identified by the last three characters of a file.

For example these files can potentially be dangerous:

  • .exe
  • .src
  • .pif
  • .vbs
  • .js

I have noticed a few emails from time to time that append two file extensions to a file eg yourmusic.mp3.exe. This is an .exe (executable file) and not a MP3 file so be careful!

Safer Browsing

Although by its very nature browsing the internet will never be 100% secure you can go a long way to protecting yourself.

First and foremost make sure Windows is up to date. Visit the Windows Update Site and check if your version of windows is fully updated.

Upgrade Your Browser

I recommend that you download Firefox and use it in conjunction with the NoScript extension. NoScript allows you to block javascript being executed on webpages you visit whilst allowing you to accept javascript for trusted sites such as the BBC or this site!

Resetting MySQL Auto Increment Field

After developing a number of systems in the past it is of course essential to completely test any piece of software. This of course means that any tables that use an auto_increment field will not start from 1 when the system goes live. Not a massive problem but it is nice sometimes to reset the value to 1.

After searching around the web what seemed like an age I finally found the SQL that carry s out just the job.

Enter the following statement into your MySQL database replacing tablename with the name of your table and the value x to the number you want the AUTO_INCREMENT value to start from:


There you go the AUTO_INCREMENT field in this case will now be reset to 1

Connecting to MySQL with PHP

Connecting to a mysql database is pretty easy using php as it gives you all the commands you need in order to do it. This example is a basic way to do, there are other methods but I found this way useful when I was just starting out!

Here is an example of connecting and quering a mysql database

I usually store my connection attributes in another file and use a php include to call them. For added security I store my database connection details outside the web root.

The Include File

Create a new php file and call it something obscure as this, I always do this from habit, I never call my include file DatabaseConnect.php for example, if someone was browsing it would give the game away!

For now create the file MyCat.php and save it outside of your document root, for example in windows you could store it in c: and on a linux system in /home/me/ for example.

The MyCat.php file

Now when connecting and querying a database you would include the above file

This is now easier to manage as well, if you have multiple scripts that connect to a database then there is no need to keep adding your database connection information to the start of each script, you just have the one line to include it!

Basic PHP – Assigning Values to Variables

Adding values to php variables is simple as the following examples shows

$name = "Bobby";
$age = "30";

The example code above will add the value Bobby to the variable $name and 30 to the variable age. You can print the value of the variable out to the browser by using the echo statement as follows.

echo $bobby;

Further to this we could add this html to a page.

Hi my name is <?php echo $name;?> and my age is <?php echo $age;?>

This will print out Hi my name is Bobby and my age is 30