Wednesday 25 April 2012

Were We Redirected?

I found this one in a custom piece of shit software (luckily, not in a widespread CMS or something). That was a grabber. Sure, there were some redirects while crawling websites. And, ladies and gentlemen…
The most stupid way to check for redirect I've ever seen:
stripos($result, "<head><title>Document Moved</title></head>") !== FALSE

Then guy tries to figure out what's the address he's been sent to:
reg_match( "#(?i)<a HREF=\"(.+?)\">#", $result, $href );
Nothing to add, really. Enough said.

No comments:

Post a Comment