Flash dropping session cookies

If you have ever used SWFupload with PHP application using session authentication you could run into similar problem.

SWFUpload is a small JavaScript/Flash library to get the best of both worlds. It features the great upload capabilities of Flash and the accessibility and ease of HTML/CSS.
 

Your users are able to upload multiple files using flash uploader after they log into your website. While their browser have no problem with cookie / session handling, flash application ignores session id and in the result, instead of typical ajax result – your reply from server will contain a page with a login form.

This is a very old bug(?), reported back in 2007 (or even before), still available in newest flash player.

Bug affects following browsers / versions:

  • Firefox / Opera / Chrome
  • Flash player 9
  • SWFUpload v2.2.0.1
I have no information on other versions but it seems like bug affects every non-IE browser and every flash player version

There are few workarounds out there, according to Evert Pot and his blog.

In case you are working on a bigger project, where you cannot simply override authorisation I suggest simply upgrading SWFUpload to SWFUpload v2.5.0 Beta 3 – it should do the trick, but beware that it is still beta, unstable version!

I’ve spent too much time to debug this, so for all of you going the same way – please follow my guidelines so you can spend additional hours with your family.

Drop huge amount of emails under linux

Last days I’ve run into an issue with customers email server. It was running very slowly so I’ve had to take a look at it.
Problem was caused by cron jobs sending error emails – 2 errors every 10 minutes.. since ’09..
This caused over 138,000(!) unwanted emails. I didn’t want to spend months at webmail deleting ~30 emails at once so I’ve quickly jump to shell and run rm *. I was quite suprised (I’m a linux noob) that it caused an Argument list too long error. find command ended up with the exactly same error message.

I thought I would try the workaround – bash script.

[~/mail]# nano remove.all
#!/bin/bash
for file in ./cur/*
do
rm $file
echo removed $file
done
[~/mail]# chmod +x remove.all
[~/mail]# ./remove.all

After about 20 minutes script has ended and it worked as it supposed to. Hooray!

I know there should be much easier way like drop whole directory instead, point of this way is to try out bash loops.