Check if file name is correct before creating db record. Log client ip address.

There has been some vandalism recently on infragram.org. Someone is using script to create many useless db records. This commit adds basic protection against such individuals. Filename is checked before db record is created. Also client ip address is logged so that it is easier to block such attacks in future.

Delete function has changed. Nothing is really deleted but appropriate fields are updated and deleted image doesn't show up on index page. This should give us relatively easy restore option in case someone uses script to delete all images in db.