THIS IS (ALMOST) TOTALLY OFF-TOPIC HIT DELETE NOW Unless you want a chuckle at my expense... :-) On Tue, March 13, 2007 9:23 am, Jochem Maas wrote: > Richard Lynch wrote: >> By definition, all HTTP data is of type 'string' because that's the >> ONLY data type HTTP supports. >> >> PHP will cheerfully typecast it to whatever it needs to be later, >> but >> when it first comes in from the GET (or POST or COOKIE or whatever) >> data, it's going to start its life as a string, no matter how it >> looks. >> >> If you *know* it should be integer, typecast it as you get it: >> >> $foo = (int) $_GET['foo']; >> >> Do this to a) self-document your code, b) foil a ton of web-bots and >> nasty people trying to cram the wrong kind of data into your >> application to break/abuse it. >> > > you forgot c. > > c) because it's what all the cool kids do. > > actually forget c. cool kids aren't writing code, they're all > smoking crack, driving 100,000 dollar cars and pimping out college > girls. > > here's hoping your day is better than mine :-P Actually, I think I posted this on the same day that Com Ed (local electical utility company monopoly) did their usual monthly auto-pay out of my checking account... Their meter-reader-in-training however, misread the meter, and they decided that my electric bill was: US $9,443.78 Yes, really. I live in a one-bedroom apartment. My usual bill is like $30 in winter, up to $100 in hot summer months with window A/C going full blast all month. (I hate muggy heat.) I don't think I could put any gear in here that would use $9K worth of electricity in one month without the gear bursting into flames! By the time I spotted this error, and called them it was Friday after 5 pm. The phone monkeys all agreed (both bank and Com Ed phone monkeys) that it was obviously a mistake, but they could do nothing until Monday. Except the one who *thought* she could, only it turns out she couldn't reverse it out because it was a mistake of over $5K, and only a manager can reverse out a $5K or bigger mistake, so I'd have to wait until Monday. At no point did any human question the utter impossibility of this charge being correct -- They only said that they couldn't fix it because things usually don't go this wrong, and they weren't permitted to fix it as a matter of policy. So not until 5 days after the event did I get my money back. The United States Postal Service never actually delivered my statement, by the way, so I didn't really have a chance to head this off in advance. [Chicago postal service just made headlines as worst in nation, as usual, for those who disbelieve the previous sentence.] Did I mention that I'm trying to buy a house, so my earnest money check was invalid?... I got lucky, and the seller didn't actually deposit the check. And the deal fell through, but still... I'd have to say this was one of my more stressful weekends. So, no, Jochem, I probably wasn't having a better day than you that day. :-) Take heart. Your day could have been worse. I doubt the Sears Tower spends $9K on electricity in a month. Maybe some full-up monster data center... Does anybody know of any valid electical monthly bill (not counting something in arrears on previous months) of over US $9K? Sheesh! You *know* they have all kinds of "red flag" checks to protect themselves against scammers, schemers, and just plain no-payers, but I guess they don't give a [bleep] about protecting *my* money, with a simple sanity check. :-( Lord knows they can't even do an "estimated" bill right -- When they can't get in to read the meter, they routinely estimate it at either $50 (a bit high, but okay) or $8.xx. I dunno why their algorithm likes 8 so much, but this has happened once or twice a year for 22 years. It got to the point, before autopay, where I just ignored their estimate, and sent in my estimate, so I wouldn't end up in arrears. I'd have a "credit" until they read the meter, and then they'd figure out I was right, and I'd be caught up. So they can't do a simple estiment. Apparently, every Com Ed programmer skipped Home Ec. And 5th grade math. And 6th grade. And 7th, 8th, and most of high school math. Forget college. Because estimating a bill is about as simple as it gets... So, to make this post nominally be ON-topic: Moral: Your PHP script should be smart enough to not do something this stupid if you are handling money. Sanity checks are good. Unusual events should require human review. Computers are stupid. Humans should be given the authority to do their damn job, or have a Manager available 24/7 who *does* have that authority. Thank you. PS I'm still waiting on the bank to reverse the $25 overdraft fee this caused, as I do *not* keep $9K+ in my checking account. Bill Gates might do that, but I sure don't. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php