Sunday, June 29, 2014

How to unicycle

I think I can officially say that I can ride a unicycle. I have been practicing on a unicycle for a couple weeks here and there. I finally got to the point where I can ride comfortably for a while. It requires A LOT more leg strength than a bicycle, so right now my longest is about 200 meters, just because my legs started to give out.

Thursday, June 26, 2014

Use bin2hex and unhex as simple sql injection prevention

When it comes to sql injection prevention prepared statement is definitely the correct solution but if you find yourself in a predicament that prevents you from using one hexing and unhexing works.

Use a query like this:
$query = "SELECT * FROM table WHERE column = UNHEX(".bin2hex($userInput).")";

http://stackoverflow.com/questions/22567944/is-hexing-input-sufficient-to-sanitize-sql-queries