MD5 or message digest algorithm, in short, is a message encryptor of some sort. Message encrypted with md5 ensures that it cannot be read by others. What it does is one-way-encryption.
I don't know if this is what you want, but I'm sure that
getenv("HTTP_REFERER") will show the page of origin the visitor came from. Take heed not every server suppots it.
There are couple of articles at this site focus on session and cookie, you might want to check out the Articles section.