- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
The forum gremlins.
I don't think there's anything Alex can do.
Admin
It's being passed in a very lame attempt to throw off anyone who knows about query strings from modifying the query string to try and trick the system. Someone trying to trick the system is more likely to start trying to change the value of "tot" rather than "track", when in reality tot is a dummy value and track is the actual total, but masked. [sarcasm]Of course we all know that they would only every try to change the value of tot, and never ever any other query string variable. [/sarcasm]
Admin
I can't agree somehow.
Admin
What's the point of even doing it once?
Admin
Everybody knows the more complicated the encryption the harder it must be to crack. "maskerAmount = ((((oTotal + 22) * 7 )) - 12) * 620" is much harder to crack than "maskerAmount = oTotal * 4340 + 88040" (or whatever).
--Rank
Admin
Actually, "The Wiz" is (was?) a NYC-area electronics chain store. The slogan was "Nobody beats the Wiz!"
Admin
Admin
The phantom of the opera is there...
inside your code [:|]
Admin
The whole point of the response is to throw people off with saying the 'amount=' maskerdummy, when in reality the real total is in 'track='.
Admin
Neither is POST safe. I just had to mention it...
I always code my webapps with the philosophy that everything the user send me (the app) is a _request_ to do something. Once this logic sets in the head, queries like
"SELECT name FROM client WHERE clientid = '$clientid';"
should set off some alarm bells.First, is the variable safe? (Assuming PHP) has addslashes() been run on the variable? Using hungarian notation on variables has proved very useful for me. I use the prefix "us" for all unsafe variables and "s" for safe. This way it's much more likely that I'll spot any security hazards.
Second, this is an app where users keep track of their clients and how many hours to charge them for. Where's the check to see if that client "belongs" to the user requesting the name? If there is no such check, users may be able read each others data.
This is much better:
"SELECT name FROM client WHERE clientid = '$sClientid' AND owner = '$sUserid' LIMIT 1;"
Just a newcomers two cents.
Btw, love the site :-)
Admin
Heh. Personally, I think XP is a complete travesty, and I loathe it as a development paradigm - but the XP crowd does have some important lessons to teach. Specifically, careful and judicious application of YAGNI (more as a principle of avoiding excess complication than a holy mantra) and a willingness to refactor anything and everything that suggests that it needs it. I've seen a huge boost in code cleanliness in all sorts of projects when these kinds of things are applied.
Screw XP, yes... but rejecting all the teachings of something out of hand just because the whole is stupid is not wise ;-)
Admin
You wish.
(Yechnology marches on.)
Sincerely,
Gene Wirchenko
Admin
Uhm, how about a session variable already?
Admin
Those calculations are using an idiom for generating a random number bounded by a lower bound of 100000 and an upper bound of 999999 (ie., a number from 100000 to 999999 inclusive).
The general algorithm is: ((upperBound - lowerBound + 1) * randNum) + lowerBound
Of course, it would have made more sense to put that into a nice little function (assuming VBScript doesn't already have one), but this is one thing in the code that may be a WTF, but not an idiotic WTF.
Admin
All of the good tenets of XP, such as code reviews, have already been incorporated elsewhere. Everything else, such as YAGNI, haven't, and with good reason. YAGNI is self existent in good design; if it wasn't in the design, then don't code it. In other words, it's been around before XP, and will continue to exist long after that travesty goes away, which we can only hope it will.
Admin
Well sure, you could do all that. But W(hy)TF would you expose critical data like that in the first place? The page that needs the data should get it from the app, not the request.