• Watson (unregistered)

    I would think it was obvious: they're making sure the numbers are Clear.

    And what gets me about the age restriction is that when you sign up the contract says you do it for a billion years.

  • SEMI-HYBRID code (unregistered) in reply to Volmarias
    Volmarias:
    If all you have is a hammer, everything looks like a nail.

    If all you have is scientology, all of your input looks like body thetans, and it needs to be purged.

    ((once again, as i wanted to quote, but didn't know about it until i hit reply and submitted it)):

    someone reads Raymond Chen's blog in here? =) anyway, i like the method... it's similar to what i would do if i were too lazy to look for VB's IsNumeric function equivalent in JavaScript. (and to be honest, i really don't know the funcion name in JS O:-))

  • dkf (unregistered) in reply to immibis
    immibis:
    Where the hell is 'sverige'?
    It's the name of Sweden, in Swedish.
  • Paxinum (unregistered) in reply to immibis
    immibis:
    Where the hell is 'sverige'?

    Sweden, between Norway and Finland, in the north of Europe. Home land of Ikea & ABBA.

  • microft (unregistered)

    with code like this, no wonder Anonymous is kicking their ass.....

  • Rhialto (unregistered) in reply to Bing
    Bing:
    Oh my, they have good code! They must be evil!!!

    Stop the anti-religion bullshit. Our time would be better spent on things that matter (like the wars, the economy, the election), rather than sensationalist bigotry crap.

    $cientology is not a religion. It is a cult. And a very dangerous one too. For instance they managed to suppress a movie which wasn't even about them, for many years. Somehow it leaked recently: http://thepiratebay.org/tor/4092650/The_Profit_-_The_movie_Scientology_doesnt_want_you_to_see. Smaller versions available too.

  • Hannibal (unregistered) in reply to Volmarias
    Volmarias:
    If all you have is a hammer, everything looks like a nail.

    If all you have is scientology, all of your input looks like body thetans, and it needs to be purged.

    Mahahahahhaaa :DD That was really a good one :D

  • JimM (unregistered) in reply to Rhialto
    Bing:
    Oh my, they have good code! They must be evil!!!

    Stop the anti-religion bullshit.

    Only wrong on 2 fronts! 1) it's not good code (if you're using regex you can test true/false without 10 calls to replace...), and 2) Scientology really isn't a religion. I wouldn't go so far as to call it a cult, like some commenters have; it started as a pure-and-simple money-making scheme. If you really don't want to believe that fair enough, but a quick google for L. Ron Hubbard should turn up plenty of source material for you to mull over ;^)

  • blargh (unregistered) in reply to Volmarias

    This implementation may be faster than Javascript's regexes. Many regexps suck.

  • knarf (unregistered)
    s = s.replace(/ /g,"");

    Another WTF is that spaces are ignored for validation (only). This way the zip will get stored with spaces in the database.

  • lron (unregistered) in reply to Dunkelschub

    you are so sued!

  • lron (unregistered) in reply to Flash
    Flash:
    It may be anti-religion BS, but it's not bigotry. People can't choose to be white, black, female, asian, or eskimo. So making fun of that is bigotry. People can choose what they believe (well, there are unfortunately exceptions in many places). If you have the freedom to believe, and you believe something stupid, you shouldn't be immune from reasoned ridicule.

    Agree 100%. Thank you for putting that more eloquently than I have ever seen it put.

  • (cs)

    Oddly, and despite the obvious fact that Scientologists are despicable money-grabbing rat-bags, this code isn't a huge WTF.

    Yes, you could use regular expressions. Not doing so burns the user, not you (a basic Scientologist principle, I would think).

    The "zip code" test (I'd like to look up the Swedish equivalent of zip code, but then again I'd like to buy a life, please, Alex) actually works for Sweden, so long as you permit the absence of any entry whatsoever.

    The phone number test is better than most I've seen, in that it extracts irrelevant characters (credit-card entry, anyone? Not that I'd recommend that if you're on a Scientology site). It is, however, weird. It's been a while since I've been in Sweden. What exactly is the problem with a number starting with "07"? I thought that was Stockholm, but I'm obviously wrong. The rest of the if-statement is equally mystifying.

    I do like the age limitation, though. Uncommonly decent of the perverts who run these sites, I'd say. Or, in the words of St Francis (blessed be he in the eye of a needle) Xavier:

    "Give me a child until he is seven and I will give you the man."

    Looks like the nutters are aiming for pubescents, then. Lock up yer daughters!

  • theholefiller (unregistered) in reply to A

    if they get your land line number then they can get your home address

  • Dave (unregistered) in reply to notme
    notme:
    DeLos:
    Dunkelschub:
    The Real WTF is Scientology
    You beat me to it!

    Seriously though, does anyone else have the feeling that they are all laughing at us. Tom Cruise and John Travolta are sitting at dinner saying things like "I can't believe people are joining us!", "We can make people do ANYTHING because we are celebrities!" and "This is more fun than taking stands on politics!".

    It really must be an elaborate joke. No one can really believe such things...

    right?

    Well, seen from an objective distance, many other world religions are not much less ridiculous than this one...

    And that's why the proposed UK laws against religious hatred are a bad idea, because there's nothing wrong with taking the piss out of stupid belief systems.

  • Dallas John (unregistered)

    Odd that all of the ads on the page when I got here were advertising "Scientology Video Channel!"

    I'd think that thedailywtf would protect it's users from such a dangerous cult of mega-psychos.

  • (cs) in reply to codemonkey
    codemonkey:
    Entry:
    if(trim(document.getElementById("M_land").value.toLowerCase()) != "sverige") { return(true); }
    Someone You Know:
    Notice that the ZIP function will succeed without checking the input if a hidden field on the form is set to "sverige" (Sweden), ignoring case.

    Because, you know, Sweden is the only country that doesn't use a ZIP code.

    Actually, it says val != "sverige" return true. Thus if the person is from Sweden, they require checking, otherwise they know what they're doing.

    As this is a Swedish page, rather than a localisation of a generic page, it is fairly reasonable for the programmer to only bother with Swedish ZIP codes, and hope that no-one overseas makes a mistake, to simplify validating. Since some countries do not jsut use a number, the full validation for every country would get horribly complex vary quickly. For example, British postcodes use the format \[A-Z]{2}\d\d?[- ]\d\\[A-Z]{2} (Example PO10-7QZ), so checking for a numeric value would not work either. Of course, if I were writing a page where I expected to ship to the whole world, then I would do this properly and internationalise the validation.
  • (cs)

    lol reading thru the source, and noticed this gem too =) What a gold mine! Guess they've never heard of += / .= / common sense? function saveWho() { var cval = ""; cval = cval + fix(mform.M_fornamn.value) +";"; cval = cval + fix(mform.M_efternamn.value) +";"; cval = cval + fix(mform.M_adress.value) +";"; cval = cval + fix(mform.M_postadress.value)+";"; cval = cval + fix(mform.M_land.value) +";"; cval = cval + fix(mform.M_postnummer.value)+";"; cval = cval + fix(mform.M_email.value) +";"; // cval = cval + fix(mform.M_tel.value) +";"; cval = cval + fix(mform.I_yrke.value) +";"; cval = cval + fix(mform.M_age.value) +";"; cval = cval + fix(mform.M_kontaktinformation.value) +";"; cval = cval + fix(mform.M_anledning.value) +";"; cval = cval + fix(mform.M_intresserad.value) +";"; cval = cval + fix(mform.M_forbattra_hos_dig_sjalv.value) +";"; cval = cval + fix(mform.M_fraga.value) +";";

Leave a comment on “N-Replace Zero-Test”

Log In or post as a guest

Replying to comment #:

« Return to Article