People do silly things. Developers as much as anybody, if not more. Sometimes they run into problems, and unwittingly reveal the silly things they do. Sometimes, they don't care much about the core silliness, and just want to get past the specific problem they're having. No problem - people on SO are pretty good about answering the problem being asked, and (gently or not) prodding the asker to fix the deeper problems.
Should we do anything different if the core silliness is actively harmful?
Case in point. This developer is trying to fix problems with his login code. The code could have been taken directly from a "don't do that" section of a web development book, with big tasty SQL injection and cleartext password storage vulnerabilities. This code should never be used anywhere, and should be dropped in the nearest star. I and others made that point in comments to the question and answer.
I don't like that this question exists. Someone will arrive from Google from a search triggered by that code, ignore the comments (as the OP seems to have), and copy-paste pieces of that code into their own application. That happens all the time, no big deal, except that here, it'll cause more news articles, and more problems with passwords shared between amateur sites and bank accounts. I want to do something to this question - either put a giant header on top ("NEVER EVER USE THIS!"), or delete it outright.
But, this question was asked in good faith. Truth is, lots of sites use code like this, much as we'd prefer that they wouldn't. It's a reasonable question with an answer, that'll get the OP past his problem. I can't really vote to close or delete it, or even downvote it.
We've discussed what to do if a question is asked in bad faith ("I want to hack this website. How to?"). What about questions asked in good faith, but with such problematic content that we want to prevent other newcomers from ever using it? Remember that warnings tend not to be read. Do we have a responsibility to protect the world from actively harmful content, or are we a common carrier that tries to answer everything answerable?
EDIT: The referenced question has another, more reasonable answer now, and on reflection, I think my issue was more with the first answer, which attempted to fix the immediate problem without addressing the core issue. Voting may work here, and may prod the answerer to fix up his answer.