Security Improvements! READ COMMENT BELOW!

Improvements:
– Now uses sessions!
– Now uses PREPARED STATEMENTS!!!
– Queries the database less (username stored in session), only query when absolutely needed!

Ran out of time (gotta go out now) and patience (so many things to fix!). This is what you still have left to convert to use sessions and prepared statements:
– index.php
– pastes.php
– profile.php
– search.php

Also you need to finish up this:
– api.php (only the "get" section, read TODO comment)

That is all. I hope you can learn from what I've done here and make better scripts in the future and be able to finish off the rest of these scripts!

— BIT