Force Download in PHP

This script works in all browsers, including Internet Explorer! 🙂 [code lang=”php”] if (strstr($_SERVER[‘HTTP_USER_AGENT’],”MSIE”)) { header(“Pragma: public”); header(“Expires: 0”); header(“Cache-Control: must-revalidate, post-check=0, pre-check=0”); header(“Cache-Control: private”,false); header(“Content-Type: application-download”); header(“Content-Disposition: attachment; filename=\””.basename($filename).”\”;”); header(“Content-Transfer-Encoding: binary”); header(“Content-Length: “[email protected]($ab_file)); set_time_limit(0); } else { header(“Content-type: application-download”); header(“Content-Length: “.filesize($ab_file)); header(“Content-Disposition attachment; filename=”.$filename); } readfile($ab_file); [/code]

By Andrew Odendaal, ago

Remove an onRelease Handler

After creating a onRelease handler in Actionscript 2 as follows: myMovieClip.onRelease = function() { doWhatever(); } ..you then want to remove the handler for whatever reason, you can remove it like this: delete myMovieClip.onRelease;

By Andrew Odendaal, ago

shortText function toggler in php

I often have to show a shortened version of a news item and then a link to show the entire news article or whatever. Here’s a way to get that short text! [code lang=”php”] function shortText($text, $length) { if( strlen($text) > $length ) return substr(preg_replace(“/(]*>)/”, “”, $text), 0, $length).”…”; return Read more…

By Andrew Odendaal, ago

Windows Live Writer – Beta2

Start writing content to your blogs from your Windows Desktop now. No need to login to your wordpress backend to post items anymore, there is now a decent desktop application that allows you to do exactly that! I have looked at it before but not until recently when Beta2 came Read more…

By Andrew Odendaal, ago

Reported Attack Site!

What the heck is that? So you’ve just visited a website using Mozilla Firefox and this message has popped up telling you that the site looks suspicious. Usually the site has been marked as a possible virus containing website and Firefox will show you this message attempting to protect itself Read more…

By Andrew Odendaal, ago

Send Email PHP Function

Ever find yourself typing the headers into the php mail() function over and over again? Try using a standard function and calling it when you need to send mail. function sendEmail($subject,$content,$from,$to){ $header = "Content-Type: text/html; charset=iso-8859-1\nFrom:$from"; if( mail($to, $subject, $content, $header) ); }

By Andrew Odendaal, ago