Shoutbox

php and mysql help md5 hash... - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: php and mysql help md5 hash... (/showthread.php?tid=26897)

php and mysql help md5 hash... by stonesour on 06-07-2004 at 11:12 PM

What i'm trying to do, is for my forum hide the name of a file, so I want to md5 hash the filename on upload, and insert it into say ibf_md5image

in the table ibf_md5image, it would have a column for the md5 hash, and the original filename. So then in my forum, I would link the image to the md5 hash. My question is in my script watermark.php I want to hide the filename, so people can't remove the watermark by simply going to the original.

SO currently when I click an uploaded image on my board it goes to http://mysite.net/forums/uploads/watermark.php?na...ome-image-name.jpg

I want it to go to
http://mysite.net/forums/uploads/watermark.php?name=md5hashedname.jpg

So, because the the md5 hash of the filename isn't the exact filename, what I want to do is have my watermark.php show the image, and figure out the filename using some sql. But i'm not sure how I would word the statement.

select real_name from ibf_md5image where hash_name = $variable

now somehow, it would have to get the md5 hash name from the url, so the link on the board to the image would have to pass the md5 hashed filename to the variable.


Is this possible?


RE: php and mysql help md5 hash... by Hah on 06-07-2004 at 11:18 PM

Sure is....you need WDZ or some other MySQL/PHP expert for the ins and outs though.

Im guessing that in the filename on the board, the md5 sum will include the .jpg, so the user wont even know its a jpeg. You could include the content type in the mysql table as well if you wanted to use the function out side of the watermark.php function e.g. for a download script to keep track of downloads etc.

I can't tell you much (coz i dont know and im not going to pretend) but I can tell you that it certainly is possible.

Tah,

Hah


RE: php and mysql help md5 hash... by fluffy_lobster on 06-08-2004 at 11:16 AM

If I get your question right, you need to use either $_GET['name'] or if you're sure there are no other variables called name and your server supports it, just $name

Don't forget to put quotes in the query.  Your query will then be something like:

"SELECT real_name FROM ibs_md5image WHERE hash_name = '$_GET[name]'"

That help?