Well since you are quoting an excaped string in your query, you will be safe with injections. Encoding the image name string using htmlentities is not helping with security issues.
I assume that this script file would serve the actual file contents rather than output an HTML string, so you would need to read the file contents out to the buffer. This opens up a whole new can of worms though.
You should validate the given path and filename carefully so someone cannot exploit your script and view the contents of your php, htaccess, or other files. You would also need to check the file system that the file exists and is readable, and set your content type HTTP headers correctly.
If you plan to automate this and do not want to manually keep adding new rows for every image you add to your file system, then you should first count the rows where this path/filename is stored in the db and do an INSERT if the count is zereo or an UPDATE if greater than zereo.
You should also consider URL encoding the image link:
www.mywebsite.com/images.php?image=folder%2Fimagename.jpg
__________________
<mgraphic /> - I don't have a solution but I admire the problem.
|