Harry Bailey

Harry Bailey specialises in turning project chaos into clarity. With two decades of hands-on agency experience and agile-certified expertise, he offers practical, immediately actionable strategies, not just theory, to dramatically improve agency project delivery.

WorldPay Response URL and Shopper Return for Thanks

Update May 2011 – This may be against terms and conditions. See Martin Brown’s comment below

It took a while to get my head around it, so here it is incase I need it again.

Integrating with WorldPay is not the simplest of tasks. The documentation is poor at best.

I was integrating by using a form on my site, which posts the order total and an order id etc to WorldPay. WorldPay then deal with taking the money from the user. What I couldn’t understand was how to get the user back to my site for thanks after they had paid.

Turns out it’s quite simple.

Continue reading

Setting File Owner in Terminal

Sometimes OS X won’t let you change the owner of file using Finder. Annoying. Here are the simple steps to do it in Terminal.

First if you are just looking for the command it’s:

sudo chown -R _new_owner /root/to/file.txt

Where _new_owner is the name of the new owner you want to assign to the file

Now the steps:

1. Open Terminal, which you will find in Applications -> Utilities
2. Type in sudo chown -R _new_owner
3. Type the file path OR drag the file from finder onto the line after _new_owner to make the path appear.
4. Hit the enter key
5. You may have to type your OSX login password if prompted
6. Repeat for any other files you want to change

Mime Type List and File Extensions

A lovely long list of mime types along with their extensions.

If you find any errors or know any extensions and mime type pairs missing be sure to let me know.

It’s in php array format for your convenience.

$mimetypes = array(
‘3dm’ => ‘x-world/x-3dmf’,
‘3dmf’ => ‘x-world/x-3dmf’,
‘a’ => ‘application/octet-stream’,
‘aab’ => ‘application/x-authorware-bin’,
‘aam’ => ‘application/x-authorware-map’,
‘aas’ => ‘application/x-authorware-seg’,
Continue reading

Getting Apache 2 to play nice with Virtual Hosts

If you’re a web developer and you can only get the first Virtual Host to work in your new Apache 2 local setup, it’s very simple to resolve.

Thanks to Alex King for the solution to fix Apache 2 only serving the first virtual host.

Basically the NameVirtualHost must match the value you use in your virtual host declaration, be it *, 1.2.3.4 or example.local

NameVirtualHost *
<VirtualHost *>
</VirtualHost>

You get the gist.

Using PHP_SELF Safely and submitting forms to the same page

I’ve lost count of the number of times i’ve seen this bit of HTML / PHP:

">

Looks pretty harmless doesn’t it, but it is a pretty dangerous shortcut to use. Imagin I get a user to visit the page the form is on by following this link, maybe hiding it in a short url:

http://example.com/formpage.php?"> 

where I’ve added some html into the url which contains a script tag.

I could use this method to grab all your cookies and log in as you, or send ajax requests back to the site on your behalf. All very frightening. The quick solution is to turn html characters into their harmless entities using the php function htmlspecialchars. So the code would be


But wait! The best way to submit to the same page with a form is to use and empty action attribute. It’s valid and it works.


Don’t believe me? Go tell Jesse. He also wrote about empty action attributes.

[carousel keywords=”php” tag=”fetchit-21″]