Archive for the ‘Development’ Category

ParcelForce expressLink API Integration

Having recently worked on integrating ParcelForce’s expressLink web service for a client there appeared to be very little online about how to work with this service using PHP. The following code shows how we set this up using the NuSOAP library. Note the below uses the expresslink test server. If you need a development team [...]

PHP Currency Conversion – Exchange Rates XML

With this script you can freely convert between 36 different currencies from around the world. The script uses exchange rates downloaded from the European Central Bank via an xml file located at www.ecb.int/stats/eurofxref/eurofxref-daily.xml. The rates are then stored in your own MySQL database for use and then updated daily. Example: £2.50 = $4.03 If you [...]

Screen Scraping AWStats

If you need to fetch statistics and information from your AWStats in order to re-use or integrate the data into another web application then you can do this by screen scraping the required information. The following scripts allow you to fetch unique visitor numbers and phrases for which people have come to your site after [...]

PHP Password Generating

This script allows random passwords to be generated of any required length with any combination of characters. Randomly generated password: m1ztpxw8 The code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 <?php function genPwd($length=6) { $password = ”; $possible = ’23456789bcdfghjkmnpqrstvwxyz’; $i = 0; while ($i < $length) { [...]

Controlling Font Size With Javascript

The following script can be used to allow visitors to increase or decrease the size of text on your page. This can be useful for visitors who have trouble reading smaller text and allows them to increase it to something they can view more easily. This script will change the font size of any text [...]

Resizing images with PHP

The following script will easily allow you to resize images using PHP. The code 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 [...]

PHP Captcha Security Images

This script generates images (known as “Captcha’s”) which contain security codes used for protecting a form from spam bots. By encoding a ‘password’ inside an image and asking the user to re-enter what they see you can verify the user is a human and not automated software submitting your form. Why not try out the [...]

Javascript Validation

Try testing the following form with valid and invalid email addresses. The code uses javascript to match the users input with a regular expression. Email: The code 1 2 3 4 5 6 7 8 9 10 function validate(form_id,email) {   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; var address = document.forms[form_id].elements[email].value; if(reg.test(address) == false) {   alert(’Invalid [...]

PHP Captcha Security Images Help

Firstly make sure you are using the latest version of the captcha script available on http://www.white-hat-web-design.co.uk/blog/php-captcha-security-images/ Check you have the required GD & FreeType libraries. This can be done by putting the following in a new file and checking the output mentions GD & FreeType 1 2 3 <?php phpinfo(); ?> Perl Formmail Unfortunately this [...]