Posts Tagged ‘PHP’

Bookmarklet generator

Saturday, May 31st, 2008

Bookmarklets (or favelets) are bookmarks that use Javascript to do something more than simply opening a static page. They're particularly handy if you regularly search the same websites: rather than opening the website in question, clicking in a search box, entering a term and clicking another button you can simply click a button on your browser, type the search term then press enter. Here's a sample bookmarklet that searches Google Product Search.

Anyhow, here's a tool to make your own.

Enter a name for the bookmarklet here ("Search Google")

Enter the prompt you want to appear ("Search for..")

Finally, enter the search address (see below)

And clicky here:

Finding the search address, the geek version:

Paste in everything that you want to appear in the URL before the search term. This is normally the website address, plus a bit of querystring, so something like http://www.google.co.uk/search?q=

Finding the search address, in English:

To find the search address, go to the website and search for something. Look at the address of the webpage that this produces. If you go to Google.co.uk and search for "banana", for instance, you'll get a page with an address like this:

http://www.google.co.uk/search?hl=en&q=banana&btnG=Search&meta=

Look at the information included after the main address and you'll see the word you searched for. Now select and copy everything that's listed before this word. In this case, we'd copy:

http://www.google.co.uk/search?hl=en&q=

This should be the search address. If you're not sure, try pasting it into the address bar, typing another word on the end, then pressing Enter. For example, we added "typewriter" to give this address:

http://www.google.co.uk/search?hl=en&q=typewriter

This took us to the page of results for "typewriter", so we know that we've correctly identified the search address.

Starting fresh

Thursday, November 15th, 2007

This evening I discovered that the old front page of this site, which contained a couple of links to other content held on my server, had been hacked. Not particularly badly - some evil person had managed to edit index.html and add some links to extremely dodgy porn sites at the very bottom of the page. The good news: these links weren't visible. The bad news: because they weren't visible, I hadn't noticed them. Google's cache suggests they've been on the page since at least the 8th of November.

Obviously, I don't know how this happened. It could be something to do with the Fasthosts hacking incident - I received an email from the firm telling me to change all my passwords, which I did as soon as possible - or maybe one of my PHP scripts, or a PHP library, was vulnerable. In any case, it's a pain. I've now changed my passwords, again, erased all the sites running from this server, blanked the SQL databases and reinstalled Wordpress. What fun.

So - hopefully I'll have time to reinstate some of the content from the old site in the near future. I'll also put the old CSS design, or something like it, back as soon as I can convert it to a Wordpress theme. For the meantime, though, this is it.