Home » Articles posted by MIchael Fabbro

Author Archives: MIchael Fabbro

Vetting form input using PHP

Forms provide a really good way for a hacker to try and fiddle with the internal ‘gubbings’ of your PHP code both in a normal PHP software development situation and customising WordPress with PHP.

The following functions allow a PHP developer to clean up the form’s data before they start to process it with their PHP code.

  • trim –
  • stripslashes
  • htmlspecialchars

Typically you can cascade the piece of data from the form through these functions.

$formvalue = trim($formvalue);
$formvalue = stripslashes($formvalue );
$formvalue = htmlspecialchars($formvalue );

They can obviously be nested into one line for brevity:

$formvalue = htmlspecialchars(stripslashes(trim($formvalue)));

Using the above will  remove  characters  such as  space, tab and  newline. It will then take out any ‘\’ characters. Finally any html tags are neutralised by characters such as <> being  replace by their respective PHP escape codes. For example: &gt for the greater than symbol >.


Creating shortcut codes in WordPress

Simply in your theme’s function.php file add the following:

add_shortcode( 'fab-sc-helloworld', 'fab_helloworld');
function fab_helloworld(){
// add your code here
 echo 'hello world';

In a page or post using the text editor add the following line


Now view your page/post.

Once this is working, simply replace “echo ‘hello world’;”  with whatever PHP code you wish.


Adding a WordPress PHP file to a theme without FTP


Looking to add a  php file to your theme, but no FTP then try this. Some hosting servers will not let you do this for security reasons

In WordPress’ Dashboard’s  menu:

  • Choose Appearance/Editor then select your function.php  or header.php file.
  • At the top  add
    <?php touch(‘wp-content/themes/yourthemefolder/whatever.php’); ?>
    Obviously yourthemefolder and  whatever.php should be changed to your theme’s folder name and the new file name respectively.
  • Click Update and then view one of your web pages, this will execute the php line you just added.
  • Switch to the WordPress’ Dashboard’s  menu  and choose  Appearance/Editor again. You should now be able to see your new file in the list.
  • Re-select and edit the  function.php  or header.php file you used  –  remove the line you added above and then press Update.
  • Select your whatever.php file and start adding your content as normal.

This is useful to create different page layouts for the content area, i.e. page templates.


What is SEO Waffle? – This bit is!

Search Engine Optimisation WAFFLE! Try and avoid irrelevant website copy like this it will not aid the ultimate aim of the website page. You might think you are being smart, but what about the people who the site is really for? Ask yourself will they be impressed?

Why do you need this content? It is just a dash of UK content to give the SEO a little nudge. Doesn’t make for good reading? Remember good content needs to be placed before SEO otherwise your websites ultimate goal is compromised.

Ok here comes a good example of some flaky SEO Waffle

Why do you need an SEO website in UK?

With the demand for docks for coal exports and iron and steel manufacture, heavy industry played a major part in the development of UK. These days however, UK after much searching is more gently nested in the finance and business services sector, a sector that invests or is optimised heavily in web developments. UK is the principal finance centre in the region, This sector, combined with the Public Administration, Education and Health have accounted for around 75% of UK”s economic growth since 1991. Again heavy users of web technology. These sectors pragmatically use IT for sourcing – make sure you are in their sights.So whether your business is in industry or in finance and business services, MIchael Fabbro must be considered as your first choice when choosing a UK-based SEO, web developer.

This is not providing  a good experience for visitors!


SEO (Search Engine Optimisation) Website Developers’ Basic Rules

 Key words are the terms you think your prospective viewers will put in. They may not actually be the ones that spring to your mind. Think laterally, brainstorm – someone actually looking for fresh fruit may come across your website and buy your fruit bowls. However, search engine flavour sites, that is, you can be classified as an “engineering flavour site.” An optimised page you have about say “flowers” would be depressed in the ranking pertaining to flora while an optimised page about CAD would be flavour strengthened. Search engines are good working out that car and vehicle are similar, but it will help if you use them both when a searcher may use either.

Firstly, remember search engine use proprietary rules to rank sites to ensure the relevancy to any particular search term. These change so there is no substitute for:

  • good and relevant ‘key word ‘ page content in your site’s flavour. Content is everything so make sure you don’t simply paste in supplier’s blurb for a product. The chances are all your rivals have done the same thing, if yours is a bit different it’ll make you stand out during a search engine crawl. Blogs are good for the SEO ad hoc content, and wordpress website are good for blogs.
  • ‘Key word’ and trading sector relevant flavoured website linking to your website to enhance ranking. One method used is to use a link farm. These are SEO website purely set up in the topic area which point to your website. They have no other use. But! Be careful, using them can lead to your website being blocked. Try and get links from note worthy websites in your commercial, organisational or industrial sector. Check out what websites the competition is using for reciprocal linking. Geographic targeting could use websites of organisations like the Chamber of Commerce, Chamber of Trade, local business directories, A geographical link in websites like Yell may help. Simply email them and ask to exchange website links – they’ll know it’s about SEO trust me. Try placing your information on relevant blogs. Submit your website to local listings that many search engines have.

Many new fangle ideas that give your website an artificial boost are spotted by search engineers and then blocked from the ranking methods e.g. using link farms. Worse still your website may get blocked.

Some important website developers notes

Optimised each page for about three words. You can optimised more than one page with the same keywords strands, but don’t try to use different strands of optimisation in one page. e.g. a page optimised about “car performance exhausts” and page about “turbo chargers” are fine, but avoid trying to do both on the same page

  • Content Engagement – Search engines are cunning. They note the time between clicking on one link in their rankings and the time you take before you click on the next. That time is considered how long the site kept you engaged for the keywords. The more engaged people are the more likely the content is relevant to the keywords. This is a metric of website ‘worth.’ So once someone goes to your site make sure they stay and read or simply not go anywhere else. On this SEO web page my aim is to get people to contact me as soon as possible on arrival. The fact that a search engine will note that they did not return to ‘click’ the the remaining web site on the list helps to confirm this site is the bee’s knees for those key words.
  • Page Title: The <title></title> tags must describe the page accurately. Many engines use it to compose the site’s heading in their listing so include your primary keywords. It is the description used at the top of your browser window. It may also be used as the text label describing your page in a bookmark/favourite list. Use 6 to 12 words and keep it less than 64 characters in length. Try and repeat sensibly important keywords – “Cakes from the Cake Company.” “Cakes Cakes Cakes Cakes Cakes” will be treated as spam and ignored. Avoid ego titles – your or the company name for example. New customers are more likely to search for “car repair UK” than “Bloggs motors” The page title is the most important SEO tool available.
  • Page Heading: Make sure the first heading on your page is in a large font or set the format as ‘Heading one/H1.’ It must have the keywords in it near to the beginning.
  • As humans we tend to embolden or use a larger font for important items. A typical search engine will be aware of this so make sure that your keywords are emphasied in this way. So somewhere on this page I”ll drop the odd “as a UK-based search engine optimiser I am often asked the best way to get a sitehigh in the rankings” for instance. 😉
  • First paragraph: Make sure the first paragraph contains keywords, preferably near the beginning and also similar words in meaning to the keyword.
  • Rest of page: keyword relevant copy, keyword relevant copy, keyword relevant copy, keyword relevant copy and keyword relevant copy.
  • Description meta tag: use by some search engine listings to describe your website’s page. This may be what people read in the engines’; listings and thus can be used to tempt them to look and visit your site. Write one for each page – use at least one keywords near the beginning and up to 11 to 20ish words in total or 200 to 250 characters.
  • Keyword meta tag: list your most important keywords or key word phrases for insertion into each of the pages. Important words first. Just repeating keywords or adding irrelevant words is not going to work. Use between 7 and 48 words. e.g.:
  • “performance car exhausts, car exhausts, performance exhausts, exhausts”
    covers both keywords and keyword phrases.
  • In this pages case they were: “SEO UK, Search Engine Optimisation UK, SEO,Search Engine Optimisation,UK,website”
  • Some say ignore them as search engines like Bing and Google ignore them due to past misuse, for example, keyword like “Formulae one racing” on a poker gambling website. However, Search Engine Optimisation heuristics (rules of thumb) change, them may once again have an important role in optimisation. In any case its a good exercise to put them in to confirm your own web page keyword focus
  • Important: Get relevant website to link to your site. Commenting on relevant blogs can help advertise your website and may increase the all important Search Engine Optimisation links pointing to you. If geography is important make sure you are on regional websites and blogs
  • Name your folders, files and images using keywords e.g. carexhaust.jpg, carexhausts.html
  • Use keywords in the ‘alt’ description of images. Used by blind people, but they also tell search engines what’s in a picture. Describe the image with pages keywords at the beginning
  • Buy a ‘keyword rich’ domain name e.g. www.bmwcarforsale.co.uk
  • Keywords are best juxtapose, i.e. next to each other. So on this page you are seeing “SEO UK” and “Search Engine Optimisation UK.” in close proximity wherever possible. As you will see the exact order also has some significance in choosing their arrangement on a website’s page.
  • Optimisation may be fraught with trial and error costing time and money – pick a balance.
  • Make sure your website has a sitemap.xml file.
  • People have favourite engines – use more than one
  • To track your SEO efforts make sure you have “web analytics′ setup.
  • Press releases can be useful especially when they include a link to your site. The journal you send it to may include it and you then find that a keyword relevant article, maybe in a keyword relevant website has a link back to you. For instance, you run a UK-based B & B and a UK tourists;quot; site uses it for copyand links to your website – a spot on SEO led link I think.
  • Use your keywords as anchor text. These are intra-page links i.e. jumps within the page you can see an example here. SEO – Basic rules of optimisation

Some ideas that will help you promote your own website.

Direct Ways

  • Listed in search engines
  • Listed in directories, including local UK-based ones
  • Exchange Banners or links with other websites. A banner is a graphic that acts as a hyperlink. Usually the banner is a small advert.
  • Press releases to magazines and newspapers with the website address/URL included.
  • Pay for engine ranking.
  • Pay for adverts on search engines or other popular websites.
  • Facebook pages and adverts

Indirect ways.

  • Joining the relevant news groups and leave your address/URL in the message area
  • Mention your website in blogs
  • Viral Marketing.
  •  Direct mailing. Mail shot a letter or small card with your URL on.

Other ways of getting extra hits

  • Make sure the URL in on all company documents
  • Get them to book mark the website so they will repeat visits
  • Attract viewers with free software downloads, pictures, music or discount offers.
  • Twitter announcements
  • Facebook announcements

Cannot change the root folder in Plesk

If you get the message “It is impossible to change document root because there are web applications installed on this website” when trying to change the root folder in plesk, try this workaround.

  • Rename your domain from mydomain.co.uk to oldmydomain.co.uk
  • Create a new hosting for mydomain.co.uk
  • Point it to the folder you wish to use
  • Add any subdomains you had and point them to their new or original folders .

Checking if a URL has certain string within it using PHP

This PHP example checks the url has ‘fabbro.uk’ in it.

Alternatively you can shorten this to

if (strpos($_SERVER[‘REQUEST_URI’], “car”) !== false){
echo ‘string found’;

WordPress Health Warning

Plugins can degrade the performance of your site and some may have security implications. Delete any plugin you no longer use. It is suggested you keep plugins to a minimum and make sure you always update them when they have been updated. Remember that little red circle next to word Plugins in the Dashboard menu you sometimes see?  It means some plugins need updating.  See it! Do it!

Transferring files from your PC to the website server

Example features Windows 10

First load Windows file explorer (not Internex Explorer or any other browser). You can find File Explorer in the Start menu. Click in the large box just to the right of the name of the folder displayed, in the  case below “This PC.” It will then highlight blue as below:


Now simply type “ftp://” and the ftp address of your website. In this example ftp://www.yourdomain.co.uk. You may find it will be something like ftp://ftp.youdomain.co.uk. Finally, press enter:


You should see a pop up window. Enter the username  you were given and the password. You may save the password to be remember next time.  Finally, click “Log on”
In this example, having logged on the websver, folder mik can be seen on the  webserver. You may find many more folders.

To transfer a folder of files from your PC to the remote server you must find the folder with your files in the left hand panel.

To open up folders to view the sub-folders DO NOT click on the folder names, but use only the ‘>’ symbol (see above image) to the left of the folder’s name. We’ve made it red to standout.

The folder should then open displaying any sub-folders:
websiteserver5Then simply drag and drop the folder you want from the left panel (PC) to the right hand one (Server) in the normal Windows’s way:

websiteserver6Single file transfer

To transfer a single or multiple files simply resize the current window (with the server logged in) and open a new file explorer window of the same size and move along side the current window (server). Rearrange them side by side.

  • Find the files you want in the new window and drag and drop them between the windows.
  • You may also use the ctrl-C (Copy) and ctrl-V (paste) keys to make the copy as you might paste text etc between two open documents or spreadsheets.
  • The Windows keys for multiple select  (ctrl/alt and mouse click) also work here as usual.

Below you can see two file explorer windows open. The left is the PC and the right setup as the website server. The file icon or name (named ‘file to be transferred’) is simply dragged from the right panel of the left window and dropped from on right window’s right panel.  The view is set as icons below, but ‘details view will also work.


Moving and copying files using drag-and-drop.