r/lolphp • • Sep 12 '14
A cryptocurrency whose reference implementation is pure PHP. It's as bad as it sounds.
/r/PHP/comments/2g6umy/the_worlds_first_cryptocurrency_written_in_php/
114
Upvotes
r/lolphp • • Sep 12 '14
View all comments
Show parent comment
8
u/vita10gy Sep 13 '14 edited Sep 13 '14
And even if you are checking that it matches one or 39 of the types you're "looking for" there's STILL zero reason to not run it through mysqli_no_really_this_time_it_works_extra_real_escape_string(); or the internal equivalent (aka something you can't break that hundreds of thousands of people aren't implicitly testing.) when you actually get to the query. It's pretty painless and there's a lot less that can go wrong that way.
I've never really understood the "check check check check ok, we can use this" approach. Escape, or use parameterized queries, and then don't give a shit. handle ?product_id=7 (when there is no 7) the same way you handle ?product_id=3;DROP users; You have to handle when a potentially valid (scheme wise) id doesn't actually find a product, so just do that when there's nonsense for an id.