Category: PHP

Auto update multiple installs of WordPress with cron/ssh via bash script

With WordPress being updated more frequently than ever with new security fixes and features it’s important to keep you site up to date with the lates version of WordPress. Running one update is easy and quick enough but if you have a dozen or more WordPress sites on one server you can update them all […]

PHP Spam Blocker

If you have a problem with Bot user’s and spam in WordPress the best solution is setting up Akismet. It’s an easy to use plug-in that just needs an API key. For Bespoke websites there isn’t a one click plug-in but there is a super easy to use Bot database called BotScout with an API […]

PHP and dynamic URLs

Whenever I make a new website now I always think about what the urls will need to be like. Most off the shelf CMS platforms will have a plug in or option to enables similar functionality.  But if your writing the site yourself you will want to be able to convert URL from post Id’s […]

Google Charts Example

API’s are becoming more popular on the web as many of the big online companies such as Google, Yahoo and Facebook offer there own open source code for web developers to use freely and easily. To begin with I am going to go through how to use the Charts Basics API from Google. This is […]

Random Banner with PHP

This is a quick tutorial which shows how easy it is to make a random banner script with PHP. We will use a PHP array of images which is populated by a given directory and select a random index from the array to be the banner. For this example I have chosen to list the […]

Shorthand boolean IF with PHP

This is a good alternative to using a basic IF condition. It basically fits the whole thing on a minimal line of code. It is an  easy way to compare two values and select the right one. There are a few ways to use this but the basic jist of it is to compare two […]

SEO Friendly Redirects with PHP

With a basic redesign you probably wont have this problem but if you have rebuilt a website even with the same content if the URL’s have changed this will have a huge effect on your search engine presence as you will be starting from scratch. Your links from internal pages may not work, links from […]

Tracking visitors with PHP and Predefined variables

Although Google analytics can tell us a lot about who is visiting our websites it is still flawed in many ways. Google analytics is a powerful tool but if the user has disabled Javascript or you want to know live stats it can be pretty useless. Developing our own can be much more versatile as […]

PHP foreach loop through post request

I use a variation of this code on most websites I have coded as it is versitile and full of uses when working with dynamic content. An example might be reusing the same mail() function for differant forms, you could loop through what is posted to it and print it out in the body of […]