A fragment of PHP that really shouldn’t work. I hope nobody ever finds a use for this:

switch($n)
{
    case 1;
        echo 'one';
        break;
    case 2;
        echo 'two';
        break;
    case 3;
        echo 'three';
        break;
}

Hi
Can anyone help me handel this URL injection ?
https://www.xxx.co.uk/register.php"| grep "123"
I want to detect it and header back to my index page.
It's quite urgent
Thanks for help

Heh. Poor guy.

I was poking around in Google Maps tonight, and discovered that the “Link” button contains a reference to the last map you looked at, as well as the current one.

Steps to replicate:

Go to http://maps.google.co.uk/ and search for “Birmingham”

Now search for “London”

Click “Link”. The link should look something like this:

http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=London&sll=52.487798,-1.893768&sspn=0.262996,0.617981&ie=UTF8&ll=51.510452,-0.126343&spn=0.537601,1.235962&z=10&iwloc=A

If you snip out the sll attribute (52.487798,-1.893768) and feed it back into Maps, you’ll find it’s the lat/long for Birmingham, not London. I think it’s intentional, because the ll attribute points to London. I can’t see any obvious use for the sll attribute, though - there doesn’t appear to be a back button or history tool on the target page.

Not a big deal, but it could conceivably be an embarrassment to someone, some day.

Check this out:

if (isset($a, $b, $c))
{
    unset($a, $b, $c);
}

Mulitple arguments. Looks like they’ve been there since an early PHP4 release, at least. Why does nobody tell me these things?

The problem:

If you include() or require() files with relative paths, APC will search the include_path on every request, and you won’t gain the full benefit of turning apc.stat off.

Using absolute paths portably in your own code is easy - just use a constant, eg. “require APP_PATH . ‘file.php’;”. External libraries, however, are harder to deal with - you either accept the performance hit, or go through them adding constants by hand (and merging your changes every time there’s a new release).

The solution:

This script rewrites PHP scripts, turning relative paths into absolute paths, allowing you to deploy third party libraries within your build process and still take full advantage of APC.

Some caveats:

It reads from stdin and writes to stdout.

It relies on it’s own include_path; in the real world, you’ll probably want to pass that in on the command line.

It only deals with the most common subset of include statements (variations on T_INCLUDE, T_CONSTANT_ENCAPSED_STRING, T_SEMICOLON).

The Windows support is a bit wing-and-a-prayer.

It’s memory-greedy when dealing with very large files.

It doesn’t play 100% nicely with safe_mode_include_dir.

Thrown out there in the hope it will be useful to someone. I’d be delighted to accept any feedback or additions anyone wants to offer.

Mauve Internet over in Chichester is growing, and is looking for a Junior Python Developer. If you know anyone who might be interested, please forward the link to them.

Quick Link

Matt Jones on the advantages of “Good Enough” in location-based services. (via)

I think lifestreaming might have something to learn from this approach.

Discovery, BBC, Guardian, Discovery Again, Wikipedia, Independent

Processing Blobs

As Processing recently hit 1.0 I thought I’d take a quick look. It seems to work on the same principle as a unit test suite or a web framework - you develop “inside” the library, so it can abstract all that Java complexity away from you. Fill out setup() and draw() methods, press a button to run, press a button to export as an applet. Embedding the applet in Wordpress is actually a lot more frustrating than writing the damn thing (Solution: I resorted to an iframe. I don’t really want to waste time because Wordpress is being “smart”).

Processing is an awful lot of fun. It evokes a feeling of exploration that I haven’t had since the BBC Basic days - experimenting with maths, mapping it to a plane, just to see what it looks like.

I doubt anyone reading this via RSS will be able to see the applet, but you’re only missing lens-flare-esque coloured blobs. Click and hold to draw. Right-click to clear.

Source code: TransparentEllipses

I’ve had a search running on abebooks for well over a year for the word “anthropodermic”.

Yesterday, I finally got a hit from a book dealer in Texas. The book is from the library of Joseph Sadony, a 20th century mystic, and was presented to him by Fernand Angel.

Aurora Alegre del dichoso dia de la Gracia Maria Santissima Digna Madre de Dios, Francisco Antonio de Vereo, 1727″.

Anthropodermic bibliopegy is the practice of binding books in human skin. Yours for just US$16,895.

« Older entries